Skip to content

A cell touching both copies of one fault has no side, and is counted - #1267

Merged
lmoresi merged 2 commits into
developmentfrom
bugfix/fault-side-conflicts-counted
Nov 20, 2026
Merged

lmoresi merged 2 commits into
developmentfrom
bugfix/fault-side-conflicts-counted

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member

A cell that touches both copies of one fault now has no side, and the build notes count such cells. This is a defensive guard; no real mesh has shown one.

What changes

On development. fault_mg._cell_fault_sides gave each cell the side of the last fault copy visited. A cell whose star holds both the Minus and the Plus copy of one fault's points took whichever came last. The recorded-parent rule's side filter (side == −own excluded, #1120) then excluded its candidates on that arbitrary side. H5 found this by reading the code, while reviewing the design for moving coarse levels with the fine mesh. H5 named a fault tip or a junction as where it could occur.

Now.

  • Such a cell gets side 0, so the filter excludes nothing for it.
  • The count is returned and goes into the build notes: fault_mg.last_parent_rows["side_conflicts"], summed over the ranks on the parallel route.
  • _cell_fault_sides returns (side, names, conflicts); its one caller is updated.

Measured. On the #1120 fixture (the add-on child with the 9-point guide and add_fault), at rest, no cell of either split level touches both copies:

  • level 2: 1268 cells, 71 split points;
  • level 3: 1470 cells, 131 split points.

Tolerances and coordinate matches

None.

Tests

tests/test_1120_split_transfer_fault_copies.py:

Serial runs (macOS, 12-core Apple M4): the 33 test files that use fault_mg, add_fault or place_fault_ribbon, 320 passed. Parallel files not run (no MPI on this machine). The parallel route only adds an allreduce of the count, beside the existing ones in its record.

Review

Adversarial review, below.

Issue state

No issue: a defensive finding from a design review, fixed here.

Underworld development team with AI support from Claude Code

_cell_fault_sides gave each cell the side of the last fault copy visited.
A cell whose star holds both the Minus and the Plus copy of one fault's
points (none seen yet; a tip or a junction could make one) took whichever
came last, and the recorded-parent rule's side filter then excluded its
candidates on that arbitrary side. Such a cell now gets side 0, so the
filter excludes nothing for it, and the count goes into the build notes
(fault_mg.last_parent_rows["side_conflicts"], summed over the ranks in the
parallel route). A defensive guard, from H5's review of the coarse-levels
design (point 4).

test_1120: a pairing that puts a vertex on both copies gives its star side
0 and counts it; the #1120 fixture's moved pair counts 0.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 20, 2026 06:27

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 20, 2026

Copy link
Copy Markdown
Member Author

Adversarial review, round 1

  • Rank asymmetry.
    • _cell_fault_sides is rank-local, as before.
    • On the parallel route the count is allreduced inside the same last_parent_rows construction as rows and stranded_cells, which every rank reaches.
    • A rank without the record contributes its initial 0.
  • Behaviour on real meshes. None changes unless a cell touches both copies. Measured on the Rotated split-level transfer: a coarse fault-pair node's copy takes its fine image from across the fault, leaving null directions on the coarse level #1120 fixture at rest: none. The fault slice passes unchanged (320).
  • What side 0 does. The filter side_f · side_c == −1 excludes nothing for a side-0 cell. Its candidates then come from both sides, chosen by containment as for an unsided cell. This is the intended reading (H5): with no side there is nothing to exclude.
  • Tests that cannot fail.
    • The synthetic case asserts a nonzero count and zero sides around the vertex. Development's function returns two values, and the last copy's side, so it fails there.
    • The fixture's count of 0 is a regression record, not a proof. It is labelled so in the test.
  • CI reach. test_1120 is in scripts/test.sh's decade batch.

No findings.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

Parallel check of ff722ed, run by H5 (a debugging session) on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH). The PR's fault_mg.py was run as a Python overlay on current development; the branch contains #1244. "Empty rank" means a test-only shell partition of every gmsh mesh that leaves the last rank with no cells.

Verdict: passes. No change needed.

By reading.

  • On the parallel route, the new m4.allreduce(side_conflicts) sits in the last_parent_rows dict beside the existing rows and stranded_cells allreduces, outside every branch. Every rank that reaches the end of _recorded_rows_where_weak_parallel enters it.
  • Both routes read the module global last_side_conflicts only when _recorded_parent_cells returned a record. That function's only early returns give None before the global is set, so neither route reads a stale value.

The count on the #1206 fixture. The finest split pair of the adapt child (_finest_split_pair_call in the parallel test_1120) was run through cell_located_transfer_parallel, and last_parent_rows was gathered from every rank:

run cells per rank (coarse / fine) record (identical on every rank) rank-local conflicts
np 2 640, 628 / 842, 628 weak 4, rows 10, stranded 0, remaining 0, side_conflicts 0 0, 0
np 3 428, 443, 397 / 428, 443, 599 the same 0, 0, 0
np 3, empty rank 659, 609, 0 / 659, 811, 0 the same 0, 0, 0
np 4, empty rank 453, 378, 437, 0 / 453, 580, 437, 0 the same 0, 0, 0, 0

The allreduce carries a nonzero count from any rank. _cell_fault_sides was wrapped to add 5 conflicts on one rank only, at np 3 with an empty rank:

  • forced on rank 0: side_conflicts = 10 on every rank;
  • forced on the empty rank: side_conflicts = 10 on every rank.

The 10 is 5 on each of the two levels of the pair. Neither run hung, so the empty rank enters the allreduce and reaches the record.

The fault files.

  • Serial: the PR's test_1120 passes (9 passed). On development, its 2 new tests fail and 7 pass.
  • Parallel: the 32 tests/parallel files that use fault_mg, add_fault or place_fault_ribbon were run in batches of 6 at np 2 and 3. The results are identical to development batch by batch: 20 + 1 skipped / 48 + 4 skipped / 30 / 28 / 8 at np 2, and 21 / 48 + 4 skipped / 30 / 28 / 8 at np 3.
  • The one stalled batch: the batch holding test_1139 stalls on both development and the PR, in the same rotated iterative solve. That file runs serially in CI, and its notes record very slow structural solves at np 2 and above. The batch's other five files (test_1097 ribbon, 1134, 1111, 1089, 1135) were rerun without it on the PR: 19 passed and 2 skipped at np 2 and at np 3.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 62da338 into development Nov 20, 2026
10 checks passed
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.

2 participants