Repository navigation
The coarse levels of a refined hierarchy move with the finest level - #1244
Conversation
Louis's ruling, 2026-11-19: the coarse levels move, by injection of the fine-level coordinates. A move of a refined mesh changed its finest level only, and quadrilateral and hexahedral transfers paired an unmoved coarse level with a moved fine one: on a rising wall the velocity solve went from 3 to 11 iterations (quadrilaterals) and 3 to 7 (hexahedra) in 20 steps. Each coarse vertex now takes the displacement of the finest vertex it is under the refinement, read from the refinement transform (_plex_topology.inherited_vertices, DMPlexTransformGetTargetPoint): exact and topological. Lazily, at the next read of the levels, keyed on _geometry_version, so a restore puts them back. Both the hierarchy DMs and the cached wraps move; a wrap keeps where it was made. A simplex pair, and every lookup that locates one level in another, read a level that moved with the finest where it was made, cells and nodes together, when the fine level is read there: simplex transfers are development's. Quadrilateral and hexahedral pairs are read where they stand. The same iterations are now 3 to 5 for both. A checkpoint saves the coarsest level where it was made. Two tests that asserted the old contract are updated (test_0764, test_1176); an adapt of a raised base now takes 2 iterations, not 4. Underworld development team with AI support from Claude Code
Adversarial review, round 1 (before the PR), and what was doneA fresh review session read the diff against development, ran serial probes, and checked the guide's list. Findings, and the fix in this head:
Checked and found sound by the reviewer:
Not run: any parallel case. The parallel review is with the reviewer of our parallel runs (H1, the session that runs them on a Linux workstation). Underworld development team with AI support from Claude Code |
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at c7d7eda: ready to merge on green from this review.
What I ran
Findings
Build
Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
Underworld development team with AI support from Claude Code
The coarse-side loop in custom_mg.build calls the collective fault_mg.as_built_nodes once per level whose coarse side moved with the finest. It now has an agreement point in front, as the fine-side loop has since #1225: a failure on one rank after a coarse-side check is raised on every rank at the next level's agreement point, where it hung the others. - test_0874_agreed_custom_mg_build_parallel: a refined triangle box whose top wall has risen (two fine-side and two coarse-side checks per build, probed serially); the failure is forced on the last rank at the first coarse-side check, and must be the same CollectiveBuildError on every rank with the agreement calls paired. - test_1240: the iteration count is 4 serially and 5 at np 2 and 3 (measured by the reviewer); above np 3 it is bounded by 5. - _plex_topology: inherited_vertices is collective on the DM's communicator (it creates a DMPlexTransform there); the module docstring said every function was rank-local. Underworld development team with AI support from Claude Code
|
Integration with #1225, head 6d7b167 The reviewer's parallel pass (comment 7027279982) found one item and two lows. All three are addressed in this head.
Serial runs on the merged head (macOS, 12-core Apple M4): 839 passed, 4 skipped and 1 xpassed across 85 multigrid, refinement and fault test files; Underworld development team with AI support from Claude Code |
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at 6d7b167: ready to merge on green from this review. All three findings from my review of c7d7eda are addressed.
Build. The merge of development brings compiled changes ( Logs kept by the reviewer. Underworld development team with AI support from Claude Code |
… it follows - test_1173 (parallel): a moved base's partition. The level below moved with the finest, so each cell lies inside its parent where both stand now (asserted == 0, where the move used to put 920 or 51 cells outside); the cells where they were made are tested against the parents where those were made (parents_contain_centroids(..., as_built=True)). - fault_fixtures.parents_contain_centroids: an as_built argument, reading the parents through fault_mg._cell_vertex_table(as_built=). - test_1172 (serial and parallel): "the coarse levels keep their geometry" passed only because the move is lazy. It now reads the hierarchy and asserts the coarsest level stretched with the finest (x -> 1.5 x) to 1e-14. Underworld development team with AI support from Claude Code
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) 57635a3: ready to merge on green from this review. The head has since moved to 590a51c, a merge of development that brings only PRs already merged there (#1232, #1233, #1236, #1243, #1245); the PR's own files are unchanged by it, so these runs stand. The push changes tests only: Runs at 57635a3 against the 6d7b167 build (identical library):
When the argument is not passed, the function behaves as on development. The one new block is guarded by These library callers pass it:
All other callers use the default. CI checks.
Underworld development team with AI support from Claude Code |
Stage 1 moved provenance_transfer_parallel's reference_vertices call to the top, to decide whether the coarse side is read as built, and left it outside every guard. A failure there on one rank raised out of the function at once while the other ranks waited at the level tables' agreement point: test_0874's forced failure hung at np 2 on CI. The reference is now read under a guard raised on every rank, and the collective move check is entered by every rank when any rank's coarse side follows the finest. The later read in the weighting reuses it. The test that forces the failure is renamed for where the read now is. Underworld development team with AI support from Claude Code
|
A hang at np 2 in
Serial, after rebuilding: 100 passed and 2 skipped ( Underworld development team with AI support from Claude Code |
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at b4e9cf7: changes requested (one test stub). The hang is fixed. The cause and the fixI reproduced the CI hang at 590a51c, np 2. The forced reference-vertex failure left the last rank unwrapped ( Results at b4e9cf7np 2 and np 3, under the MPI supervisor with an outer timeout:
The remaining failure
With this change the file passes 24/24 at np 2 and np 3: --- a/tests/parallel/test_0874_provenance_and_parent_collective_parallel.py
+++ b/tests/parallel/test_0874_provenance_and_parent_collective_parallel.py
@@ -239,10 +239,10 @@ def test_a_cell_table_failure_before_the_parent_location_is_raised_on_every_rank():
original = ap._cell_centroids
- def failing(mesh):
+ def failing(mesh, **kwargs):
if uw.mpi.rank == uw.mpi.size - 1:
raise IndexError("cell table (forced on one rank)")
- return original(mesh)
+ return original(mesh, **kwargs)Coverage after the rename
The logical-OR entry into
|
addon_partition._cell_centroids takes as_built= since this branch, and _parent_cells_local passes it; the stub took one argument, so the call raised TypeError instead of the forced failure. Verified by the reviewer at np 2 and 3 (24 of 24). Underworld development team with AI support from Claude Code
The coarse levels of a refined hierarchy now move with the finest level. This is stage 1, for meshes built with
refinement=. The add-on and split fault levels follow in a second PR.Louis Moresi, 2026-11-19, ruling on the design note for this change:
What changes
On development. A move of a refined mesh (
mesh.deform, a mover) changed the finest level only, and the coarse levels stayed where they were made. Quadrilateral and hexahedral transfers are built from where the levels stand, so after a move they paired an unmoved coarse level with a moved fine one, and the multigrid degraded as the mesh moved.Now. Each coarse vertex takes the displacement of the finest vertex it is under the refinement.
_plex_topology.inherited_vertices, reads it fromDMPlexTransformGetTargetPoint. It is exact and topological: no search and no coordinate match. The inherited vertices come first on triangles and tetrahedra, and after the new cell-centre vertices on quadrilaterals and hexahedra, so no fixed offset is assumed.clone_dm_hierarchyfor a solver, in_coarse_level_meshesfor the custom multigrid, and in the requested-FMG route. The trigger is_geometry_version, which every coordinate change bumps. So a snapshot restore or anephemeral_coordsround trip puts the levels back with the finest._move_version, which counts committed moves only, would have left them moved.How the transfers read the moved levels:
fault_mg.as_built_nodes). The coarse side is now read the same way when it moved with the fine side, so simplex transfers are development's._cell_vertex_table(..., as_built=...)). The argument defaults toFalse, which reads a level where it stands, as development does; only these lookups passTrue, and they do so only for a level that moved with the finest.Checkpoints. A checkpoint saves the coarsest level where it was made, whether or not a solve moved it before the write. Its reference coordinates are refined from that level as well.
Not in this PR:
Those keep their levels where they are.
Measured
Serial, on macOS (12-core Apple M4). A box whose top wall rises by 2.5 % of the depth times sin πx each step, with the interior stretched; Stokes with the custom FMG on the velocity block. The table gives velocity-block iterations at steps 0 / 1 / 5 / 10 / 15 / 20; every solve converged.
test_1176): 2 Poisson iterations against 4 on development, the same as at rest.Agreement across ranks.
Tolerances and coordinate matches
Tests
tests/test_1240_coarse_levels_move_with_the_finest.py, level 2, tier B:tests/parallel/test_0874_agreed_custom_mg_build_parallel.pygains a case where a failure on one rank at the coarse side's move check must be raised on every rank.The two put-back and snapped-level tests pass on development too: they guard against wrong motion, not missing motion.
Changed tests. Two existing tests asserted the old contract:
parents_contain_centroids(..., as_built=True)infault_fixtures).Serial runs: the 118 multigrid, refinement and moving-mesh test files plus test_1240 (
-n 6):The three files in that slice that start
mpirunthemselves (test_0690, test_0791, test_1086) were left out. We do not run MPI on this machine.scripts/test.shgains decade lines fortest_120*totest_129*;check_test_coverage.pypasses.Not run: any parallel case. The new collectives are reasoned in the review below, not run; the reviewer runs np 2 and 3.
Docs
guides/fault-multigrid.md: the FAC-patch passage now says that a faulted mesh's registered levels still do not move.discretisation_mesh.py,fault_mg.py,custom_mg.pyandaddon_partition.pythat said coarse levels never move are updated.Review
One round of adversarial review (posted below); its findings are fixed in this head.
Issue state
No issue is open for this. The design note and Louis's ruling are in the planning thread.
Underworld development team with AI support from Claude Code