Repository navigation
Fix MPI submesh injection across parent ownership boundaries (completes #858) - #1095
Conversation
Reduce source values and multiplicities through the parent field DM before owner synchronisation. This preserves spatial injection without global coordinate gathering, including add mode and untouched exterior values. A parent owner may retain no extracted-region cells even when another rank has the corresponding source node. Add independent P1/P2 vector replace/add regressions. Reproducer: annulus 2h buffers at h=1/32 on 16 ranks lose four inner-wall source values despite correct saved submesh topography. Static compilation and diff checks pass; matching versioned int32 installation, serial/MPI regression gates and affected scientific reruns remain pending on Gadi.
Avoid implicit child redistribution when a filtered region or surface occupies only one MPI rank. Preserve the parent-derived point/DOF mappings and retain the existing parent-owner reduction. Make surface emptiness validation collective so ranks outside a valid surface do not fail before PETSc extraction. Add deterministic P1/P2 replace/add coverage with the region concentrated on one parent rank, plus empty-rank re-extraction/cell-size and surface-label tests. The four new transfer cases fail on the original PR with errors 5.0/4.0 before this change. Validation on an isolated rebuilt Mac PETSc 3.25 int32/Open MPI runtime: 20 serial passed, one existing expected failure; 23 passed on each of two ranks; 10 passed on each of four ranks. Python parsing, Black test formatting, deprecated-pattern gate, CI test reachability and diff checks pass. Shared runtime and benchmark results unchanged. Next: verify the fresh Linux/MPICH CI run. Underworld development team with AI support from Claude Code
Reduce component minima and maxima in the parent field section SF before changing any target values. Preserve raw nondimensional transfer and document collective surface extraction and its persistent empty labels. Underworld development team with AI support from Claude Code
…sts pinned H1's review of f93cadb (2026-11-06), with development merged. - The injection test now puts the extracted region on rank 0 and its neighbour on the last rank, split at the interface (y = 0.85). Parent DOFs owned there by a rank with no child copy now exist, and the test asserts that they do; the old prolongate body fails it (10 tests at np 2 and 3), where before it passed. - The section SF taken in prolongate is released: it grew memory by 1098 kB per call at 23.6k DOF rows on rank 0 at np 2; now 0. - The shared-value reduction is a helper, _reduce_injection, with the public MPI.DOUBLE. - extract_surface asks hasLabel before reading a label (getLabel gives a null handle, and getValueIS on it aborted PETSc), and no longer adds empty labels to the parent: every rank already has the label. - New tests: agreeing shared copies are injected (a missing division by the multiplicity now fails at np 2); the rejection tolerance on both sides and non-finite values; a missing label raises ValueError. The MPI-only tests carry mpi(min_size=2). - tests/test_0858_submesh_injection_odd_ranks.py runs the annulus injection at np 3 and 5 from serial CI (#1087), from a field of sevens so dropped old values show, and asserts orphan DOFs exist. - The design note's paragraph moves below the flavours table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adversarial review of #1095 (H3, second review desk)Verdict: READY at b09e3dc. The injection is correct under every attack we ran. Each of H1's 2026-11-06 merge conditions on #858 is met, and each new test fails on the bug it names. Reviewed head FindingsNone blocking.
Attacks that failed
H1's 2026-11-06 merge conditions on #858
Issues
Not testednp above 5; Open MPI; 3-D regions; periodic parents; the Gadi np 16 workflow. Underworld development team with AI support from Claude Code |
…evelopment f8c6014) into underworldcode#856 underworldcode#856 must land after underworldcode#858: its collective _surviving_labels needs underworldcode#858's collective extraction guards. Merged, not rebased, to keep gthyagi's commits and authorship. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test launched np 3 and np 5 and required some parent DOF on the region's edge to be owned by a rank with no child copy of it. On macOS the default partitioner left none, so the test failed its precondition before testing anything (W1, on wombat). A shell partition now puts the region's cells (r < 1) on rank 0 and deals the rest to ranks 1 to n-1 by angle; PETSc gives a shared point to the highest rank sharing it, so the edge at r = 1 is owned by ranks with no child cell, on any platform. Measured: 104 such DOFs at np 3 and 5; the transfer exact. On the code before underworldcode#1095 the replace error is 8.0 and the add error 1.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Supersedes #858 (gthyagi's "Fix MPI submesh injection across parent ownership boundaries"). His three commits are kept, merged, not squashed; this branch adds development and the review follow-up. Fixes #1087.
What changed and why
The defect (from #858).
Mesh.prolongate, andcopy_intofrom a submesh to its parent, mapped DOFs rank by rank, wrote matched rows, then synced. That keeps each DOF's owner's value. A parent DOF on the region's edge can be owned by a rank with no child cell there; that rank had no copy to write, so the DOF kept its old value. Separately, an extracted region on one rank was redistributed by the Mesh constructor, which broke its parent map.#858's fix:
Review follow-up (H1, 2026-11-06), in b09e3dc:
_reduce_injection, usingMPI.DOUBLE.extract_surfacecheckshasLabel(a missing label raised a PETSc abort; it now raisesValueError) and no longer adds labels to the parent.tests/test_0858_submesh_injection_odd_ranks.pyruns the annulus at np 3 and np 5 from serial CI, starting from sevens, and asserts orphan DOFs exist.The full list, finding by finding, is on #858.
Tests
tests/parallel/test_1087_submesh_prolongation_ownership.py: 20/20 at np 2, 3 and 4.Follow-up
#856 (boundary names across ranks) lands straight after this, as #858 says; it covers H1's finding 5.
Checklist (UW3 Style Charter)
level_*andtier_*markers (S8).array/mesh.X.coords(S7). The injection copies raw nondimensional values: S7's variable-to-variable exception.pixi.toml/pixi.lockor other dependency changesUnderworld development team with AI support from Claude Code