Skip to content

Branch on the mesh's isSimplex, agreed over ranks, not the rank-local dm.isSimplex() - #1189

Merged
lmoresi merged 3 commits into
developmentfrom
bugfix/issimplex-agreed-over-ranks
Nov 14, 2026
Merged

lmoresi merged 3 commits into
developmentfrom
bugfix/issimplex-agreed-over-ranks

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

No issue exists for this defect, so this body is the bug report. H1 (the parallel review desk) found it; its attempt to file an issue was refused by its permission check.

The defect. DMPlexIsSimplex is rank-local: it returns False on a rank with no cells. Code that branched on dm.isSimplex() therefore took a different path on an empty rank.

  • H1's case: a 2-D box, cell size 0.5, refinement 3, at np 8. The coarsest cells per rank are [0,3,2,2,0,3,2,2], and dm.isSimplex() per rank is [F,T,T,T,F,T,T,T]. Ranks 0 and 4 raise NotImplementedError inside FaultNetwork.build → _adapt_nested → adapt, at the NVB refusal. The other six hang in marking_metric's collectives.
  • The same at np 3 and 4: a box of cell size 1 with two refinements leaves a rank empty, and adapt(engine='nvb') hangs (supervisor exit 124). Measured on a 96-thread Linux workstation (single system image; Intel Xeon Gold 6240R, AVX-512; MPICH).

The fix. The mesh constructor already reconciles the cell family over ranks into Mesh.isSimplex (discretisation_mesh.py, where it allgathers each populated rank's dm.isSimplex()). The sites that branch on the family now read that:

  • Mesh.adapt: the NVB refusal;
  • Mesh._location_capability: an empty rank took the cell-face audit while the others took "exact";
  • visualisation.py: five sites (the VTK cell types and the higher-order cell maps).

Left as they are: the Mesh(..., simplex=self.dm.isSimplex()) constructor calls (eight in discretisation_mesh.py). The constructor recomputes the family from every populated rank, and uses its simplex argument only when every rank is empty, so a wrong value from an empty rank cannot reach a branch. There are no numerics changes.

Test. tests/parallel/test_1189_adapt_nvb_rank_without_cells_parallel.py, tier B: adapt(engine='nvb') on the box above, with a rank empty (asserted).

  • Before the change it hangs at np 3 and np 4 (exit 124). After it, the child is built on every rank, at np 3 and np 4.
  • It skips at np 2, where no rank is empty. scripts/test.sh runs it at np 3 always, beside test_0786.
  • The parallel empty-rank files pass at np 2, 3 and 4.
  • Serially, the NVB adapt files, test_0761 and the visualisation tests pass (66). The coverage gate passes.

H1 reviews in parallel.

Checklist (UW3 Style Charter — docs/developer/UW3_STYLE_CHARTER.md)

  • I have read the Style Charter and followed it over the surrounding code (S2)
  • No drive-by refactors, renames, or "while I was here" cleanups (S9)
  • Bug fixes ship the regression test, written first, with level_* and tier_* markers (S8)
  • No hedging names (maybe_ / try_ / do_) and no commented-out code (S3, S4)
  • Every exception swallow states its sanctioned failure mode in a comment (S4)
  • New data access uses .array / mesh.X.coords — no with ....access(...), no mesh.data (S7)
  • Parallel safety considered (S11): every branch on the cell family now reads a value agreed over ranks; np 2 to 4 checked
  • No mesh entity or rank identified by coordinates; any remaining tolerance is named, relative and says what it bounds (S12)
  • No pixi.toml / pixi.lock or other dependency changes riding in an unrelated PR
  • AI-assisted work carries the attribution line below

Underworld development team with AI support from Claude Code

… dm.isSimplex()

DMPlexIsSimplex returns False on a rank with no cells. adapt(engine='nvb') refused on
`not dm.isSimplex()`, so an empty rank alone raised NotImplementedError while the
others went on into marking_metric's collectives and hung. The constructor already
reconciles the cell family over ranks into Mesh.isSimplex; the branching sites read
it now: adapt's NVB refusal, the location capability (an empty rank took the
cell-face audit while the others took "exact"), and five sites in visualisation.py.
The Mesh(..., simplex=dm.isSimplex()) constructor calls are left: the constructor
reconciles the family over ranks itself and uses the argument only when every rank
is empty.

tests/parallel/test_1185_adapt_nvb_rank_without_cells_parallel.py: a box of cell size
1 with two refinements leaves a rank empty at np 3 and 4; adapt(engine='nvb') hangs
there before the change (supervisor exit 124) and completes after it. scripts/test.sh
runs it at np 3 always (it skips at np 2, where no rank is empty).

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 14, 2026 05:19

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.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 14, 2026

Copy link
Copy Markdown
Member Author

Parallel review of #1189 at 81b21ba: READY. From H1 (review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)), on a build of the head.

The change is seven sites, self.dm.isSimplex() → self.isSimplex (or mesh.isSimplex). That value is reconciled across ranks in the constructor:

  • adapt's NVB refusal;
  • _location_capability;
  • visualisation.py, five sites.

The eight Mesh(simplex=…dm.isSimplex()) arguments are left as they were. The constructor ignores the argument wherever any rank holds cells, as the body says.

The PR's test (test_1189_adapt_nvb_rank_without_cells_parallel.py):

np result
2 skipped on both ranks (no rank is empty)
3 passed on every rank
4 passed on every rank
8 passed on every rank

The case that hung on development (the reproducer in the body): ptest_0864's vertical network, placed by FaultNetwork.build(…, realisation="ti", seams="ligament") on UnstructuredSimplexBox(cellSize=0.5, refinement=3) at np 8.

  • Development: ranks 0 and 4 raised NotImplementedError in adapt and the job hung (exit 124).
  • Now it completes, through the custom multigrid. Every level of the placed mesh's tail keeps ranks 0 and 4 empty:
    • tail cells per rank: [0, 3, 2, 2, 0, 3, 2, 2]; [0, 12, 8, 8, 0, 12, 8, 8]; [0, 48, 32, 32, 0, 48, 32, 32]; [0, 192, 128, 128, 0, 192, 128, 128]; [0, 291, 170, 128, 0, 212, 161, 128];
    • placed mesh: [0, 329, 188, 128, 0, 246, 177, 128].
  • The Stokes solve (rotated free slip on four walls, pressure nullspace) converges, reason 2.
    • ∫|v|² is 3.2081056569e-04, against 3.2081055792e-04 at np 1 and 3.2081055794e-04 at np 4 on the same base. That is 2.4e-8 relative, from the ligament mesh, which differs by rank count by design.
    • ∫p² differs by the pressure constant, which the nullspace leaves free.

Neighbours: test_0786_stokes_rank_without_cells_parallel.py gives 4 passed and 1 skipped at np 2 (by design), and 5 passed at np 3 and 4.

Not run: the serial NVB, locator and visualisation sets (the author's 66), and the visualisation sites themselves on an empty rank.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit d583072 into development Nov 14, 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.

3 participants