Skip to content

Facet-surface slip restores onto the label's facets over all ranks (#1103) - #1109

Merged
lmoresi merged 6 commits into
developmentfrom
bugfix/facet-slip-shared-facets-1103
Nov 13, 2026
Merged

lmoresi merged 6 commits into
developmentfrom
bugfix/facet-slip-shared-facets-1103

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #1103. #1106, which this built on, is merged, and development is merged in. Round 1 of the review by H1 (review and parallel test runs on a 96-thread Linux workstation) is answered below (F1); the re-check is in progress.

What and why

A slip boundary with no registered analytic surface restores its vertices onto a facet BoundingSurface: the nearest point on the label's boundary facets. Each rank built that surface from its own facets of the label only. This had two effects:

  • A seam error: a vertex that slid past the end of its rank's facets was clamped there, so the moved mesh was 3e-2 to 5e-2 off serial at np 2 to 4.
  • A hang: a rank owning slip vertices of a label without any of its facets raised argmin of an empty sequence alone, while the others waited. The natural np 5 partition of a 42-cell box hung.

The facets of each label are now gathered over the ranks (one allgather per label per boundary_slip call), so every rank restores onto the serial set. The usable labels are then the same on every rank too, as the collective normal projection needs.

Cost: the gathered facets are the label's boundary facets, a surface-sized array, sent once per mover outer iteration.

Partition-seam facets (review F1). A rank finds its boundary facets as those in one local cell, so a facet between two ranks' cells counted as a boundary facet on both. On BoxInternalBoundary a seam along Internal gave that internal surface facets serial lacks, and its vertices slid where serial pins them: 2.0e-2 off serial at np 2 and 4.

A true boundary facet is held by one rank only, and a seam facet by the two beside it. So the gathered facets keep only those whose vertex coordinates occur on one rank. This runs on every rank, a rank with no cells included. Every rank then restores onto the serial set.

Which facets are seam facets (review N1). A seam facet is one shared through the point star forest: a leaf on this rank, or a root with leaves on another. It is found from the facet's mesh point.

An earlier commit keyed facets by their vertices' coordinates. A split fault's Plus and Minus replicas coincide by design, so their keys were equal and both were dropped, even on one rank. With FltPlus and FltMinus as explicit slip surfaces, 26 vertices slip in serial and none did in parallel.

Of the two fixes measured in review, I took the point-SF test over de-duplicating the coordinate keys per rank. Coordinates are the wrong identity on a mesh with coincident replicas by design, and the SF test is about as short.

Tests

tests/test_1103_facet_slip_matches_serial.py uses unit boxes with the registered plane surfaces removed, run serially and in parallel through the MPI supervisor and compared vertex by vertex to 1e-10:

  • 2D at np 2, 3, 4 and 5;
  • a random scatter of the cells at np 3 and 4;
  • 3D at np 2 and 3;
  • BoxInternalBoundary at np 2 and 4, and a random scatter at np 4: all three fail without F1 (0.0204).

tests/parallel/test_1103_split_fault_slip_parallel.py (serial and the parallel batches): a box with a split fault, FltPlus and FltMinus as slip surfaces. The number of vertices that slip must equal serial's 26. With coordinate keys it is 0 at np 2 and 3; with the SF test it is 26 at np 1 to 5.

The original 8 fail without the fix (np 5 by the hang); all 11 pass with it.

Regressions: the 16 serial test files that touch slip or bounding surfaces (including test_1082, test_1086 and test_1103) gave 179 passed. The parallel ones, with test_1082's parallel file, pass at np 2 and 4. test_0052 (the collective-guard scan) passes. check_test_coverage: OK.

Checklist

  • Style Charter followed (S2)
  • No drive-by changes (S9)
  • Regression test written first, with level_2 / tier_b markers (S8)
  • No hedging names or commented-out code (S3, S4)
  • No exception swallows
  • Data access through mesh.X.coords (S7)
  • Parallel: np 2–5 and a scattered partition (S11)
  • No dependency changes
  • AI attribution below

Underworld development team with AI support from Claude Code

…1103)

A slip boundary with no registered analytic surface restores its vertices
onto a facet surface built from the rank's own facets of the label. A
vertex that slid past the end of its rank's facets was clamped there, so
the moved mesh was 3e-2 to 5e-2 off serial at np 2 to 4, and a rank owning
slip vertices of a label without any of its facets raised alone while the
others waited (the natural np 5 partition of a 42-cell box hung). Each
label's facets are now gathered over the ranks, so every rank restores
onto the serial set; the usable labels are then the same everywhere too.

Test: unit boxes with the plane surfaces removed, against serial to 1e-10:
2D at np 2-5, a random scatter at np 3 and 4, 3D at np 2 and 3. All 8
fail before the fix.

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

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.

@lmoresi

lmoresi commented Nov 12, 2026

Copy link
Copy Markdown
Member Author

#1109 review (fix for #1103): facet-surface slip restores onto the label's facets over all ranks

Verdict: NOT READY at a62c720. The fix does what #1103 asked: the crash and hang are gone, and box facet slip now matches serial to rounding. But the PR and the test docstring claim the gathered set is "the serial set" on "any partition", and that is measured false on a stock mesh, BoxInternalBoundary(simplex=True). A partition seam lying on an internal label becomes a "boundary facet", so parallel slips vertices that serial pins (2.3e-2 off serial). This is pre-existing (#1106 gives the same 2.3e-2), but it sits in the lines this PR changes, and a small change fixes it (F1).

Scope: a62c720 against bc9d67c only. git diff bc9d67c3 a560311f -- src is empty, so wt-1106 at a560311 is the base. The installed site-packages of wt-1109, wt-1106 and wt-dev01b match their src (cmp). Everything below was measured unless marked [read]. Probes, mutants and logs are in runs/2026-11-13-1109/: p86.py and cmp86.py are copied from the #1086 review; p9.py is new, as is mut/sitecustomize.py, which provides the mutants local, drop1, skip1, noise, and once. once is a check of the fix direction, not a mutant.

Check 1: crash and hang (box2d cs 0.25, 42 cells, plane surfaces deleted)

Layout branch a62c720 #1106 a560311 dev 01b06c9
natural np 5 [9,8,8,9,8] exit 0, 2.4e-12 ValueError argmin-empty on 2 ranks, hang, exit 124 hang, exit 124
scattered np 4 (rand3) exit 0, 1.9e-12 same ValueError, exit 124 hang, exit 124
every cell on rank 0, np 3 0 0 exit 63 (pre-#1082)
empty rank, [22,0,20,0] np 4 2.7e-12 4.9e-2 exit 142 (pre-#1082)
other scatters: rand1 np 3/4, rand5 np 2, rand7 np 2 1.0–1.5e-12 rand7 np 2: hang, exit 124 –

Check 2: facet slip against serial (max |x_np − x_serial|; serial move 7.2e-2)

Case np 2 np 3 np 4 np 5 scattered
box2d, branch 1.8e-12 1.3e-12 1.0e-12 2.4e-12 1.0–1.9e-12
box2d, #1106 4.9e-2 3.1e-2 (test) 4.9e-2 hang hang
box3d cs 0.35, branch 2.1e-12 2.7e-12 1.9e-12 – rand3 np 3: 5.8e-12
box3d, #1106 1.3e-2 1.7e-2 – – –
QuarterAnnulus cs 0.1 (registers no surfaces, so all facet slip; concave inner arc), branch 1e-16 3e-17 1e-16 – 2e-16 / 6e-14
QuarterAnnulus, #1106 1e-16 – 2.0e-4 – 4.0e-3 (the whole move)
big box2d cs 0.01 (23k cells), branch / #1106 – – 1.6e-14 / 3.3e-5 – –
big box3d cs 0.06 (23k tets), branch / #1106 – – 1.4e-13 / 1.0e-2 – –
  • Rounding? In 2D, yes. The one-ulp sum-noise serial control (noise, seeds 1 and 2) gives 1.0e-12 and 1.7e-12 on box2d, and 3.1e-12 on the Left∪Right case. The parallel values (1.0–2.4e-12) are on that scale.
  • In 3D the noise control gives exactly 0 (seeds 1, 2 and 3), so it does not perturb this case and gives no scale. The 3D parallel values (1.9–5.8e-12) are rounding-sized, but that is inference. The test's 1e-10 bar leaves a margin of about 20×.

Check 3: collectives and cost

  • [read] Every rank reaches the new collective.
    • The allgather sits in for lab in unreg with no rank-dependent branch, inside if unreg:.
    • unreg comes from slip_spec and bounding_surfaces, which are the same on every rank.
    • A rank with no facets, no slip vertices or no cells sends zeros((0,cdim,cdim)). _boundary_facets returns None there, and the else-branch covers that.
    • It replaces MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106's allreduce(LOR) one for one, so the number of collectives is unchanged.
    • The only callers, mmpde.py:558 and project_to_slip_surface, are collective.
    • Measured: the every-cell-on-rank-0 and empty-rank layouts complete.
  • It is called per boundary_slip call, i.e. once per label per mover outer iteration, and not cached. That matches the PR text.
  • Size. The gathered set equals the serial set exactly on boxes: box2d cs 0.01 has 100 facets per label, 3.2 KB; box3d cs 0.06 has 688–696 per label, about 50 KB. So there are no duplicates or overlap copies.
  • Time at np 4, 3 outer iterations.
  • (F3) Scaling. Restore is O(m_local × N_facets_global): _nearest_on_facets_* loops over points in Python and is vectorised over facets. This does not shrink with np. Serial already pays O(m × N), so no rank is slower than serial. It will matter only for very large facet labels.

Check 4: restore correctness

  • Corners. The box corners are junctions (count 2), so they are pinned. Vertices next to corners match serial in every case above, and no vertex leaves the box in any run.

  • A disjoint label split across ranks. I made the Left DMLabel Left∪Right and slipped on Top, Bottom and Left.

    Run max off serial
    branch, np 2 / 3 / 4 1.5e-12 / 3.9e-12 / 2.4e-12
    branch, rand3 np 4 / rand7 np 2 3.3e-12 / 2.9e-12
    MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106, np 2 / np 4 4.9e-2 / 4.9e-2
    MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106, scattered argmin hang, exit 124

    The gathered Left set is 8 facets on every rank, the same as serial.

  • 3D (the PR claims it): matches at np 2, 3 and 4 and at rand3 np 3 (table above).

  • Curved and concave (QuarterAnnulus): fixed (table above).

  • Internal boundary: NOT serial (F1).

    BoxInternalBoundary(simplex=True), cs 0.2, slip_surfaces=True. It registers no surfaces, so every label is facet slip, including Internal. Serial move 5.0e-2.

    Run max off serial
    branch, np 2 / np 3 3.0e-12 / 2.7e-12
    branch, np 4 (natural, [19]×4) 2.28e-2
    branch, rand3 np 4 / rand7 np 2 2.28e-2 / 2.28e-2
    MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106, np 4 / rand3 / rand7 2.28e-2 / 4.95e-2 / 4.95e-2
    once (keep only facets gathered from one rank), np 2 / np 4 / rand3 / rand7 3.0e-12 / 3.3e-12 / 4.0e-12 / 8.8e-12

Check 5: the new test

Run Result
branch 8 passed (86 s)
#1106 env, branch test 8 failed: np 2/3/4 mismatch 4.9e-2/3.1e-2/4.9e-2; np 5 and scattered 3/4 argmin hang (124); 3D np 2/3 1.3e-2/1.7e-2
dev env, branch test 8 failed: mismatches and hangs (124)
mutant local (own facets only; stricter than #1106, which I ran directly above) 8 failed (mismatch or 124)
mutant drop1 (rank 1's facets left out of the gather) 8 failed (7.2e-2, 1.6e-2, 4.9e-2, 4.6e-2)
mutant skip1 (rank 1 skips the allgather) 8 failed, all hangs (124); the supervisor names rank 1 as the odd one out

The test discriminates well. Its only gap is F1: it has no case with an internal label, so once and the branch both pass it.

Check 6: regressions, branch against #1106 (each from its own git-archive copy)

Set branch #1106
serial movers and slip (0751, 0752, 0764, 0765, 0766, 0845 ×2, 0855 slip, 0773) 43 passed 43 passed
test_1086 + test_1082 (serial drivers with np 2–5 workers) 26 passed 26 passed
parallel 0766, 1152, 0855, 0773, 1086 classification, 1082, np 2 18 passed, 1 skipped 18 passed, 1 skipped
the same at np 4 19 passed 19 passed

There are no regressions. The np 4 branch run has 4 warnings against #1106's 3. All of them are numpy "Mean of empty slice" (discretisation_mesh.py:6655 and numpy internals), outside this diff.

Findings

F1 (medium, blocks the stated claim): the gathered set is not the serial set when a partition seam lies on a label.

  • Cause [read, and confirmed by the facet counts].
    • _boundary_facets finds boundary facets from rank-local topology: a facet in exactly one local cell.
    • A partition-seam facet is in one local cell on each of its two ranks, so it passes.
    • If both of its vertices carry a label, it enters that label's reference facets.
  • Measured on BoxInternalBoundary at np 4.
    • The gathered Internal surface has 10 facets: the 5 internal edges, once from each side of a seam along y = 0.5.
    • Serial has no Internal surface. Internal is not a topological boundary there, so it is unusable and its vertices pin.
    • In parallel, Internal becomes usable on every rank and its vertices slip: 2.28e-2 off serial at the natural np 4 and at both scatters.
  • Pre-existing: MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106 gives the same 2.28e-2. But the gather now spreads the seam facets to every rank, and the PR text and test docstring state "every rank restores onto the serial set" and "the serial mesh on any partition". The MMPDE redistribution depends on the partition: seam vertices see only their own rank's edges (step cap) and facets (slip corners) #1086 review listed internal boundaries among the affected cases.
  • A partial seam is the worse case [inference]. When only a few internal edges are seams, internal vertices are pulled onto those few segments.
  • Fix direction, measured with once:
    • Keep only facets that arrive from one rank. A true boundary facet has one cell, so these meshes have it on one rank only; a seam facet arrives twice.
    • Better still, take seam-ness from the point SF, or use DMPlexMarkBoundaryFaces, so overlap meshes are covered too.
    • once brings BoxInternalBoundary to 3–9e-12 at np 2, np 4, rand3 and rand7, and keeps the box2d, Left∪Right and 3D results at rounding.

F2 (low): the test has no internal-label case. Add BoxInternalBoundary(simplex=True), cs 0.2, at np 4 (natural) and np 4 with a scatter. Both fail at a62c720 with 2.28e-2.

F3 (low, note only): restore cost is O(m_local × N_label_facets). It is negligible at 23k cells (0.26 s of 18.5 s), and no rank is slower than serial. A note in the docstring would do, or a KD-tree on facet centroids later.

F4 (low, text): the commit message and PR body say "every rank restores onto the serial set". Qualify that after F1, or make it true by fixing F1.

Merge conditions

  1. F1: either drop partition-seam facets from the per-label reference set before gathering (a few lines; once shows the gather-and-count variant works), with a BoxInternalBoundary case added to test_1103 (F2); or retract the "serial set / any partition" claims in the PR text, docstring and commit, and file the internal-label seam case as its own issue referenced from Facet-surface slip restores onto the label's facets over all ranks (#1103) #1109. One of the two is required.
  2. Merge after MMPDE node redistribution: empty ranks (#1082) and partition seams (#1086) #1106, as the PR says.

With F1 handled, I would mark this READY. The crash and hang fix, the box, curved, disjoint-label and 3D agreement, the collective structure and the test's sensitivity are all good.

Underworld development team with AI support from Claude Code

…review)

smoothing._boundary_facets finds a rank's boundary facets as those in one
local cell, so a facet between two ranks' cells counted as a boundary facet
on both. On BoxInternalBoundary (2D, simplex) a seam along "Internal" gave
that internal surface facets serial lacks, and its vertices slid where
serial pins them: 2.0e-2 off serial at np 2 and 4, natural and scattered.
A true boundary facet is held by one rank only; a seam facet by the two
beside it. Mesh._drop_seam_facets keeps the facets whose vertex coordinates
(the same bytes on every rank) occur on one rank only; it runs on every
rank, including one with no cells.

test_1103: BoxInternalBoundary at np 2 and 4 and a random scatter at np 4,
against serial to 1e-10; all three fail without this (0.0204).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Verdict: NOT READY at de797ca. F1 is fixed (measured, details below). But the seam test drops true boundary facets on split-node fault meshes, and it does so silently. That is new in de797ca, and a one-line change fixes it (N1).

#1109 re-check at de797ca (fix for #1103): partition-seam facets

Re-check by H1 (review and parallel test runs on a 96-thread Linux workstation, Intel Xeon Gold 6240R, AVX-512; MPICH).

Scope.

Method.

  • Tests ran from git archive copies, with PYTHONDONTWRITEBYTECODE=1, -p no:cacheprovider and --with-mpi.
  • Every MPI run went through scripts/mpi_supervisor.py. Mutants went in through sitecustomize only.
  • Everything below is measured unless marked [read]. Logs, probes and mutants are kept by the reviewer.

Probes.

  • The first review's p9/p86 probes (moved mesh against serial, matched by starting position).
  • p_seam: per layout, it compares the kept set with two independent truths. One is "the facet point is not shared in the point SF"; the other is PETSc's DMPlexMarkBoundaryFaces on the distributed DM.
  • p_fault: boundary_slip on an add_fault split mesh.

1. F1 fixed: BoxInternalBoundary(simplex=True), cs 0.2, facet slip against serial

Serial move is 4.95e-2. Values are max |x_np − x_serial|.

Layout np 2 np 3 np 4 np 5
natural 3.0e-12 2.7e-12 3.3e-12 2.8e-12
rand3 – 5.3e-12 4.0e-12 –
rand7 8.8e-12 – 5.1e-12 –
mutant nof1 (_drop_seam_facets returns its input, i.e. a62c720) – – 2.28e-2 (natural and rand3) –
  • Noise control. The one-ulp sum-noise serial control gives 0 and 8.5e-13 on this case (seeds 1 and 2), and 1.0e-12 and 3.1e-12 on box2d and Left∪Right.
  • The parallel values (2.7–8.8e-12) are on that scale and match the once fix-direction check of the first review (3–9e-12). They are about 4 orders below the F1 error.
  • nof1 in serial gives 0, as expected: the call is guarded by size > 1.

2. Is the seam test right?

What it does [read].

  • Each facet's key is the concatenated tobytes() of its vertices' reference coordinates, sorted. Matching is exact, byte for byte, with no tolerance.
  • A Counter over all ranks' keys keeps the facets whose key occurs once.
  • The key is the whole facet, not single vertices. So a true boundary facet is dropped only if another rank also has it as a facet in exactly one of its own cells.
  • With no overlap (uw3 distributes with overlap 0 [read]) and simplices, a cell that contains all the vertices of a facet contains that facet. So another rank holding the facet means the facet has a cell on each of two ranks, which makes it interior. Vertices of a true boundary facet that are shared with other ranks, as at a three-rank corner, cannot cause a drop.

Measured against two independent truths.

  • Cases: box2d cs 0.25 and 0.05; boxint cs 0.2; box3d cs 0.35 (triangle facets on tets); QuarterAnnulus cs 0.1.
  • Rank counts: np 2, 3 and 4 with natural, rand3, rand7, every cell on rank 0, and empty1 (random with rank 1 empty, np 3 and 4). Also np 5 natural and rand3. That is 81 layouts in all.
Case true boundary facets (global) kept = SF truth = DMPlexMarkBoundaryFaces kept but not true / true but dropped true facets with every vertex shared with another rank, kept
box2d cs 0.25 16 all layouts 0 / 0 up to 14 (rand3 np 4/5)
box2d cs 0.05 80 all layouts 0 / 0 up to 76 (rand7 np 4)
boxint cs 0.2 22 all layouts 0 / 0 up to 20 (rand3 np 5)
box3d cs 0.35 156 all layouts 0 / 0 up to 156, i.e. every one (rand7 np 2/3/4, empty1 np 4)
QuarterAnnulus cs 0.1 29 all layouts 0 / 0 up to 25 (rand3 np 4)
  • The corner case asked about is exercised heavily. Under the scattered layouts, most true boundary facets have all their vertices shared with another rank, and none is dropped.
  • The SF truth and DMPlexMarkBoundaryFaces agree on every layout.

Moved and deformed meshes.

  • Smooth deformation. With the reference replaced by a smooth deformation of the coordinates, computed on each rank, the kept set is identical on every layout.
  • The mover [read]. _mmpde_mover passes its current coordinates as the reference, and _halo_sync makes ghosts exact copies of their owners (localToGlobal with INSERT, then globalToLocal). So the bytes match on every outer iteration. The 10-iteration moves in section 1 confirm this end to end: one missed seam would show as 2e-2.
  • An unsynced reference. If a caller of project_to_slip_surface passed a reference whose ghosts are not exact copies (each ghost nudged by one ulp in the probe), seam facets stop matching and are kept. That is the old F1 behaviour. No true facet is ever dropped this way (0 on every layout), and nothing hangs. The failure mode is benign, but the fix does depend on byte-identical ghosts. This is worth one docstring line.

N1 (new, medium-low; introduced by de797ca): coincident replica facets of split-node faults are dropped.

  • Cause. split_fault / add_fault doubles the fault facets into <name>Plus and <name>Minus, with "replica coordinates bit-identical to their originals" (test_0845). Both copies are true boundary facets, each with one cell.
  • Their keys are equal, so the Counter sees 2 and drops both. This happens even when both copies are on the same rank, because duplicate keys within one rank are counted too.
  • add_fault makes the fault star rank-interior by design, so in practice this is the same-rank case.
Mesh (box cs 1/16, add_fault) true boundary facets kept dropped true facets
interior fault, np 2 / np 4 92 64 28 (every fault facet, both sides)
spanning fault, np 2 / np 3 108 64 44
  • Effect. With slip_spec=["FltPlus", "FltMinus"], boundary_slip behaves as follows:

    Mesh serial de797ca, parallel base, or nof1 (= a62c720), np 2
    interior fault 26 slip vertices 0 (np 2 and np 4); no facet surface is built and the fault vertices pin 26
    spanning fault 42 slip vertices 0 (np 3) –
  • With the default slip_spec=True the classification is unchanged (60 slip vertices in serial and at np 2). Fault vertices sit on both Flt and FltPlus/FltMinus, so they are junctions and pin anyway.

  • So the divergence needs an explicit slip spec on split-fault labels. It is silent, and it contradicts "the serial mesh on any partition".

  • Fix direction, measured with two mutants:

    • perrank counts each key once per rank (allgather(sorted(set(keys)))), a one-line change.
    • sfdrop drops facets whose point is shared in the point SF. It needs no coordinates or tolerance, does not depend on the reference's ghost bytes, and also covers replicas on different ranks (across_seams=True; not constructed here). Note that sf.computeDegree() communicates, so every rank must call it, empty ones included.
    • Both restore the fault cases: 26 at np 4 and 42 at np 3.
    • Both keep boxint natural and rand3 at np 4 (3.3e-12, 4.0e-12), box2d with an empty rank (2.7e-12) and box3d rand3 at np 3 (5.8e-12).
    • sfdrop passes test_1103 11/11.
  • A test case with a split fault and an explicit Plus/Minus slip spec at np 2 would pin this.

3. Collectives

  • [read] _drop_seam_facets runs the allgather unconditionally. A rank with no cells (facets None) sends []. The call is guarded only by uw.mpi.size > 1, which is the same on every rank.
  • test_0052 (the collective-guard scan) passes on the branch.

Measured, no hang:

Layout Result
every cell on rank 0, np 2/3/4 (box2d, boxint, box3d, QuarterAnnulus probes; box2d mover at np 3) completes
empty rank: empty1 np 3/4 (all five cases); box2d [22,0,20,0] mover at np 4 completes
np 5 natural (boxint, box2d mover; probes for all cases) completes
box2d np 5 natural (the first review's crash/hang layout) 2.4e-12
box2d rand3 np 4 1.9e-12
box2d [42,0,0] 0

H5's first version, skipping empty ranks (mutant skipempty):

  • test_1082's facet_slip case catches it: hang, supervisor exit 124 ("no rank moved in 20 s"). The other five test_1082 cases pass.
  • test_1103 does not catch it (11/11): it has no empty-rank layout. test_1082 covers it, so this needs no action.

4. The first review's results still hold (branch at de797ca against serial)

Case np 2 np 3 np 4 np 5 scattered
box2d cs 0.25 1.8e-12 1.3e-12 1.0e-12 2.4e-12 rand5 np 2: 1.3e-12; rand3 np 4: 1.9e-12; [22,0,20,0]: 2.7e-12; [42,0,0]: 0
box3d cs 0.35 (tets, triangle facets) 2.1e-12 2.7e-12 1.9e-12 – rand3 np 3: 5.8e-12
Left∪Right disjoint label (slip Top, Bottom, Left) 1.5e-12 3.9e-12 2.4e-12 – rand7 np 2: 2.9e-12; rand3 np 3/4: 2.6e-12 / 3.3e-12; rand7 np 4: 2.5e-12
QuarterAnnulus cs 0.1 1e-16 3e-17 1e-16 – rand7 np 2: 5.8e-14; rand3 np 3/4: 1e-16 / 2e-16; rand7 np 4: 2e-16
  • Large meshes (23k cells, np 4, 3 outer iterations):

    Mesh branch base (ba68af0)
    box2d cs 0.01 1.6e-14 3.3e-5
    box3d cs 0.06 1.4e-13 1.0e-2
  • No vertex leaves the box in any run.

  • 3D works for triangle facets on tets. The kept set equals both truths on all 16 box3d layouts, and the box3d moves above match serial.

5. The tests

Run test_1103
branch 11 passed (117 s)
base env, branch test 11 failed: mismatches 1.3e-2 to 4.9e-2, internal cases 2.04e-2, and argmin-empty hangs
mutant nof1 (F1 disabled) 3 failed, 8 passed: exactly the three new cases, internal_2d-2, internal_2d-4 and internal_2d_scattered-4, each 2.04e-2
mutant local (own facets only) 11 failed (mismatch or hang)
mutant drop1 (rank 1's facets left out of the gather) 11 failed (1.6e-2 to 7.2e-2)
mutant skip1 (rank 1 skips the gather) 11 failed, all hangs (exit 124)
mutant skipempty 11 passed (test_1082 catches it, see 3)
fix-direction sfdrop 11 passed

The new cases discriminate F1 exactly, and the old mutants are all still caught. The test has no split-fault case (N1).

6. Cost (23k cells, np 4, natural partition)

Mesh local boundary facets (incl. seams) kept _drop_seam_facets per call (max over ranks, mean of 10) boundary_slip mean per call
box2d cs 0.01 884 400 0.54 ms 1.52 s
box3d cs 0.06 6128 4150 4.5 ms 4.0 s
  • That is about 0.04 % and 0.1 % of a boundary_slip call. It runs once per call, i.e. once per mover outer iteration, and is negligible.
  • It is O(local boundary facets) in pickled keys per rank. Scattered partitions have many more seam facets: rand3 at cs 0.05, np 4, holds 2124 local facets against 80 true ones. Still small.
  • An SF-based test (N1) would need no allgather at all.

7. Regressions, branch against base (each from its own git-archive copy)

Set branch base
serial movers and slip (0751, 0752, 0764, 0765, 0766, 0845 ×2, 0855 slip, 0773, 0763 slip correctness, 0052 collective scan) 53 passed 53 passed
test_1086 + test_1082 (serial drivers with np 2–5 workers) 26 passed 26 passed
parallel 0766 ×2 (incl. box internal boundary), 1152, 0855, 0773, 1086 classification, 1082, np 2 19 passed, 1 skipped 19 passed, 1 skipped
the same at np 4 20 passed 20 passed
  • There are no regressions.
  • The warnings are numpy "Mean of empty slice" at discretisation_mesh.py (centroids = P.mean) in the empty-rank test of 0766, on both branch and base. They are outside this diff.
  • I did not reproduce H5's 179-test serial set; the set above is the first review's set plus 0763 and 0052.

Findings

  • F1 (from the first review): fixed. BoxInternalBoundary matches serial to rounding at np 2–5, natural and scattered. The kept set equals the true boundary facets (point SF and DMPlexMarkBoundaryFaces) on 81 layouts in 2D and 3D, including corner facets whose vertices are all shared.
  • F2: fixed. test_1103 has the three internal cases, and they fail exactly when F1 is disabled.
  • N1 (medium-low, new in de797ca): split-node fault replicas are dropped.
    • Coincident Plus/Minus facets have equal coordinate keys, so in parallel both are discarded, even on one rank.
    • An explicit slip on those labels pins in parallel but slips in serial: 0 against 26 and 0 against 42 vertices. Before de797ca the counts were equal.
    • The default slip_spec=True is unaffected.
  • N2 (low, note): the seam match needs ghost reference coordinates that are byte copies of their owners. The movers guarantee this; a direct project_to_slip_surface(reference_coords=...) caller might not. Then seams are kept (the old F1 behaviour). This is benign but silent. One docstring line would cover it, or the SF-based test removes the dependence.

Merge conditions

  1. N1: either count each key once per rank (allgather(sorted(set(keys))); measured to fix both fault cases and keep every other result) or use the point-SF test (measured likewise, with no collective or coordinates). Add a split-fault case with slip_spec=["FltPlus", "FltMinus"] at np 2 to test_1103.

With N1 handled, I would mark this READY. F1, the collective structure, the 3D path, the cost and the regressions are all good.

Underworld development team with AI support from Claude Code

…iew N1)

_drop_seam_facets keyed facets by their vertices' coordinates. A split
fault's Plus and Minus replicas coincide by design, so their keys were
equal and both were dropped, even on one rank: with FltPlus and FltMinus as
explicit slip surfaces, 26 vertices slip in serial and none did in
parallel. A seam facet is now one shared through the point star forest (a
leaf here, or a root with leaves elsewhere), found from the facet's mesh
point; the identity is the point, not its coordinates.

Test: test_1103_split_fault_slip_parallel (serial and the parallel
batches): a box with a split fault, FltPlus/FltMinus as slip surfaces, the
number of vertices that slip equals serial's 26. de797ca gives 0 at np 2
and 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Verdict: NOT READY at 64ca14e. N1 is fixed in 2-D (measured below). In 3-D, though, the new seam test drops nothing at all, because it uses getJoin, and on BoxInternalBoundary in 3-D the original F1 error is back (up to 2.6e-2 off serial). The fix is one word: getFullJoin (measured).

#1109 re-check of N1 at 64ca14e

Re-check by H1 (review and parallel test runs on a 96-thread Linux workstation, Intel Xeon Gold 6240R, AVX-512; MPICH). The scope is N1 and what the new code changes.

Build and method.

  • git diff de797cae 64ca14ef --stat touches three files:
    • discretisation_mesh.py;
    • the new tests/parallel/test_1103_split_fault_slip_parallel.py;
    • scripts/test.sh, which adds the new file to the parallel batches.
  • That is Python only. I ran the de797ca build with 64ca14e's discretisation_mesh.py overlaid. Every .py file of the overlay matches the 64ca14e source (cmp).
  • The base is development ba68af0. Tests ran from git archive copies, with PYTHONDONTWRITEBYTECODE=1, -p no:cacheprovider and --with-mpi. Every MPI run went through the MPI supervisor on four pinned cores. Mutants went in via sitecustomize only.
  • Everything is measured unless marked [read]. Logs, probes and mutants are kept by the reviewer.

The change [read].

  • _drop_seam_facets(facets) no longer takes coordinates.
  • Every rank calls sf.getGraph() and sf.computeDegree() before the early return for empty input.
  • The shared set is the SF leaves plus the roots with degree > 0. A facet is kept if dm.getJoin(<its vertices>) meets no shared point.

1. N1 (split-fault replicas): fixed

boundary_slip with slip_spec=["FltPlus","FltMinus"] on an add_fault mesh (box, cs 1/16). Slipping vertices:

Mesh serial np 2 np 3 np 4 de797ca, parallel
interior fault 26 26 – 26 0
spanning fault 42 42 42 – 0

The new test, test_1103_split_fault_slip_parallel:

Run Result
np 1, 2, 3, 4, 5 1 passed at each
de797ca, np 2 and np 3 fails, assert 0 == 26
64ca14e with the de797ca coordinate-key test as a mutant (coordkey), np 2 fails, assert 0 == 26

The test pins N1.

2. The seam test against the truths: right in 2-D, a no-op in 3-D (new defect, N4)

p_seam compares the kept set with two truths. One is "the facet point is not shared in the point SF", which looks the facet up with getFullJoin. The other is PETSc's DMPlexMarkBoundaryFaces on the distributed DM. Layouts: np 2–4 with natural, rand3, rand7, every cell on rank 0, and an empty rank; plus np 5 natural and rand3.

Case layouts kept = SF truth = DMPlexMarkBoundaryFaces
box2d cs 0.25 and cs 0.05 32 32
BoxInternalBoundary 2-D cs 0.2 16 16
QuarterAnnulus cs 0.1 16 16
split faults (interior np 4, spanning np 3) 2 2 (92 and 108 kept, the replicas included)
box3d cs 0.35 (tets) 16 3: only the every-cell-on-rank-0 layouts, which have no seams. Elsewhere every rank-local boundary facet is kept: 48–438 seam facets too many (e.g. natural np 2 keeps 182 against 156)
BoxInternalBoundary 3-D (simplex, cs 0.25) 16 3, likewise: 60–1266 seam facets kept (rand3 np 4 keeps 1464 against 260)
box3d cs 0.06, 23k tets, np 4 1 kept 6128 against 4150 true

The two truths agree with each other on every layout.

Cause, measured directly. On box3d, dm.getJoin of a boundary triangle's three vertices returns an empty set for all 156 facets, while getFullJoin returns one point for each. getJoin only intersects the vertices' supports, which are edges. In 2-D, the two vertices of an edge do share that edge, so getJoin returns it, which is why 2-D is right.

Effect (N4): F1 is back on 3-D internal boundaries. BoxInternalBoundary 3-D, simplex, cs 0.25, facet slip, 5 outer iterations; serial move 4.1e-2. Values are max |x_np − x_serial|.

Layout 64ca14e de797ca 64ca14e with getFullJoin (mutant fulljoin)
natural np 2 / 3 / 4 7.1e-13 / 1.0e-12 / 9.3e-13 7.1e-13 / – / 9.3e-13 –
rand7 np 2 1.22e-2 1.1e-12 1.1e-12
rand3 np 3 1.37e-2 5.1e-3 5.1e-3
rand3 np 4 2.56e-2 7.0e-3 7.0e-3
  • Which vertices. At 64ca14e, the worst vertices lie inside the Internal plane (z = 0.5). Serial pins them; parallel slides them by up to 2.6e-2.
  • Why. The Internal facet surface gains 66 seam facets, while serial has none. This is exactly F1, and 64ca14e equals the no-drop mutant nof1 (2.56e-2).
  • The fix. getFullJoin restores the exact kept set on every 3-D layout I ran: box3d and BoxInternalBoundary 3-D at rand3 np 4, empty-rank np 4, every-cell-on-rank-0 np 4, natural np 2.

Fix direction, measured with fulljoin (64ca14e's own code with getJoin replaced by getFullJoin):

Check Result
3-D kept set exact on all 8 layouts run
split-fault slip 26 at np 4
test_1103 11/11
test_1103_split_fault_slip_parallel, np 3 passes
BoxInternalBoundary 2-D rand3 np 4 4.0e-12

Test gap. test_1103 has no 3-D internal-boundary case. A BoxInternalBoundary 3-D (simplex) case at np 2 with a scatter (rand7 np 2 gives 1.2e-2 at 64ca14e) would pin N4.

N3 (pre-existing, outside this PR). With a correct seam test (de797ca, or fulljoin), BoxInternalBoundary 3-D at rand3 still differs from serial by 5.1e-3 (np 3) and 7.0e-3 (np 4).

  • The kept facet sets equal serial's there.
  • The worst vertices are on the outer sides at z = 0.5, where Internal meets a side. Serial slides them and parallel pins them.
  • The seam test does not cause it. I have not traced it. It should be its own issue.

3. Collectives

  • [read] computeDegree() and getGraph() run before the early return, so every rank reaches them, including ranks with no cells and ranks with no boundary facets. The call is still guarded only by uw.mpi.size > 1.

Measured, all complete with no hang:

  • p_seam with every cell on rank 0 at np 2/3/4, and with an empty rank at np 3/4, for all six cases.
  • np 5 natural and rand3 for all six cases.

test_1082 facet_slip (every cell on rank 0):

Run Result
shipped case, np 2 (in the test_1082 run below) passes
reviewer's copy, np 4 passes
reviewer's copy, np 3 completes, then fails the test's 1e-12 bar by 2.7e-12 (4 of 60 entries)
  • The np 3 result is rounding: the first review's noise control on this box is 1.0e-12, and the 1e-12 bar was set for np 2. The shipped test runs np 2 only.
  • skipempty (the empty-rank early return) completes at np 3 and np 4. So on these layouts computeDegree does not block a rank with no SF points [inference: the degree exchange only involves SF neighbours]. The code calls it on every rank anyway, which is the safe form.

test_0052 (collective-guard scan) passes.

4. F1 in 2-D: still fixed

BoxInternalBoundary 2-D, cs 0.2; serial move 4.95e-2.

Layout np 2 np 3 np 4 np 5
natural 3.0e-12 2.7e-12 3.3e-12 2.8e-12
rand3 – 5.3e-12 4.0e-12 –
rand7 8.8e-12 – 5.1e-12 –
mutant nof1 – – 2.28e-2 (natural and rand3) –
  • Noise control: 0 and 8.5e-13. These values are identical to de797ca's.
  • box3d (no internal label) still matches serial: rand3 np 3 gives 5.8e-12 and natural np 4 gives 1.9e-12. Box seam facets can never have all their vertices on a side label, so the kept seams there do no harm.

5. N2: moot

  • [read] The test no longer reads coordinates.
  • Measured: with every ghost reference coordinate nudged by one ulp, the kept set is identical to the unperturbed one on every 64ca14e layout (all 101).

6. Tests and regressions (64ca14e against base ba68af0)

Set 64ca14e base
test_1103 11 passed –
test_1103 with nof1 3 failed (exactly the internal cases), 8 passed –
serial movers and slip (0751, 0752, 0764, 0765, 0766, 0845 ×2, 0855, 0773, 0763, 0052) 53 passed 53 passed
test_1086 + test_1082 serial drivers 26 passed –
parallel slip set, np 2 (0766 ×2, 1152, 0855, 0773, 1086, 1082, plus the new split-fault test) 20 passed, 1 skipped 19 passed, 1 skipped (no new test)
the same at np 4 21 passed 20 passed
  • There are no regressions.
  • The extra warnings are Python SyntaxWarnings from compiling the overlay without bytecode, plus the existing numpy "Mean of empty slice". Neither comes from this diff.

Cost (23k cells, np 4): 0.79 ms (2-D) and 5.4 ms (3-D) per call. The 3-D figure is with the defect, i.e. nothing dropped. It is negligible next to boundary_slip's 1.5 s and 4.0 s.

Findings

  • N1: fixed in 2-D. Split-fault replicas are kept, and the slipping counts equal serial (26, 42) at np 2–5. The new test pins it and fails on de797ca.
  • N2: moot.
  • N4 (new in 64ca14e, medium; blocks). dm.getJoin returns nothing for a tet's triangle facet, so in 3-D no seam facet is ever dropped. On BoxInternalBoundary 3-D the Internal surface gains seam facets again, and its vertices slide where serial pins them: 1.2e-2 to 2.6e-2 at rand7 np 2, rand3 np 3 and rand3 np 4. The same layouts gave 1.1e-12 at de797ca for rand7 np 2. The rand3 runs are mixed with N3: 5.1e-3 and 7.0e-3 at de797ca.
  • N3 (pre-existing, not this PR): BoxInternalBoundary 3-D at rand3 differs from serial by 5–7e-3 even with an exact seam set. The worst vertices are where Internal meets the outer sides. File it separately.

Merge conditions

  1. Use dm.getFullJoin in _drop_seam_facets; it is measured to fix N4 with everything else unchanged.

  2. Add a 3-D BoxInternalBoundary (simplex) case to test_1103, e.g. rand7 at np 2. It fails at 64ca14e by 1.2e-2 and passes with getFullJoin at 1.1e-12.

  3. Attribution: the three commits on this branch (a62c720, de797ca, 64ca14e) carry a Co-Authored-By trailer that names a model. The repository rule is that commit messages end with "Underworld development team with AI support from Claude Code", with no such trailer. A squash merge with a clean message covers it.

With those, I would mark this READY. N3 should be filed as its own issue.

Underworld development team with AI support from Claude Code

…iew N4)

getJoin walks one level up the DAG, so the three vertices of a tet facet
have no common edge and joined to nothing: in 3-D no seam facet was
dropped, and on a 3-D BoxInternalBoundary "Internal" gained seam facets and
its vertices slid where serial pins them (1.2e-2 off serial at np 2).
getFullJoin walks up to the facet.

Test: test_1103 gains a 3-D BoxInternalBoundary case on a random scatter
at np 2; 0.0125 off serial before this, matching after.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

Verdict: READY at c3e1cd2. N4 is fixed. The 3-D kept set now matches both truths on all 32 layouts I ran, the N4 part of the 3-D internal-boundary error is gone, and the new test case catches the old behaviour.

#1109 re-check of N4 at c3e1cd2

Re-check by H1 (review and parallel test runs on a 96-thread Linux workstation, Intel Xeon Gold 6240R, AVX-512; MPICH). The scope is N4 and the new test case.

What changed.

  • git diff 64ca14ef c3e1cd2b --stat shows two files:
    • discretisation_mesh.py: getJoin becomes getFullJoin in _drop_seam_facets, with a comment.
    • test_1103_facet_slip_matches_serial.py: adds the case internal_3d_scattered.
  • c3e1cd2's only parent is 64ca14e, so no development merge came in and the base is unchanged (development ba68af0).
  • The change is Python only. I ran the earlier build with c3e1cd2's discretisation_mesh.py overlaid. Every .py file of the overlay matches the c3e1cd2 source.

Method.

  • Tests ran from a git archive copy, with PYTHONDONTWRITEBYTECODE=1, -p no:cacheprovider and --with-mpi. MPI runs went through the MPI supervisor on four pinned cores.
  • Mutants went in via sitecustomize only, and are guarded so that the supervisor's own interpreter never applies them.
  • Everything is measured unless marked [read]. Logs, probes and mutants are kept by the reviewer.

1. 3-D seam test against the truths

The two truths are: the facet point is not shared in the point SF (found with getFullJoin), and PETSc's DMPlexMarkBoundaryFaces on the distributed DM. Layouts: np 2–4 with natural, rand3, rand7, every cell on rank 0, and an empty rank (np 3 and 4); plus np 5 natural and rand3.

Case layouts kept = SF truth = DMPlexMarkBoundaryFaces true facets with every vertex shared with another rank, kept
box3d cs 0.35 (156 true facets) 16 16 (at 64ca14e: 3) up to 156 of 156
BoxInternalBoundary 3-D simplex cs 0.25 (260 true facets) 16 16 (at 64ca14e: 3) up to 260 of 260
  • This includes every-cell-on-rank-0 at np 2, 3 and 4, and the empty-rank layouts at np 3 and 4.
  • Seam facets are now dropped on every partitioned layout. For example, BoxInternalBoundary 3-D rand3 np 4 holds 1464 rank-local boundary facets and keeps 260.
  • All runs completed, including np 5.

2. 3-D BoxInternalBoundary moves against serial

Facet slip, 5 outer iterations; serial move 4.1e-2. Values are max |x_np − x_serial|.

Layout c3e1cd2 64ca14e getJoin mutant on c3e1cd2
rand7 np 2 1.1e-12 1.22e-2 1.22e-2
rand3 np 3 5.1e-3 1.37e-2 –
rand3 np 4 7.0e-3 2.56e-2 –

3. The new case and the test files

Run Result
internal_3d_scattered (np 2), head passes
internal_3d_scattered, getjoin mutant (64ca14e behaviour) fails, 1.25e-2
internal_3d_scattered, nof1 mutant (seam drop disabled) fails, 1.25e-2
test_1103 full file (serial driver; launches its own np 2–5 runs) 12 passed
test_1103 under mpirun -n 2 and -n 4 12 skipped
test_1103_split_fault_slip_parallel, np 2 and np 3 passed at each
  • The skips under mpirun are by design [read]: the file skips when uw.mpi.size != 1 and launches its own parallel runs. So the serial run is the one that exercises np 2–5.
  • The case's 1.25e-2 failure under the mutants matches the 1.2e-2 that H5 reported.

4. 2-D spot checks (getFullJoin on edges)

Layout true facets kept = SF truth = DMPlexMarkBoundaryFaces
BoxInternalBoundary 2-D cs 0.2, rand3 np 4 22 yes (168 rank-local facets)
box2d cs 0.25, empty rank np 4 ([23,0,5,14]) 16 yes

5. Collective scan, coverage, attribution

  • test_0052 (collective-guard scan): 5 passed.
  • scripts/check_test_coverage.py: OK. All 444 test files are reachable from scripts/test.sh, and 18 of 40 ptest files run (22 deferred with a reason).
  • Attribution [read]: c3e1cd2 has no Co-Authored-By trailer. Its message ends with "Underworld development team with AI support from Claude Code". The PR's earlier commits (a62c720, de797ca, 64ca14e) do carry a Co-Authored-By trailer naming a model. Those are outside this check's scope, but squashing or rewording on merge would remove them if that is the policy.

Findings

There are no new findings.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 7ab087b into development Nov 13, 2026
10 checks passed
lmoresi pushed a commit that referenced this pull request Nov 13, 2026
CI runs the parallel shard at np 2 without --full-parallel, so after the
serial driver stopped launching four ranks, the np 4 seam layouts (where
#1109's 3-D defect showed) ran nowhere in CI. This file now runs at np 4
in the parallel shard on every run. np 5 is run locally only.

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