Repository navigation
FAC patch summary: one collective record of the patch on the multigrid hierarchy - #928
Merged
Merged
Conversation
CustomMGHierarchy.level_patch_rows is rank-local, and its form differs between ranks (None, one (owned, subdomain) pair, or a list of pairs; an empty pair on a rank holding no part of a zone). Every driver summed it itself with raw MPI, and one that looped a reduction over its own blocks hung at np 4 on kaiju after its solve had finished (the add-on matrix's row 5). custom_mg.fac_patch_summary makes the per-level record with one allgather: blocks, owned and subdomain rows summed over the ranks, the largest block, and each rank's block sizes. CustomMGHierarchy.record_patch_summary stores it as hierarchy.patch_summary, and every install route calls it with the rows it installs: CustomMGHierarchy.install and the rotated path's two _configure_pcmg calls. Reading it afterwards makes no collective call. No smoother, transfer or default changes. test_1133 (tier B, np 1/2/4): - a fault-zone strip near one wall, so that ranks without zone cells hold the empty pair at np > 1: every rank holds the same summary, coarse levels None, and 1510 rows at np 1; - test_1106's fault fixture through the rotated path: the structural rows are the recorded serial counts at any rank count, and equal the rank-local record summed. Both pass serially; np 2 and 4 run on kaiju. Underworld development team with AI support from Claude Code
…parallel From the adversarial review of 04b7a76: - test_1133 had no serial line in scripts/test.sh, unlike the other tests/parallel files without a min_size mark, so CI never ran its np 1 baseline (1510 rows, one block); it is now in serial batch 4. At np > 1 the zone test also asserts that the union of the ranks' global rows is exactly the serial 1510, not only that the summed rows are no fewer. - The record is made after the patch is installed (install, both rotated _configure_pcmg sites), and its docstring and the doc say it is each block as handed over, before PCASM adds its overlap layer. - The helper is private (_fac_patch_summary); the rotated sites test `_hier is not None` instead of hasattr. Underworld development team with AI support from Claude Code
…uild From the second review: the rotated route recorded the summary before the velocity PC's set-up and the standard route after it, so a set-up that raised left a record on one route only, and a record survived a later failed re-install. Both rotated sites now record after the FAC smoothers are set up, as install() does, and build() clears the previous record. The collective recorder is private (_record_patch_summary); test_1133 carries its tier on each test. Underworld development team with AI support from Claude Code
…cords The monolithic (single-field) route configures PCMG without setting it up, so the record follows configuration there and set-up on the velocity-block routes. Underworld development team with AI support from Claude Code
Member
Author
Pre-PR adversarial reviewThree rounds: 04b7a76, then eed0a6c, then a final check of 35a0aac. No HIGH findings. Each finding below was fixed on the branch, except two LOWs left as they are. Round 1
Round 2 (eed0a6c)
Final check (35a0aac)
Attacks that failed
Issue verdicts
Underworld development team with AI support from Claude Code |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The summary can report patch blocks that were never installed, and the tests do not cover the unequal per-rank block counts behind the reported collective hang.
2 open issues
What changed in this PR
Adds a collective FAC patch summary to the custom multigrid hierarchy so diagnostics can read global patch sizes without issuing rank-dependent collective calls.
Changes:
- Records per-level block counts, row totals and per-rank block sizes at installation, and clears the summary on rebuild.
- Integrates summary recording into ordinary and rotated solver paths.
- Documents the record and adds serial/MPI regression tests with serial test-runner coverage.
| File | Description |
|---|---|
tests/parallel/test_1133_fac_patch_summary_parallel.py |
Adds zone-strip and structural-patch summary tests. |
src/underworld3/utilities/rotated_bc.py |
Records summaries at both rotated installation sites. |
src/underworld3/utilities/custom_mg.py |
Implements collective aggregation and summary lifecycle management. |
scripts/test.sh |
Includes the new tests in serial batch 4. |
docs/developer/subsystems/fault-split-multigrid.md |
Documents summary contents and collective-free reads. |
Review effort: Balanced
| recorded as handed over, before PCASM adds its overlap layer at | ||
| set-up. Reading :attr:`patch_summary` afterwards makes no collective | ||
| call, so any rank can read it alone.""" | ||
| self.patch_summary = _fac_patch_summary(patch_rows, comm) |
| centroids = np.array([base.dm.computeCellGeometryFVM(c)[1][:2] | ||
| for c in range(cS, cE)]).reshape(-1, 2) | ||
| zone = (centroids[:, 0] > 0.05) & (centroids[:, 0] < 0.2) | ||
| set_custom_fmg(stokes, levels, field_id=0, fac_zone=zone) |
lmoresi
pushed a commit
that referenced
this pull request
Nov 3, 2026
…-selection One conflict in scripts/test.sh, adjacent batch-4 lines (test_1133 from #928, test_1138 from this branch); both kept. Underworld development team with AI support from Claude Code
lmoresi
added a commit
that referenced
this pull request
Nov 3, 2026
…k solver (#929) The cover gate's record (fac_gate) and the patch summary's reset sit side by side at build; test.sh's batch 4 carries test_1133 and test_1134. Underworld development team with AI support from Claude Code
lmoresi
pushed a commit
that referenced
this pull request
Nov 3, 2026
…k-919 One conflict in scripts/test.sh, adjacent batch-4 lines (test_1132 from this branch, test_1133 from #928); both kept. Underworld development team with AI support from Claude Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

CustomMGHierarchy.level_patch_rowsis rank-local, and its form differs between ranks: None, one (owned, subdomain) pair, a list of pairs, or an empty pair on a rank that holds no part of a zone. Every driver summed it with its own MPI calls. One driver looped a reduction over its own blocks, and that hung at np 4 on kaiju after its solve had finished.Change
hierarchy.patch_summaryholds, per level:_fac_patch_summary) makes it when the patch is installed:install(), and both rotated sites after the FAC smoothers are set up;build()clears it. Reading it makes no collective call.fault-split-multigrid.mddocuments the record.Tests
tests/parallel/test_1133_fac_patch_summary_parallel.py(tier B; np 1 in CI's serial phase, np 2 in the MPI phase) has two cases:On kaiju (Linux, PETSc 3.25.0), test_1133 passes at np 1, 2 and 4. tests/parallel at np 2 and 4, and tier A+B, show no failure beyond the development baseline.
scripts/test.shgains a line in serial batch 4 at the same place as the #919 PR and the serial_reference PR.No issue. Left open in this territory: #888 (whether a rank holds an empty pair at np 2 depends on the partition).
Underworld development team with AI support from Claude Code