Skip to content

Collective failures in the split-level transfer, and a global winding vote in the line cut (#874) - #1130

Merged
lmoresi merged 6 commits into
developmentfrom
bugfix/fault-mg-collective-raises-874
Nov 13, 2026
Merged

lmoresi merged 6 commits into
developmentfrom
bugfix/fault-mg-collective-raises-874

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Addresses #874 in part: the cell-located transfer's rank-local failures and the line cut's winding vote. Still open under #874 (the same failure, outside the code this PR guards): a singular _node_weights reached first through fault_mg.provenance_transfer_parallel, which makes the same unguarded calls, and a failing locate_in_cells through addon_partition._parent_cells_local; both still hang when forced on one rank (H1's review); and a rank-local raise inside add_fault's split, before its own collectives, which fault_mg.split_tail_levels' comment cites. Guarding the first two is the same few lines as A, but they are other routes with their own fixtures to test, so I would rather do them as their own small PR than widen this one.

What and why

Rank-local raises in fault_mg.cell_located_transfer_parallel. Three failures could raise on one rank before the next collective:

  • a fine node that belongs to no cell;
  • a singular nodal matrix in _node_weights;
  • a node located on no rank.

Forced on one rank at np 2, the other rank waited in the stats allreduce and the job hung. Each failure is now collected and raised on every rank, the same RuntimeError, through fault_contact._collective_raise, before each following exchange (the stats, the answer exchange, the assembly).

The winding vote in line_cut. On a surface mesh, the orientation convention was a rank-local majority. A rank whose cells were mostly inverted flipped its own convention, and the inversion count undercounted (1 where there were 2). On the collective paths the convention is now voted over every rank (_global_flip, one allreduce): the snapping loop's quality floor and veto, and the inversion count after the cut. Rank-local callers keep their own vote, and that includes place_surface's surgery, which runs on one rank, where a collective would deadlock.

One winding convention, after #1128 (merged in at 9314d6a)

#1128 reads each cell's winding from the mesh as given in pull_vertex_onto, and tests each cell's quality before and after a move against that per-cell baseline. This PR adds a global vote for the surface-mesh convention. They meet as follows.

The convention, which way a surface mesh is wound, is voted once per call over every rank (_global_flip, one allreduce). That one value is passed to every _cell_quality reading in both places:

  • in pull_vertex_onto: the wound baseline, and the before and after qualities;
  • in the snapping loop: the quality floor and the veto.

cell_areas(..., global_vote=True) does the same for the inversion count after a cut. #1128's per-cell baseline survives unchanged, and is now read under that single convention. Before, _cell_quality applied a rank-local majority on every call, which could change between the before and after readings and flip every cell's sign. Rank-local callers (place_surface's surgery on one rank) keep their own vote, as before.

On the merged head:

Review round 2 (W1: A, C, E, B)

A. The two locate_in_cells calls (the rank's own nodes, and the answer stage) are now inside the guarded blocks. The handlers catch Exception, as split_tail_levels does, so a collapsed coarse cell or an IndexError also reaches _collective_raise on every rank.

C, the convention, and W1's side finding. The winding is voted on the mesh's own communicator, over every rank: a count, each cell voting with the sign of its own area. It applies in 2-D as well as on surface meshes. A tie or a mesh with no cells gives no flip.

The vote is used only on the collective paths: the snapping loop's floor and veto, the inversion count after a cut, and pull_vertex_onto. place_surface's callers of cell_areas, several of which sit under a rank-local branch, keep the rank's own reading. In 2-D that reading is the planar sign as before.

An anticlockwise mesh gives no flip, so its 2-D results are bit-identical to development. The case that changes is a mesh wound clockwise throughout, which cut_along_lines used to refuse at any snap_frac, even 0 ("snapping inverted 466 cell(s)"). That was W1's side finding, and it is fixed here.

New tests:

  • tests/test_0874_mirrored_mesh_cut.py: a box with x mirrored is cut at snap_frac 0 and 0.3 with the same number of cut edges as the box. It fails on development and passes here, serially and at np 2 to 4.
  • The count test gains an inward-majority case.
  • Both fail with _global_flip replaced by return False.

E. This PR no longer says it fixes #874 outright; see the first line.

Tolerances: none added.

B. In pull_vertex_onto the vote decides nothing: #1128's per-cell baseline multiplies it out (W1: 0 of 1224 calls differ under three mutants). It is kept so that every quality reading in the file is taken under the one convention.

On this head:

Tests

tests/parallel/test_0874_fault_mg_collective_failures_parallel.py, at np 2, 3 and 4:

  • The transfer. The test records the arguments of a real split-level transfer (a fault cut into an adapt child), then repeats the call with _node_weights failing on the last rank only. Every rank must raise the same error. Before the fix the job hung: the supervisor stopped it after the silence window (exit 124).
  • The count. Rank 0 holds outward triangles and every other rank holds two inverted triangles out of three, as in the review probe. The count must equal the truth. Before the fix it was 1 where the truth was 2.

Not in this PR

Checklist

  • Style Charter followed (S2)
  • No drive-by changes (S9)
  • Regression tests written first, shown failing (a hang, an undercount), with level_2 / tier_b markers (S8)
  • No hedging names or commented-out code (S3, S4)
  • Every caught exception is re-raised collectively
  • No data-access changes
  • Parallel: np 2, 3 and 4 (S11)
  • No dependency changes
  • AI attribution below

Underworld development team with AI support from Claude Code

…vote (#874)

fault_mg.cell_located_transfer_parallel raised on one rank (a fine node in
no cell, a singular nodal matrix in _node_weights, a node located nowhere)
while the others waited in the next allreduce: forced on one rank at np 2,
the job hung. Each failure is now raised on every rank, the same error,
through fault_contact._collective_raise, before the stats exchange, the
answer exchange and the assembly.

line_cut's surface-mesh winding convention was a rank-local majority, so a
rank whose cells were mostly inverted flipped its own convention and the
inversion count undercounted (1 where there were 2). On the collective
paths (the snapping loop's quality floor and veto, the inversion count after
the cut) the convention is now voted over every rank (_global_flip);
rank-local callers (place_surface's surgery) keep their own vote.

Test: test_0874_fault_mg_collective_failures_parallel at np 2-4: the forced
failure is raised on every rank (it hung before), and the count is exact.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 04:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

line_cut.py met #1128's pull_vertex_onto, which reads each cell's winding
from the mesh as given and tests quality before and after each move. One
convention now serves both: the surface-mesh winding is voted once per call
over every rank (_global_flip) and passed to every _cell_quality reading,
in pull_vertex_onto as in the snapping loop; #1128's per-cell baseline is
read under it.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Adversarial review of #1130 at 9314d6a

Independent review by a fresh agent for W1 (the integration session, which owns the cut, placement, split and fault multigrid modules). The PR was written by H5 (the probe-pass desk). All runs here are on macOS, 12-core Apple M4, serial only: nothing below was run on more than one rank, and every statement about parallel behaviour is by reading, not run. Development for the comparison is d66c7da.

Result

On every path we could run, the branch does what it says: the three listed failures of the split-level transfer leave through the collective route, and 10 759 cut and pull calls give bit-identical results to development, including the #1128 wall-rule cases. Two things stand between this branch and "Fixes #874": two calls in the same transfer are still outside the guarded blocks (finding A), and the comment in split_tail_levels still cites #874 for a hang the branch does not touch (finding E). The count's test does not pin the vote's direction or any call site (finding C); that does not block.

Findings

A. Two locations in cell_located_transfer_parallel are outside the guarded blocks. Blocks marking #874 fixed; does not block merge if the body says so.
locate_in_cells is called before the first verdict (the rank's own nodes) and again in the answer stage, both outside the try. It solves the same per-cell system as the guarded _barycentric / _node_weights calls, and it runs first. Forced on one rank, in memory, on the fixture of the PR's test (968 coarse cells, 1268 fine cells, degree 2):

forced failure PR head development
_node_weights raises LinAlgError (local hits) RuntimeError through _collective_raise raw LinAlgError
_node_weights raises its RuntimeError (node count) collective raw
a fine node belongs to no cell collective raw
_node_weights fails in the answer stage (253 misses forced) collective raw
_node_weights fails in the clamped rest collective raw
a coarse cell collapsed to a point raw LinAlgError from locate_in_cells, before the first verdict raw
_node_weights raises IndexError raw (except names only LinAlgError, RuntimeError) raw

A coarse cell with one repeated vertex does not raise (rounding leaves a non-zero pivot; the node becomes a miss), so the exactly singular case is hard to reach. The fix is small: move both locations inside the guarded blocks and catch Exception, as split_tail_levels already does (#886).

B. In pull_vertex_onto the vote decides nothing. Does not block.
before and after are quality * wound, and wound is read under the same convention, so the convention cancels. Three mutants of the vote in pull_vertex_onto (inverted; fixed to no flip; each reading voting for itself) on 1224 calls on surface meshes in three dimensions: 0 calls differ from the head. What the allreduce buys there is that the three readings share one convention; a fixed convention gives the same without a collective. The body's "read under that single convention" is right; that it changes an outcome is not shown, and on one rank it does not.

C. The count's test checks the helper, not the library path, and passes with no vote at all. Does not block; we ask for the first item in this branch.

  • Test (b) calls _signed_twice_areas(P, _global_flip(P)) on synthetic triangles. With the ranks' contributions summed by hand for 2, 3 and 4 ranks, (counted, truth): head (2,2), (4,4), (6,6); development (1,2), (2,4), (3,6), so it fails on development as claimed. With _global_flip replaced by return False it still passes. The same fixture with the majority wound inward fails that mutant: (7,2), (11,4), (15,6).
  • No test fails if cut_along_lines goes back to the rank's own vote (cell_areas(cut) without global_vote=True) or the snapping loop drops flip: on one rank the two votes are the same (0 of 1224 calls differ), and no parallel test routes a surface mesh through either.
  • Test (b) does not assert its premise (that some rank holds a local majority of inverted triangles), and getattr(line_cut, "_global_flip", None) is scaffolding from before the fix.
  • Test (a) forces the first of the three guarded sites only. The answer stage and the clamped rest work on one rank in our probe and are untested in the suite.

D. In two dimensions nothing changes. Not a defect.
_global_flip returns None without a collective, so there is no vote and no new collective on any planar path. The diff of pull_vertex_onto is the vote line, the flip argument in three readings, and a comment.

E. split_tail_levels still cites #874 for a live hang. Blocks marking #874 fixed.
Its comment, untouched by the branch: "A rank-local raise inside the split, before its own collectives, still hangs ... (issue #874)". Either that pattern is closed, or the comment is pointed at whatever tracks it and #874's verdict says which part remains. Also: the body says place_surface's surgery "runs on one rank". Its callers of cell_areas run on every rank and reduce the result afterwards; they keep the rank's own vote because they are planar (no vote exists) and several sit under a rank-local if len(cells), where a collective would hang. The reason is right, the wording is not.

F. Markers and CI reach. Does not block.
level_2, tier_b and the MPI marker sit on the module, as in the sibling parallel files; the Charter puts the tier on the test. scripts/check_test_coverage.py: all 446 test files reachable; the new file is picked up by the tests/parallel/test_*.py enumeration and CI ran it at np 2 (green). np 3 and 4 run only under --full-parallel. A regression of (a) is a hang ended by the supervisor's 300 s silence window, not an assertion.

What holds

  • _global_flip: one allreduce of two integers (cells wound inward, cells), reached by every rank at all three sites (before the snapping loop; in cut_along_lines before the inversion count; in pull_vertex_onto after the collective overlap refusal and before the target loop). A rank with no cells adds (0, 0). A tie or an empty vote gives no flip. Every rank receives the same sum, so ranks cannot disagree.
  • Head against development, one rank, development's module executed in memory. Every call bit-identical (coordinates, info record, or refusal text):
fixture calls done / refused equal
boxes 1/12, regular and irregular: cuts straight, kinked, each reversed, snap 0, 0.1, 0.3, 0.49 32 32 / 0 32
boxes: pull beside a wall (the #1128 cases) 600 564 / 36 600
boxes: pull anywhere; four targets in one call 750 705 / 45 750
boxes mirrored (clockwise): pull beside a wall; one cut 602 564 / 38 602
annulus 0.1: pull beside a curved wall; arc pulls and cuts; wall to wall 307 297 / 10 307
sphere surface (804 cells), outward and inside out: pulls and cuts along arcs 660 660 / 0 660
sphere surface with a fault cut in, both windings: pull beside the fault 600 516 / 84 600
18-triangle grid, flat and on the sphere, both windings: one target, two targets, floor off 7200 5764 / 1436 7200
all, with the two-tip pulls and cuts 10 759 10 759
  • A surface wound inward gives the same answers as development and as the outward surface (same refusal counts: 42 and 42; 212 and 212).
  • The vote does decide the cut: with the vote inverted in the inversion count, 24 of 24 sphere cuts refuse; inverted in the snapping loop, 2 of 24 differ.
  • tests/test_0052_collective_guard_scan.py (tier A): 5 passed.
  • Serial tests of the territory at this head, 42 files (line cut, reconnect, split, contact, fault API, placement, thin sheet on the sphere, add-on tail; none launches MPI): 412 passed, 1 skipped (the repair case of test_0853, which skips when the fill leaves nothing to repair), 34 min. We could not identify the author's 393-test set; ours is a superset by 19 tests at least.
  • CI green at 9314d6a on all six shards; merges cleanly with development d66c7da.

Tolerances and coordinate matches

The branch adds none of distance type. It adds one count threshold and moves one guard:

where value what it decides
_global_flip (new) inward cells > 0.5 × all cells whether the surface convention is flipped; a count, not a distance
_outward_signed (moved) 1e-300 guard on the normalisation of the outward direction

It relies on these, all there before:

where value what it decides
snapping loop distance to the line < 1e-12 × extent a vertex already on the line is never vetoed
snapping loop distance to a corner ≥ 1e-12 × extent a refused corner is dropped from the candidates, by position
pull_vertex_onto distance ≤ nearest + 1e-12 × extent which vertices tie as nearest
pull_vertex_onto distance to the target < 1e-12 × extent which vertex was moved: a coordinate match, not a vertex number
_minimal_face_vertices barycentric 1e-9 a point on a face
_label_cut_edges 1e-9 × extent an edge on the line
defaults min_quality 0.1, snap_quality 0.5, snap_frac 0.10 the quality floors and the snap reach
fault_mg _INSIDE_TOL 1e-8 a node is inside a coarse cell (barycentric slack)
fault_mg.locate_in_cells 16 nearest centroids the candidate coarse cells of a node
fault_mg serial transfer abs(weight) > 1e-13 a weight is kept

The transfer locates a fine node by the centroid of its fine cell, which is a coordinate match by design and the cause recorded in #1120.

Not checked

Issue verdicts

issue verdict
#874 Still live, in part. Fixed by this branch: the three listed failures (one-rank probe above, collective at the head, raw on development) and the count ((2,2), (4,4), (6,6) against (1,2), (2,4), (3,6); np 2 in CI). Live: the two unguarded locations (A) and the pattern the split_tail_levels comment cites (E). With A fixed and the comment re-pointed, fixed-in-PR is right.
#559 Still live. Five targets in a row in one call, 150 calls on an irregular 1/12 box: calls leaving a target without a vertex, at spacing 1, 0.5, 0.25 cells: 17, 145, 150; identical at the head and on development.
#494 Still live. Its reproducer at the head: several lines in one call leave 11 and 14 gaps in the two chains; one line at a time leaves none.
#595 Still live. Every planar cut is bit-identical to development; a wall-to-wall cut at the default snap leaves the unit box with area 1.000050 on both.
#1120 Still live. Both split-level transfers of the fixture (nnz 9724 and 9628) are bit-identical to development, in the parallel function on one rank and in the serial one. The branch changes when a failure is raised, not a weight.
#1091 (fixed-in-development) Not touched by this branch; label stays. Its serial file passes (5). The moved periodic base stays live there, as its last comment says.
#1089 (fixed-in-development) Not touched; label stays. The wall-rule pulls are bit-identical and their tests pass; the snap part is the area above.
#873, #886 (fixed-in-development) Not touched by this diff.

Underworld development team with AI support from Claude Code

… winding vote in the plane too

A. The two locate_in_cells calls of cell_located_transfer_parallel are
inside the guarded blocks, and the handlers catch Exception, so a collapsed
coarse cell or an IndexError on one rank also reaches _collective_raise.

C. The winding convention is voted on the mesh's own communicator, a count
of each cell's sign, in the plane as on a surface mesh; a tie or no cells
gives no flip. Only the collective paths use it (the snapping loop, the
inversion count after a cut, pull_vertex_onto); rank-local callers keep
their own reading, the planar sign in 2-D. An anticlockwise mesh is
unchanged; a mesh wound clockwise throughout, which cut_along_lines refused
at any snap_frac (every cell read as inverted), is now cut like its mirror.
Tests: a mirrored box cut at snap_frac 0 and 0.3 (fails on development),
and an inward-majority case for the count; both fail with the vote replaced
by False.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026 •

Copy link
Copy Markdown
Member Author

Adversarial review, re-check of round 2, at 4af162d

Re-check by W1 (the integration session, which owns the fault placement and fault multigrid code) of findings A, C and E of our first record, with the comparison against development rerun. Run on macOS (12-core Apple M4), serial only: nothing here was run on more than one rank. The library is a build of 4af162d. development's line_cut.py and fault_mg.py (at d66c7da) were executed in memory for the comparisons, and the mutants were made the same way.

Result. A, C and E are closed. Nothing here blocks the merge. Four small items remain for the tests and the body (1 to 4 below).

Round 1's findings

A. A failure of the location itself was raised on one rank: closed. Forced on one rank, each failure now leaves cell_located_transfer_parallel through _collective_raise, after the reduction, where development raises at the point of failure:

Forced failure This head development
locate_in_cells raises IndexError on the rank's own nodes RuntimeError from _collective_raise raw IndexError
locate_in_cells raises LinAlgError in the answer stage the same raw LinAlgError
a coarse cell collapsed to a point (raw at 9314d6a) the same raw LinAlgError from _barycentric
_node_weights raises IndexError (raw at 9314d6a) the same raw IndexError
_node_weights raises LinAlgError: own nodes, answer stage, clamped rest the same raw LinAlgError
_node_weights raises its own RuntimeError the same raw RuntimeError
a fine node belongs to no cell the same raw RuntimeError

By reading, no statement between either guarded location and the collective verdict that follows it can raise on one rank alone. The message carries the exception's type and text; the traceback of the failing rank is not kept. The transfer built without a forced failure reports what development reports: a (5056, 3714) matrix with no misses, 1 miss with a coarse cell of zero area, and 253 with a tenth of the nodes reported outside.

C. The convention was the rank's own on a surface mesh and absent in the plane: closed. Every path to the vote is unconditional and on the mesh's communicator: the snapping loop, the count after the cut, and pull_vertex_onto after its overlap refusal. The only library caller is add_fault, on every rank. place_surface's eight calls of cell_areas do not ask for the vote.

  • Against development. Of 10 759 cut and pull calls (the fixtures of round 1), 10 757 are bit-identical. The two that differ are the cuts of the two boxes with x mirrored, which development refuses and this head cuts. The 600 pulls on the mirrored boxes are bit-identical.
  • A mirrored mesh gives the mirror image. 80 cuts: three boxes (1/12 regular, 1/12 irregular, the test's 0.08) and an annulus, straight and kinked lines in both orders, snap_frac 0, 0.1, 0.3 and 0.49. In all 80 the mirrored mesh gives the same information record as the plain mesh and coordinates that are its mirror image bit for bit. development refuses all 80 ("snapping inverted 348 cell(s); snap_frac=0.0 is too large for this mesh", with the mesh's own count).
  • A mesh that is not wound one way throughout (the test's box rebuilt with a fraction of its cells listed in the opposite order; not a mesh the library builds): with 0 or all of the cells reversed it is cut, as above. With 2 %, 40 %, 50 % and 60 % reversed both heads refuse it. At 60 % this head reports 193 inverted cells, the minority, where development reports 281.
  • No cells, and a tie. No cells give no flip, in the plane and on a surface. One cell each way gives no flip.

E. The body claimed #874 fixed: closed. The first line now says "Addresses #874 in part" and names what is left, and the comment in split_tail_levels that cites #874 for the live hang agrees with it.

Mutants

Against tests/test_0874_mirrored_mesh_cut.py and tests/test_0844_line_cut.py (64 tests, all passing at this head):

Mutant of line_cut Result
development's whole module killed (2 tests, the two mirrored cuts)
the vote returns False killed (2)
the vote returns True killed (38)
the vote inverted killed (38)
no flip applied in the plane killed (2)
the snapping loop reads without the vote killed (1)
the count after the cut reads without the vote killed (2)
the pull reads without the vote survives
a tie flips survives

The two survivors are lines no test on one rank can tell apart. In the pull each reading is multiplied by the sign read at the start under the same value, so the value cancels (the body's B says the same). A tie gives the same count either way.

The arithmetic of test_the_inversion_count_uses_a_global_winding_vote, with the reduction replaced by a sum over 2, 3 and 4 emulated ranks:

_global_flip majority outward majority inward
this head passes passes
returns False passes fails (7 against 2 at two ranks)
returns True fails passes
the rank's own vote fails (1 against 2) fails
inverted fails fails
a tie flips passes passes

The inward case is what kills "returns False"; the two cases together kill everything but the tie.

Remaining, none blocks

1. The mirrored-box test runs on one rank in CI and asserts one count. Its docstring says "Runs serially and in parallel", and the body reports it at np 2 to 4, but the file is in tests/ and scripts/test.sh reaches it only in a serial batch. It asserts that the number of cut edges is equal; the cut coordinates are the exact mirror image (above), which would be the harder baseline.

2. The parallel count test covers the surface vote only. The same arrangement with triangles in the plane gives the table above row for row, so one more parameter would pin _planar_signed in the vote across ranks. The test also keeps its getattr(line_cut, "_global_flip", None) branch for a module without the vote, which cannot be taken at this head.

3. Source text. The new test's docstring says "(W1)" and the parallel test's says "W1's fixture": a session code with no meaning to a reader of the source. The docstring of _global_flip tells what the code used to do ("A rank-local vote let a rank ...", "in the plane there was no vote"); the Charter asks a comment to state intent.

4. The body. "What and why" still begins "On a surface mesh", which the round-2 section corrects further down. There is no line on tolerances and coordinate matches; for this round the answer is short: the vote is a count with a strict majority, with no tolerance, and it matches nothing by coordinate.

An observation, not a finding: the vote is taken on the DM's communicator and the other collectives in the same three functions on the world communicator. They are the same communicator for every mesh the library builds.

What holds

  • tests/test_0052_collective_guard_scan.py, tests/test_0874_mirrored_mesh_cut.py and tests/test_0874_repair_drops_parent_maps.py: 9 passed.
  • The serial files of this territory (cut, placement, split, fault multigrid; 43 files, those that launch a process left out): 414 passed, 1 skipped (a placement case with nothing for the repair to act on). Round 1 had 412 passed and the same skip; the two more are this round's mirrored cuts.
  • scripts/check_test_coverage.py: all 447 test files reachable.
  • CI at 4af162d: the six shards pass.

Not checked

Anything on more than one rank; the author's np 2 to 4 and np 2 to 5 runs are in the body. pixi run docs-build.

Issue verdicts

Unchanged from round 1.

Underworld development team with AI support from Claude Code

…allel too; the planar vote in the count test

The mirrored-box test moves to tests/parallel (no min_size: serially and in
the parallel batches) and asserts that the mirrored box's cut is the exact
mirror image of the box's (every vertex, x negated, bit for bit), not a
count. The count test gains a planar case beside the surface one. The
docstrings state what the code does, without history or session codes.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

READY with conditions at 4af162d, parallel half. Everything the PR changes holds at np 2 to 5. One condition, which needs words, not code: the body's "Still open under #874" should also name the sibling transfer provenance_transfer_parallel. A forced singular nodal matrix on one rank still hangs the library's own solve path there, before the guarded transfer is reached.

Adversarial review, parallel half, at 4af162d

This is the parallel half of the review, run by H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)). It complements W1's serial re-check (W1 is the integration session that owns the fault placement and fault multigrid code). The library is a build at development, with no compiled file different up to the base 70b240c. The base arm is development's Python at 70b240c. The head arm is the same with 4af162d's fault_mg.py and line_cut.py. Every MPI job ran under scripts/mpi_supervisor.py --silence 300 on four logical CPUs, so np 5 is oversubscribed. Mutants, forced failures and shell partitions were installed from outside the source tree, in the MPI ranks only. Logs are kept by the reviewer.

1. The test files

File np Head Base
tests/parallel/ptest_0844_line_cut_parallel.py 2, 3, 4, 5 21 passed on every rank, at each np 21 passed on every rank, at each np
tests/parallel/test_0874_fault_mg_collective_failures_parallel.py 2, 3, 4 3 passed on every rank, at each np (8 to 10 s) the transfer test hangs; stopped by the supervisor after 300 s of silence (exit 124) at each np
the same file, count test only (-k inversion_count) 2, 3, 4 passed, both cases failed, both cases: counted 1, 2, 3 against true 2, 4, 6
tests/test_0874_mirrored_mesh_cut.py under --with-mpi 2, 3, 4 2 passed on every rank 2 failed on every rank

In the base hang, the supervisor finds rank 0 in cell_located_transfer_parallel (an allreduce) and the other rank already in the next test.

2. The mirrored box in parallel

The probe builds the box exactly as tests/test_0874_mirrored_mesh_cut.py does (cellSize 0.08, x negated on a clone of the distributed DM). It makes eight cuts: the test's straight line and a kinked line, each at snap_frac 0, 0.1, 0.3 and 0.49. Every owned cell of each cut is gathered as its three vertex coordinates. The cells are compared by position: as a set, bit for bit, against the serial run, and the mirrored set (x negated back) against the plain set. Every _global_flip result on every rank is recorded.

Layout np Plain cut = serial Mirrored cut = serial Mirrored = mirror image of plain, bitwise Info record = serial Vote
serial 1 (reference) (reference) 8 of 8 (reference) plain False, mirrored True
natural 2, 3, 4 8 of 8 each 8 of 8 each 8 of 8 each 8 of 8 each the same on every rank, every call
shell, bands in x 2, 3, 4 8 of 8 each 8 of 8 each 8 of 8 each 8 of 8 each the same
shell, bands in y 3 8 of 8 8 of 8 8 of 8 8 of 8 the same
shell, random 2, 3, 4 8 of 8 each 8 of 8 each 8 of 8 each 8 of 8 each the same

Each cut takes two votes, the snapping loop and the count after the cut. Each rank's own cells are all clockwise on the mirrored box, so there the global vote and every local reading agree. The base arm cuts the plain box identically (8 of 8 against the head's serial set). It refuses every mirrored cut, at np 1, 2 and 3 (x bands), with the same message on every rank: "snapping inverted 466 cell(s)" on the straight line and 468 on the kinked line.

3. A location failure on one rank

The failures were forced on one rank only, in the test's own fixture: a fault cut into an adapt child, solved with split-level multigrid. "Direct" repeats the first recorded call of cell_located_transfer_parallel. "Solve" is the library path (add_fault, then Stokes.solve), with the failure confined to cell_located_transfer_parallel. To reach the answer stage and the clamped rest, the probe also made one rank's own location, or every location, read each node as outside. That gave 1724 misses at np 2 and 785 at np 3, or all 2992.

Forced failure Stage Path np 2, head np 3, head np 2, base
_node_weights raises LinAlgError, rank 1 own hits direct same RuntimeError on every rank the same (the test: hang, 124)
locate_in_cells raises IndexError, rank 1 own nodes direct the same the same hang, 124
locate_in_cells raises, rank 1, second call answer stage direct the same the same hang, 124
_node_weights raises, rank 0, in its answers answer stage direct the same the same not run
_node_weights raises, rank 1, nothing found anywhere clamped rest direct the same the same not run
_node_weights raises, rank 1 own hits solve the same; the solve fails on every rank, 5 s the same hang, 124
locate_in_cells raises, rank 1 own nodes solve the same the same not run

Every message carries the forced exception's type and text, for example "fault_mg: the cell-located transfer failed: LinAlgError: Singular matrix (forced on one rank)". In every base hang, rank 0 waits in cell_located_transfer_parallel and rank 1 has left it.

The condition. When the same failures are not confined to cell_located_transfer_parallel, the solve path at this head hangs at np 2 and 3 (exit 124 each), before the guarded transfer is reached:

  • _node_weights raising on rank 1 raises first inside fault_mg.provenance_transfer_parallel, the transfer the hierarchy takes for a pair the add-on partition moved apart. The other ranks wait in its stats allreduce. That function has the same unguarded _barycentric, _node_weights and locate_in_cells_exhaustive calls that this PR guards in its sibling. This is the rank-local raise of a singular nodal matrix that Fault-split multigrid: rank-local raises before collectives in the cell-located transfer and the line cut's orientation vote #874 describes.
  • locate_in_cells raising on rank 1 raises first inside addon_partition._parent_cells_local (the add-on build). The others wait in its allreduce.

[read] Neither function is touched by this PR, and #874's text names only cell_located_transfer_parallel. provenance_transfer_parallel predates the issue (2026-10-17 against 2026-10-28) but is not named in it. So this is not a defect of the change. It is a gap in what the body says is left: the body should name provenance_transfer_parallel (and _parent_cells_local, if a location failure there is thought possible) under "Still open under #874", or point to a new issue.

4. The parallel count test

test_the_inversion_count_uses_a_global_winding_vote passes at np 2, 3 and 4, in both cases, at the head. At the base it fails in both cases, as in table 1.

5. The two mutants W1 could not separate on one rank

A mesh whose ranks disagree. On rank 0, the probe rebuilds the test's box from its cell list, with the cells whose centroid has x < 0.3 listed clockwise (121 of 406 cells). It distributes the mesh naturally or with a shell partition into equal bands of centroid x, then cuts along the test's line at snap_frac 0.1. Every arm refuses this mesh (it is not wound one way). What differs is the count in the refusal. With x bands, rank 0's own majority is clockwise at np 2, 3 and 4. With the natural layout, some rank's own majority is clockwise at np 3 and 4.

Arm np 1 np 2, natural np 2, x bands np 3, natural np 3, x bands np 4, natural np 4, x bands
head 139 139 139 139 139 139 139
(a) the vote is the rank's own reading 139 139 95 97 17 104 16
(b) a tie flips 139 139 139 139 139 139 139

The table gives the inverted cells in each refusal. Under (a), every rank whose own majority is clockwise flipped its own convention, and the count depends on the partition. The head's count is the serial one at every np and layout, and its vote was False on every rank.

A global tie. The probe reverses exactly half the cells (203 of 406, by centroid x). The head reads the tie as no flip in the snapping loop. The cut mesh is no longer tied, and the head flips there. It reports 222 at np 1 to 4, in both layouts. Mutant (b) flips in the snapping loop, vetoes a different set of moves, and reports 223 at np 1 to 4. Mutant (a) gives 1 to 206, depending on the partition.

What the head's tests catch. Each mutant ran against the three files together: the 0844 parallel file, the #874 parallel file and the mirrored-box file, 26 tests per rank.

Mutant np 2 np 3 np 4
(a) the rank's own reading killed: the count test, both cases (1 against 2) killed (2 against 4) killed (3 against 6)
(b) a tie flips survives: 26 of 26 pass survives survives
_global_flip returns False (count test only) killed: inward case (7 against 2) killed (11 against 4) killed (15 against 6)

Mutant (a) is caught by the count test alone. The 0844 file and the mirrored box cannot catch it, because every mesh the library builds is wound one way on every rank. Mutant (b) shows only on a mesh tied exactly, which no library mesh is, and it shows the same way on one rank as on four. It is a choice of convention, not a parallel defect: under either choice every rank takes the same value. If the docstring's "a tie gives no flip" is meant as a contract, a one-line serial assertion (one cell each way, no flip) would pin it. Not a condition.

6. Attribution

[read] The three commits (b40777c, 9314d6a, 4af162d) are authored and committed as "Claude noreply@anthropic.com" (GitHub user claude), unsigned. b40777c ends with a Co-Authored-By: Claude Opus 5.5 trailer, which names a model; the squash covers it. 9314d6a and 4af162d, and the body, end with "Underworld development team with AI support from Claude Code". The body introduces W1 at first use. The test docstrings' bare "(W1)" and "W1's fixture" are W1's item 3.

Not checked

  • Mutants inside pull_vertex_onto: no cut here placed a tip, so the pull's vote was not exercised in parallel. W1's serial argument that its value cancels is [read].
  • The surface-mesh vote on a real distributed surface mesh. The count test's synthetic cells are the only 3-D case run.
  • Anything above np 5; Open MPI.

Underworld development team with AI support from Claude Code

Underworld development team with AI support from Claude Code
…g-collective-raises-874

# Conflicts:
#	scripts/test.sh
@lmoresi
lmoresi merged commit 2559337 into development Nov 13, 2026
10 checks passed
jcgraciosa pushed a commit to jcgraciosa/underworld3 that referenced this pull request Nov 17, 2026
…failures on every rank (underworldcode#874)

The rest of underworldcode#874 after underworldcode#1130. provenance_transfer_parallel locates the fine
cells in the recorded mesh and weights each owned node in its parent;
addon_partition._parent_cells_local locates each fine centroid in the level
below. A failure in either on one rank raised there alone, and the other
ranks waited in the next allreduce. Both now go through
fault_contact._collective_raise, so every rank raises the same error.

Test: tests/parallel/test_0874_provenance_and_parent_collective_parallel.py
forces the failure on the last rank. Development hangs (exit 124 at np 2);
with the guard, it passes at np 2 to 5.

Underworld development team with AI support from Claude Code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants