Skip to content

A move that keeps the topology keeps the custom multigrid transfers - #1119

Merged
lmoresi merged 14 commits into
developmentfrom
feature/custom-mg-kept-transfer-under-a-move
Nov 13, 2026
Merged

lmoresi merged 14 commits into
developmentfrom
feature/custom-mg-kept-transfer-under-a-move

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

What this does

mesh.deform and the movers (MMPDE, node_redistribution) change where the nodes of the finest level sit and nothing else: every cell keeps its vertices and every node keeps its parent cell on the level below. The custom multigrid transfer between two levels is a statement about that relation, so it should be the same before and after such a move. Until now the hierarchy was rebuilt from the moved coordinates at the first solve after a move, a moved node was located among the unmoved coarse nodes, and the weights followed the displacement.

With this change CustomMGHierarchy.build reads a moved level on the geometry it was made in, and the transfers after a move equal those before it entry for entry.

  • A mesh records the vertices it was made with (Mesh._transfer_vertices). fault_mg.as_built_nodes reads the nodes of any function space on those vertices through the same interpolation matrix that gives the mesh its nodes where it stands. The matrix holds the place of each node in its cell and no coordinate, so the result is the built positions bit for bit, at degree 1 to 3, continuous or not, in 2-D and 3-D. There is no tolerance.
  • The bit matters. The node-cloud builders are not continuous in the nodes they are given: with the built positions recovered only to round-off (2e-16), one weight of a pair of tetrahedral levels changed by 1.4e-4 on 2 and 4 ranks and by 1.1e-4 on 8.
  • Whether a level has moved is read off its coordinates. Coordinates written and put back (ephemeral_coords, a snapshot restore) are not a move. A relax() of a mesh that stands where it was made is part of making it; a relax() after a move is one more move.

Scope: a mode for movers

This applies to a move that keeps the topology. An adapt, a remesh, or a fault placed or moved makes a new mesh, and its hierarchy is built from that mesh as before. A mover does not replace refinement that adds nodes, and the limits below are part of the change.

  • A strong redistribution costs one or two iterations a solve. On a box refined three times, with the mover carrying interior nodes up to 3.8 cell widths, the serial Stokes velocity count on the node-cloud route was 4 after each move with the transfers kept and 3 with them rebuilt; at 3.1 cell widths it was 3 either way. On 2 to 8 ranks the strongest case took 5 to 6 iterations kept against 3 to 4 rebuilt. Under a milder interior mover the count changes by one in either direction. Where the boundary moves the kept transfers do better: with the top wall of a box raised 5 % in each of three steps the serial velocity count stays at 3 against 5, 6 and 7.
  • A move still drops the structural FAC patch (the ruling on After mesh.deform the FAC patch is declined: the custom-P coarse levels do not move with the fine mesh #1017, unchanged here). To get it back after a move, re-refine the base from the moved fault and register the new levels with set_custom_fmg; registering the old coarse levels again does not bring it back. A fac_zone patch survives a move as before.
  • Simplex levels only. A quadrilateral or hexahedral level is read on its moved coordinates and its transfers are rebuilt. A periodic mesh keeps no record and is rebuilt.
  • A refined base moved before an adapt or a cut goes into the child's hierarchy where it stands, and the pair under it is rebuilt: 4 iterations against 2 with the base at rest on the test's fixture. A test pins this; wiring it is a possible follow-up.
  • The recorded route between add-on levels on several ranks (provenance_transfer_parallel) is not changed.

Measurements

Serial, on macOS (12-core Apple M4), held by tests/test_1176_custom_mg_transfer_after_a_move.py (29 tests, tier B):

Fixture At rest After each move, transfers kept Built on the moved mesh Transfers rebuilt from moved coordinates
Faulted Stokes on split levels, three deforms (velocity iterations) 5 6, 6, 6 6 13, 13, 13 (at c1eebf0, which has development 01dec8d merged in; before #1111 the dependent-column check of #1101 refused it at the first move)
Stokes, top wall raised 5 % three times 3 3, 3, 3 3 5, 6, 7
P2 Poisson, preconditioner="fmg", deformed box 2 2 3

Largest change of any transfer entry across a move: 0 on every route (node cloud, native refine pair, cell-located between split levels, tetrahedra).

On 2, 3, 4, 5 and 8 ranks, on a 96-thread Linux workstation (Intel Xeon Gold 6240R, MPICH), measured at 8179f35 with the nodes read bit for bit (the record of those runs is in the comments below):

Fixture Ranks At rest and after each of three moves Built on the moved mesh
Faulted Stokes, the level under the fault split 2 to 5 6, 7, 7, 7 7
Faulted Stokes, the level under the fault welded 8 3, 15, 15, 15 15
Stokes, wall raised 2, 4 3, 3, 4, 4 4
Stokes, wall raised 3, 5, 8 4, 4, 4, 4 4
Poisson on tetrahedra (two moves) 2, 3, 4, 5, 8 3, 3, 3

Largest change of any transfer entry across the moves, the same on every rank: exactly 0 for the wall fixture and the tetrahedra at all five rank counts, and for the faulted fixture at 2 to 5 ranks. On an earlier commit (0355851) that recovered the nodes to round-off, the tetrahedral pair changed by the 1.4e-4 quoted above; the bit-for-bit read answers that. With the transfers rebuilt, the wall fixture took 4, 6, 7, 8 at 5 and 8 ranks.

The faulted fixture has a different multigrid tail at 7 and 8 ranks. adapt(max_levels=2) keeps two add-on levels at 1 to 6 ranks and one at 7 and 8, because Mesh._subsample_mg_levels sizes a generation by the smallest of the ranks' own 5th-percentile cell diameters; at 8 ranks the 1208-cell generation misses the threshold by 3 % and is dropped. This is #865, it is the same on development, and this branch does not change it. With one add-on level the level under the fault is welded, not split, and the finest pair goes by the recorded route between add-on levels (provenance_transfer_parallel), which this branch does not change and which reads the moved coordinates: its transfer repeats to 3.4e-14, not to the bit. The finest level then carries a FAC patch at rest (3 iterations), and the move drops it (15), as #1017 has it. The parallel test reads which case it has: where the level is split it asserts zero change and the first row of the table; where it is welded, a change below 1e-12 and the second row.

What has not been run

  • tests/parallel/test_1176_custom_mg_transfer_after_a_move_parallel.py is now tier B and holds the second table. At 2f1f33a its faulted test has run on one rank only; the welded branch (7 and 8 ranks) was measured at 8179f35 with the old fixture assertion bypassed, and has not been run as written. 6 and 7 ranks assert the transfers only.
  • 16 ranks is outstanding.
  • tests/parallel/test_1152_fac_zone_survives_a_mover_parallel.py changed at 09fbc36 after its zone case failed in CI at 2f1f33a (the comment of 2026-11-13 below has the measurements: the kept solver's transfers and level operators equal a fresh registration's, and the two differed only in the mask the test gave them). Its new assertions have since passed on 1, 2 and 4 ranks (the record is in the comments below) and in CI at 09fbc36, on a GitHub-hosted Ubuntu runner, where the kept solver and a registration with the same mask took 7, 8, 7 velocity iterations at the three moves against 12, 10, 10 with no zone. Those runs were before development 01dec8d was merged in.
  • The merge of development 01dec8d (f48bd91) and the commit after it (c1eebf0, docstrings and docs only) have run on one rank only, apart from CI.

Two things seen on the way that are not this change

Both are the same on development.

Issues

This closes no issue. In the territory:

Tests

  • tests/test_1176_custom_mg_transfer_after_a_move.py: 29 passed (again at c1eebf0). Mutants, in memory: with the nodes recovered to round-off every equality test fails; with the kept transfer off every transfer and count test fails or raises.
  • Serial suite of 34 multigrid, fault and mover files: 220 passed, 23 skipped.
  • tests/parallel/test_1152_fac_zone_survives_a_mover_parallel.py: 2 passed on one rank at 09fbc36. On the zone the kept solver takes the count of a registration made after the move with the same mask (7 at each move) and fewer than one with no zone (12, 10, 9).
  • scripts/check_test_coverage.py: all 447 files reachable. Docs build clean.

Underworld development team with AI support from Claude Code

After mesh.deform or a mover the custom multigrid hierarchy rebuilt each
transfer from the moved coordinates: a node of the moved level was located
among the unmoved coarse nodes, and the weights followed the displacement.
The relation between the levels had not changed. On a split-fault fixture
the solve went from 5 velocity iterations to 13 at the first move.

A simplex level that has moved since it was made is now read on the
geometry it was made in (fault_mg.as_built_nodes), so the transfers after
a move are those before it, to round-off, on the node-cloud, native
refine-pair and cell-located routes.

- Mesh._transfer_vertices holds the vertex coordinates the transfers are
  built on. A relax of a mesh that stands there is part of making the mesh
  and records the relaxed coordinates, inside adapt(relax=True) or in a
  call of its own; a relax of a mesh that has moved is one more move.
- Whether a level has moved is read off its coordinates, collectively.
  Coordinates written and put back (ephemeral_coords, a restore) are not
  a move.
- Only a level's own moves are undone. A mesh made on a moved one (a cut,
  a placement, an adapt child) is read where it is, and the base it was
  made from goes into its hierarchy where it stands, as before.
- Quadrilateral, hexahedral and periodic levels are read on the moved
  coordinates, as before. The structural FAC patch is still dropped by a
  move (#1017).

This is a mode for movers. The count is not lower on every move: under an
interior mover it changes by one in either direction; where the boundary
moves (a rising wall) it stays at the at-rest count against 5, 6, 7.
Serial only so far; the parallel runs are still to come.

tests/test_1176_custom_mg_transfer_after_a_move.py (tier B, 19 tests).

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
With the dependent-column check merged from development, a fault cut into
an adapt child that moved by 0.005 or more is refused: the split level
under the new mesh is cut where the host's coarse level stands, and coarse
unknowns are left with too few fine images. The refusal is the same with
the transfers kept or built from the moved coordinates. The test moves its
host by 0.002 (6 velocity iterations, as before) and the page says where
the refusal starts on that fixture.

Underworld development team with AI support from Claude Code
The as-built nodes of a moved level were its nodes at rest to round-off
(2e-16). The node-cloud builder is not continuous in the nodes it is given:
a node on a face of its triangulation is read in either neighbour. On 2, 4
and 8 ranks, where a native refine pair takes that builder, one weight of a
tetrahedral pair changed by 1.4e-4 over a move.

A node at a corner or on the degree lattice of its cell now takes the exact
barycentric weights, so at degree 1 and 2 it lands on the built position
exactly, and the transfer built on it is the one built at rest. The recorded
pair of the add-on partition takes its nodes back the same way.

test_1176 compares the transfers for equality (it allowed 1e-12), and has a
companion for 2 ranks and more with the iteration counts measured on 2, 3,
4, 5 and 8 ranks. The companion has run at one rank only.

The subsystem page states the limit that was measured: a redistribution that
carries nodes about four cell widths costs one or two iterations a solve with
the transfers kept. It also says how the structural patch comes back after a
move.

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…n interpolation

The nodes of a moved level were taken back through barycentric weights
snapped to the node lattice within 1e-9. The snap lapsed on a badly
conditioned cell, covered only the corner and edge-midpoint nodes of
degree 1 and 2, and left a discontinuous space to round-off.

Mesh._get_coords_for_basis now takes the vertices to read the nodes on.
fault_mg.as_built_nodes hands it the recorded ones, so the nodes are the
same interpolation matrix applied to the same vertex coordinates as
before the move: bit for bit at any degree, continuous or not, with no
tolerance. test_1176 asserts it at degree 1 to 3, both continuities, in
2-D and 3-D.

The recorded route between add-on levels on several ranks goes back to
the map through the node's own cell, to round-off, as it was measured.
It locates nothing, so its transfer changes by round-off only; the claim
of the previous commit that it is bit for bit was wrong where the record
is held by an ancestor of the fine level.

The parallel companion is tier C until it has been run: its counts were
measured with the nodes recovered to round-off, and are asserted only at
the rank counts they were measured on.

Docs: the interpolation in place of the weights, the env flag behind the
serial node-cloud counts, the zone patch across a move, and no account
of why the rebuilt transfer does better under a strong redistribution.

Underworld development team with AI support from Claude Code
The test_117* line of development covers test_1176, so this branch's own
line for it is dropped.

Underworld development team with AI support from Claude Code
Answers the review of 1410a48.

The parallel split-level test compared the transfers before and after a
move to 1e-10, on the reading that its finest pair might take the recorded
route. It does not: both levels of that pair are split, a split coarse
level is never recorded against, and the pair takes the cell-located
transfer on the built nodes. The assertion is now equality, as on the
other two routes. With the nodes recovered only to round-off this fixture's
transfer changes by 6.7e-14 serially, which 1e-10 would have let through.

The recorded route (provenance_transfer_parallel) is not changed by this
branch, so its docstring goes back to development's wording, and the
subsystem page no longer attributes a measured 8.5e-13 to it: that number
was measured on the other routes with the nodes recovered to round-off.
tests/test_1173_addon_record_after_a_move.py holds the recorded route
after a move.

The parallel file's docstring says when and on what the counts were
measured (2026-11-13, a 96-thread Linux workstation, Intel Xeon Gold
6240R, MPICH, 2 to 8 ranks; the tetrahedral counts at 8 ranks only). The
change of one tetrahedral weight is 1.4e-4 on 2 and 4 ranks and 1.1e-4 on
8 in all three places that quote it. The subsystem page says a fac_zone's
rows stay in the patch across a move and are cut into blocks again from
the moved coordinates.

Not run on more than one rank.

Underworld development team with AI support from Claude Code
…w refused

The docs and two test docstrings said the faulted Stokes fixture takes 13
velocity iterations at the first move with the transfers rebuilt from the
moved coordinates. That was measured before the dependent-column check of
#1101. With the check, the rebuilt hierarchy is refused at the first move
(7 groups of dependent coarse columns); the fixture takes 5 at rest and,
with the transfers kept, 6 after each move. The text says both.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 13, 2026 00:11

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

Copy link
Copy Markdown
Member Author

Adversarial review record (five rounds, before the PR opened)

Each round was a fresh reviewer given the code and not our conclusions. All runs were serial, on macOS (12-core Apple M4); nothing below was run on more than one rank. Probes are kept by the author.

Rounds 1 to 3: the change before its first commit

The first version took a moved level back through a per-cell barycentric map kept on the add-on record. What the rounds found and what came of it:

Finding Outcome
A fault cut into a child that had been deformed before the cut got a worse hierarchy than on development (the map took the new mesh back through its host's move) Fixed. A level's own moves are undone and nothing else; a mesh made on a moved one is read where it is. test_a_fault_cut_into_a_moved_mesh_is_read_where_it_is
adapt(relax=True), and the same relax as a call of its own, cost one iteration at P2 against development Fixed. A relax() of a mesh that stands where it was made is part of making it, and the record is taken after it. Two tests
An empty ephemeral_coords block marked the mesh as moved and changed a transfer's sparsity Fixed. A move is read off the coordinates, not a flag. test_coordinates_put_back_are_not_a_move
A reloaded refined mesh is "moved" with no move by the user Kept and documented: the reload stamps saved coordinates on rebuilt levels. test_a_reloaded_mesh_is_read_on_its_rebuilt_refinement holds the count
A refined base moved before an adapt is not reached (4 iterations against 2) Not fixed in this branch. Pinned by test_a_base_moved_before_an_adapt_goes_into_the_child_where_it_stands and stated in the docs and the PR body
Under the node-redistribution mover the kept transfer is not uniformly at least as good as the rebuilt one True, and stated as the limit of the mode, with the counts
The parallel block cut of a fac_zone keyed sites on coordinates that were no longer bit-identical Answered by the bit-for-bit read (round 5)
No parallel test Added: tests/parallel/test_1176_..._parallel.py
Assertions weaker than their docstrings (<= n), a test that passed with the change off, an equality that a 1e-3 tolerance satisfied Counts are asserted with ==, transfer changes with == 0; mutants rerun in round 5
Test number 1175 was taken Renumbered 1176

Round 4: the lattice snap (c1e23b0)

That commit recovered the built nodes by snapping barycentric weights to the node lattice within 1e-9. The round rejected it: an absolute tolerance lapses on sliver cells, the degree-3 nodes are not on a k/degree lattice, a discontinuous space was left at round-off, the parallel companion claimed tier B on counts measured at other rank counts, and a docstring claimed bit-for-bit for the recorded route. Outcome: the snap was removed (1410a48). The nodes are read by the mesh's own interpolation on the recorded vertices, which needs no tolerance and holds at every degree; the companion went to tier C.

Round 5: the interpolation read (1410a48)

# Finding Outcome
1 The parallel split-level test compared transfers to 1e-10, on a route it had not identified. Its finest pair is between split levels and takes the cell-located transfer on the built nodes, so the round-off mutant (6.7e-14 serially) would pass Fixed in cc2a23f: asserted == 0
2 The subsystem page attributed a measured 8.5e-13 to the recorded route, which the measurement did not run Fixed: the number is gone from the page; the recorded route is unchanged by this branch and its docstring is development's again
3 The parallel companion is unrun at this commit; its docstring gave no date or configuration Docstring now dated with the machine and rank counts. Unrun remains true and is stated in the PR body
4 The tetrahedral count is asserted at 8 ranks only That is where it was measured; the comment says so
5 One measurement quoted three ways (1.4e-4 at 2, 4 and 8 ranks against 1.1e-4 at 8) Fixed in all three places
6 "The blocks of the zone are kept across the move": the rows are kept, the cut into blocks is recomputed from moved coordinates Fixed
7 The record is read from the local coordinate vector and the default path reads the global one; nothing asserts they agree when the record is taken Not changed. Every call site records straight after the coordinates are set, and the reviewer reached the disagreement only by writing the local vector in place
8 Low: the level view of a hierarchy DM is safe only because it answers "not moved"; a vector leaks if the interpolation raises (as before this change); two wrap nits Wrap fixed; the rest left

Found sound in round 5: the serial tests fail under three mutants (round-off recovery: all 12 node cases and every transfer equality; the snap: degree 3 and every discontinuous space; kept transfer off: every transfer and count test fails or raises). The read is bit for bit beyond the tested cases: after one and two deforms, on a regular box, an annulus, relaxed then deformed, an adapt child, a reloaded annulus, a 3-D box and a surface submesh. By reading only: localToGlobal inserts owned values without communication, the duplicated global vector has the layout the coordinate DM expects, and every rank takes the same branch into the collective interpolation.

A check made after round 5: with the kept transfer off, the split-level fixture is refused at the first move by the dependent-column check of #1101 (7 groups). The docs said 13 iterations, measured before that check; corrected in 8179f35.

Not checked

Anything on more than one rank: the parallel companion in full, the bit-for-bit read at 2 or more ranks including a rank that owns no vertex, and the route the split-level fixture's finest pair takes there (finding 1 is a reading of the code).

Issue verdicts

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

#1119 kept custom-MG transfer under a move: parallel runs at 8179f35

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

Build: branch head 8179f35, which has development ba68af0 merged in.

How the runs were made:

  • Tests ran from a git archive 8179f35e tests copy, with PYTHONDONTWRITEBYTECODE=1, -p no:cacheprovider, --with-mpi and -m "".

    • tests/pytest.ini has addopts = -ra and tests/conftest.py does no tier filtering, so the tier C marker does not deselect the file. -m "" was passed anyway.
  • Every MPI job ran under mpi_supervisor.py --silence 600 -- mpirun -n N. No more than 8 cores were in use at once, and the np 8 jobs ran alone.

  • A read-only pytest plugin recorded what the file computes without changing any assert:

    • the value _largest_change returned, on every rank;
    • the iteration counts after every Stokes.solve / Poisson.solve, on every rank.

    It wraps the functions and returns their results unchanged.

  • No run hung, and the supervisor killed nothing.

Summary

  1. The node-cloud and split-level transfers are now bit for bit at np 2, 3, 4 and 5.

    • All three tests pass. _largest_change is exactly 0.0 on every rank.
    • This includes the tetrahedra at np 2 and 4, where 0355851 gave 1.4e-4. So the parallel as_built_nodes path (local vertices → localToGlobal → mult → globalToLocal) gives the built nodes to the bit at these rank counts.
  2. Defect: test_a_split_level_keeps_the_transfers_and_the_velocity_iterations fails at np 8.

    • It fails in the fixture, at assert fault_mg.is_split_level(mesh._custom_mg_coarse_meshes[-1]), on all 8 ranks, before any solve.
    • At np 7 and 8, adapt(max_levels=2) keeps one add-on level instead of two, so no coarse level is split (see D3).
    • With that assertion bypassed, the test body at np 8 gives:
      • _largest_change = 3.4e-14, not 0;
      • counts 3, 15, 15, 15 and 15 for a solver built after the moves. These match SPLIT_COUNTS[8].

    So the np 8 entry would fail == 0 even past the fixture. The reason is the route: the finest pair there (static level → split finest) takes the provenance route, which is handed the current coordinates, not as_built_nodes.

  3. Tet counts at np 2, 3, 4 and 5 are 3, 3, 3 each, the same as np 8.

  4. D3: what decides the patch is the adapt level selection, not the FAC cover gate. The level selection depends on the partition:

    • At np 5 the hierarchy has split coarse levels. Every pair that touches one takes the split route, which never runs the cover gate, so fac_gate is all None.
    • At np 8 the hierarchy has no split coarse level. The finest pair takes the ordinary parallel route, and the gate takes the structural patch: 2884 of 5984 rows is 48 %, against a cover_max of 0.98.

1. test_1176 parallel file, per test per np

test np 2 np 3 np 4 np 5 np 8
wall (node cloud) pass, Δ = 0.0 pass, 0.0 pass, 0.0 pass, 0.0 pass, 0.0
split level (cell-located) pass, 0.0 pass, 0.0 pass, 0.0 pass, 0.0 FAIL (fixture assertion; Δ = 3.4e-14 with it bypassed)
tets (node cloud) pass, 0.0 pass, 0.0 pass, 0.0 pass, 0.0 pass, 0.0
  • Δ is _largest_change, the same value on every rank.
  • Wall times: 26 s (np 2), 18 s (np 3), 19 s (np 4), 25 s (np 5), 7.6 s (np 8).
  • Every solve converged (SNES reason 2).

Iteration counts measured: at rest, then after each move; "after" is a solver built on the moved mesh. They were identical on every rank.

test np 2 np 3 np 4 np 5 np 8 file's table
wall, velocity 3, 3, 4, 4; after 4 4, 4, 4, 4; after 4 3, 3, 4, 4; after 4 4, 4, 4, 4; after 4 4, 4, 4, 4; after 4 all equal to WALL_COUNTS, and after = 4
split level, velocity 6, 7, 7, 7; after 7 6, 7, 7, 7; after 7 6, 7, 7, 7; after 7 6, 7, 7, 7; after 7 not reached (fixture); 3, 15, 15, 15; after 15 with the assertion bypassed np 2-5 equal to SPLIT_COUNTS; np 8 matches the table but the test cannot reach it
tets, Poisson 3, 3, 3 3, 3, 3 3, 3, 3 3, 3, 3 3, 3, 3 TET_COUNTS[8] = [3, 3, 3] is met

2. Tet iteration counts for tier B

Measured, in TET_COUNTS form (at rest, then after each of the two moves):

TET_COUNTS = {2: [3, 3, 3], 3: [3, 3, 3], 4: [3, 3, 3], 5: [3, 3, 3], 8: [3, 3, 3]}

With _largest_change at 0.0 at every one of these rank counts, the docstring's 1.4e-4 / 1.1e-4 paragraph and the "Tier C: ... have not been measured with the nodes read bit for bit" line now describe the earlier head. The exception is the split-level test at np 8 (item 3 below).

3. D3: why np 8 gets a FAC patch and np 5 does not (split-level fixture, at rest)

The hierarchy

np 5 np 8
levels (global cells) 242, 968, 1268, 1470 242, 968, 1470
static / split per level S, S, split, split S, S, split
fixture assert is_split_level(tail[-1]) True False
has_split_levels True False
pair routes 0→1 node cloud; 1→2 split + provenance; 2→3 split + cell-located 0→1 node cloud; 1→2 provenance (ordinary route)
hierarchy.fac_gate [None, None, None, None] (the gate never ran) [None, None, {rows: 5984, subdomain_rows: 2884, taken: True}]
cover_max on the finest level n/a 0.98 (2-D split level)
pc_fallbacks after the first solve {} {}
patch_summary none finest level: 8 blocks, 2280 owned patch rows, 2884 subdomain rows, largest block 2482
velocity iterations at rest 6 3

Per-rank FAC patch rows at np 8

These are on the finest level, the only level with a patch. Coarse levels have none at either np.

rank owned rows patch rows (classified) patch+halo rows (classified) installed block rows
0 386 48 94 94
1 444 24 60 60
2 352 0 0 0
3 518 0 0 0
4 554 56 130 130
5 2600 2104 2482 2482
6 524 2 6 0 (its piece went to rank 7's block)
7 606 46 112 118
total 5984 2280 2884 2884

At np 5 no rank has patch rows on any level.

What decides it

The deciding step is Mesh._subsample_mg_levels, which keeps one adapt generation per halving of h. All four NVB generations are the same at np 1, 5 and 8 (global cells 968 → 1106 → 1208 → 1308 → 1360). The level's resolution is computed as follows:

  • each rank takes the 5th percentile of its own cell diameters;
  • that value is MIN-reduced over the ranks;
  • a generation is kept when h ≤ h_ref / (2.0 × 0.9) = h_ref / 1.8.
h of the base finest (min over ranks) threshold h of generation 2 (1208 cells) generation 2 kept? levels kept
np 1 0.04858 0.02699 0.02515 yes 1208, 1360
np 5 0.04592 (rank 0) 0.02551 0.02502 yes 1208, 1360
np 8 0.04356 (rank 6) 0.02420 0.02483 no (3 % over) 1360 only
  • At np 8, rank 6 holds 116 base cells whose 5th-percentile diameter is the smallest of any rank. That lowers h_ref, and the 1208-cell generation misses the slack ratio by 3 %. Generation 3 (1308 cells) is kept and then replaced by the child, because the two are within the ratio. That leaves a single add-on level.
  • The same measurement gives 4 levels at np 1, 2, 3, 4 and 6, and 3 levels at np 7 as well as at np 8.

Answer: it is a partition-dependent threshold, but in the adapt's multigrid level selection (a per-rank percentile, MIN-reduced), not in the FAC cover gate. The gate's 0.98 is not near its margin at np 8 (48 % coverage), and at np 1-6 it never runs.

That one lost level changes everything downstream:

The 8179f35 commit and D3

"The rebuilt hierarchy on the split-level fixture is now refused" is about the transfers rebuilt from the moved coordinates at the first move. With the #1101 dependent-column check, that hierarchy is refused (7 groups of dependent coarse columns). It does not touch the at-rest hierarchy measured here. It also describes only the hierarchy with split coarse levels (np 1-6):

  • At np 7-8 the fixture has a different hierarchy.
  • 0355851's D3 found that development, which rebuilds after a move, was not refused at np 8 (15, 15, 15).
  • With this branch keeping the transfers, nothing is rebuilt at either np.

Defects and points to act on

  1. The split-level test fails at np 8 (and its fixture would fail at np 7): is_split_level(mesh._custom_mg_coarse_meshes[-1]) is False because adapt(max_levels=2) keeps one add-on level there.
    • SPLIT_COUNTS[8] cannot be reached as written.
    • Past the fixture, _largest_change == 0 would fail at np 8 too: it is 3.4e-14, because the pair takes the provenance route, which reads current coordinates.
  2. The adapt's level count depends on the rank count (4 levels at np 1-6, 3 at np 7-8, for the same mesh). Cause: _subsample_mg_levels measures resolution as a MIN over ranks of rank-local 5th percentiles.
    • The adapt docstring says the refined mesh is partition-independent. The mesh is, but its multigrid tail is not.
    • This is the root of 0355851's D3, and it predates this branch. Development has the same _subsample_mg_levels, and 0355851 saw the np 8 patch on both builds.
  3. No other failure. Wall and tets pass at every np with Δ = 0.0, and the split level passes at np 2-5 with Δ = 0.0. Every count equals the file's tables.

Underworld development team with AI support from Claude Code

Measured at 2, 3, 4, 5 and 8 ranks on a 96-thread Linux workstation (Intel
Xeon Gold 6240R, MPICH), the node-cloud and split-level transfers after the
moves equal those before them entry for entry, the tetrahedral pair included.
The tetrahedral iteration counts are 3, 3, 3 at each of those rank counts, so
the table has them all and the file moves from tier C to tier B.

The faulted fixture asserted that the level under the fault is split. That
holds at 1 to 6 ranks. At 7 and 8 the adapt keeps one add-on level instead of
two (#865: a generation is sized by the smallest of the ranks' own cell-size
percentiles), the level is welded, and the finest pair is the recorded route,
which reads the moved coordinates and repeats its transfer to 3.4e-14. The
test now reads which case it has and asserts each: zero change and the split
counts, or round-off and the welded counts (3 at rest, 15 after a move, at 8
ranks).

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

#1119 at 2f1f33a: the parallel test file re-run

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

2f1f33a changes only tests/parallel/test_1176_custom_mg_transfer_after_a_move_parallel.py and one docs page; the library is unchanged from 8179f35. So the file was taken from 2f1f33a and run on the 8179f35 build:

  • under mpi_supervisor, with -m "";
  • with a read-only plugin recording _largest_change and each solve's iteration count on every rank. The plugin's own field-split probe logs a harmless PETSc error 73 on the split-level solves; it does not touch the test.

Result: 3 passed on every rank at np 8, 7 and 2. The split-level test's np 7 and 8 cases now take the welded branch.

np wall: change / counts split level: branch, change, counts tets: change / counts
8 0.0 / 4, 4, 4, 4; after 4 welded: 3.43e-14 (< 1e-12); 3, 15, 15, 15; after 15 (= WELDED_COUNTS[8]) 0.0 / 3, 3, 3
7 0.0 / 4, 4, 4, 4; after 4 welded: 2.93e-14 (< 1e-12); 3, 15, 15, 15; after 15. There is no table entry for np 7, so the counts are not asserted; the transfer bound is. 0.0 / 3, 3, 3
2 0.0 / 3, 3, 4, 4; after 4 split: 0.0 (== 0); 6, 7, 7, 7; after 7 (= SPLIT_COUNTS[2]) 0.0 / 3, 3, 3
2, with OPENBLAS_CORETYPE=Zen (the AMD runners' BLAS kernels) identical to the plain np 2 run identical identical

CI. CI's parallel pass runs tests/parallel/test_*.py at np 2 (--p 2); the np 3 and np 4 passes are opt-in. At np 2 the file takes the split branch, whose counts are asserted exactly. These were the same with the Zen BLAS kernels on this machine. CI's other compiled kernels and libm cannot be reproduced here, so a ±1 count difference on those runners cannot be ruled out. The transfer assertions (== 0 and < 1e-12) compare one machine against itself, so they do not depend on the CPU.

Underworld development team with AI support from Claude Code

…ame mask

The zone case asserted that the kept solver took at most one velocity
iteration more than a fresh registration with the zone recomputed from the
moved field. That compares two masks. The mover holds the zone field in
space while the cells move, so the kept patch's cells hold 135 of the 330
weak cells after one move, 54 of 260 after two and 31 of 208 after three,
and the gap is what that drift costs on the host's mesh: one iteration on
macOS (12-core Apple M4), two at the second move on a GitHub-hosted Ubuntu
runner (8 against 6), where the bound failed.

The transfers and the four level operators of the kept solver equal those
of a fresh registration to the last bit at every move; only the patch rows
differ (1650 kept; 1630, 1398 and 1232 with the zone recomputed).

The zone case now asserts what holds on any host:
- a registration made after the move with the kept solver's mask takes the
  same velocity count as the kept solver (7 and 7 at each move);
- the kept solver takes fewer than a registration with no zone, which
  installs no patch (12, 10, 9).
The gap to the recomputed zone is printed at every move with the other
counts, and is not bounded. The accuracy assertions against the recomputed
zone are unchanged, and so is the split-level case.

In-memory mutants, each failing at the first move: the kept patch killed
(12 against 7), the kept solver alone rebuilding its transfers from the
moved coordinates (8 against 7), the kept mask on other cells (12 against 7).

The fault-multigrid guide and the subsystem page say that a kept zone patch
stays on the cells it was given, and that registering again with the zone
recomputed is the remedy.

Run on one rank only.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

The CI failure of test_1152[zone] at 2f1f33a, and 09fbc36

CI at 2f1f33a failed tests/parallel/test_1152_fac_zone_survives_a_mover_parallel.py::test_a_kept_zone_patch_matches_a_fresh_registration[zone] at the second move, on one rank and under mpirun: the solver that kept its fac_zone patch took 8 velocity iterations against 6 for a fresh registration, and the test allowed one more.

The kept solver carries nothing stale. Measured on one rank on macOS (12-core Apple M4, serial runs only), on the test's own fixture, after each of the three moves, kept against a fresh registration:

  • the three transfers: largest entry difference exactly 0;
  • the four level operators: largest entry difference exactly 0;
  • the FAC patch rows: 1650 kept; 1630, 1398 and 1232 fresh.

The patch rows differ because the test hands the two solvers different masks. The kept solver has the cells of the Band label, given at registration. The fresh one has the zone recomputed from the moved field. The mover holds the zone field where it is in space while the cells move under it, so of the 330, 260 and 208 weak cells after moves 1, 2 and 3, only 135, 54 and 31 are cells of the kept mask. With the fresh registration given the kept solver's mask, the rows are identical and so are the counts.

Velocity iterations at moves 1, 2, 3, one rank, macOS:

Registration Move 1 Move 2 Move 3
kept (mask given at registration) 7 7 7
after the move, the kept solver's mask 7 7 7
after the move, the zone recomputed 6 6 6
after the move, no zone (no patch is installed) 12 10 9

So the old bound compared a patch on drifting cells with a patch on the band, and the gap is what the drift costs on the host's mesh: one iteration on macOS, two at the second move on the GitHub-hosted Ubuntu runner (the meshes differ between hosts: q_min at the second move is 0.4275 on macOS, 0.4302 on the runner, 0.4341 there under mpirun). On development the same case ran 8 against 7 on macOS, with both solvers rebuilding their transfers from the moved coordinates.

09fbc36 (tests and docs only). On the zone case the test now asserts what holds on any host:

  • a registration made after the move with the kept solver's mask takes the same velocity count as the kept solver;
  • the kept solver takes fewer than a registration with no zone.

The gap to the recomputed zone is not bounded. The progress line of each move, printed on a green run too, carries all four counts, so each host's log records them. The accuracy assertions against the recomputed zone are unchanged. The split-level case is unchanged: there a move drops the structural rows by the ruling on #1017, and the kept solver may take one more (17 and 16, 17 and 17, 17 and 17 on macOS; 18, 18, 17 with no zone).

Mutants, in memory, each failing at the first move: the kept patch killed (12 against 7); the kept solver alone rebuilding its transfers from the moved coordinates (8 against 7); the kept mask on other cells (12 against 7).

The fault-multigrid guide and the subsystem page now say that a kept fac_zone patch stays on the cells it was given, that under a mover which holds the zone field in space the band leaves them, and that the remedy is to register again with the zone recomputed. This is the same on development and is not a change of this branch.

Not run: the new assertions on more than one rank. Nothing in the transfers or the blocks should depend on which solver built them, but the equality has been measured on one rank only. It needs 2 and 4 ranks on the Linux workstation before this merges; CI runs it under mpirun.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

#1119 at 09fbc36: test_1152 at np 1, 2 and 4

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

The file tests/parallel/test_1152_fac_zone_survives_a_mover_parallel.py was taken from 09fbc36 and run on the 8179f35 build; 09fbc36 changes no library code. Runs: serially (np 1), and under mpirun -n 2 and -n 4 with --with-mpi.

Result: both cases pass on every rank at np 1, 2 and 4. The progress lines (rank 0; the other ranks' tests passed identically):

np 1 (2 passed, 466 s)

test_1152[zone] move 1/3: velocity iterations kept 7, zone recomputed 7, kept mask registered again 7, no zone 12
test_1152[zone] move 2/3: velocity iterations kept 8, zone recomputed 6, kept mask registered again 8, no zone 10
test_1152[zone] move 3/3: velocity iterations kept 7, zone recomputed 6, kept mask registered again 7, no zone 9
test_1152[split] move 1/3: velocity iterations kept 17, zone recomputed 17
test_1152[split] move 2/3: velocity iterations kept 17, zone recomputed 17
test_1152[split] move 3/3: velocity iterations kept 17, zone recomputed 17

np 2 (2 passed on each rank, 358 s)

test_1152[zone] move 1/3: velocity iterations kept 7, zone recomputed 7, kept mask registered again 7, no zone 12
test_1152[zone] move 2/3: velocity iterations kept 8, zone recomputed 6, kept mask registered again 8, no zone 10
test_1152[zone] move 3/3: velocity iterations kept 7, zone recomputed 6, kept mask registered again 7, no zone 10
test_1152[split] move 1/3: velocity iterations kept 18, zone recomputed 18
test_1152[split] move 2/3: velocity iterations kept 19, zone recomputed 19
test_1152[split] move 3/3: velocity iterations kept 18, zone recomputed 18

np 4 (2 passed on each rank, 311 s)

test_1152[zone] move 1/3: velocity iterations kept 8, zone recomputed 7, kept mask registered again 8, no zone 15
test_1152[zone] move 2/3: velocity iterations kept 8, zone recomputed 7, kept mask registered again 8, no zone 11
test_1152[zone] move 3/3: velocity iterations kept 7, zone recomputed 7, kept mask registered again 7, no zone 10
test_1152[split] move 1/3: velocity iterations kept 19, zone recomputed 19
test_1152[split] move 2/3: velocity iterations kept 18, zone recomputed 19
test_1152[split] move 3/3: velocity iterations kept 20, zone recomputed 20

The three things that only parallel runs could show:

  • (a) its_k == its["same"] holds at every move and every np. There is no one-off.
  • (b) its_k < its["none"] at move 3: the margin is 2 at np 1 (7 against 9), and 3 at np 2 and np 4 (7 against 10).
  • (c) The no-zone registration installs no patch at any of these rank counts. The test's own assertion passed.

One difference from the macOS figures: on this machine, kept and same-mask take 8 at move 2 (7 on macOS). The equality holds either way.

Underworld development team with AI support from Claude Code

… it is refused

The docs and test_1176's docstrings said that transfers rebuilt from the
moved coordinates were refused by the dependent-column check of #1101.
Development now merges the dependent coarse unknowns (#1111), so nothing
is refused. Measured on this branch merged with development 01dec8d,
serial, macOS (12-core Apple M4):

- split-level fixture, transfers rebuilt: 5 velocity iterations at rest
  and 13 after each of three moves, with 62 to 137 coarse unknowns of the
  level under the fault merged; kept: 5, 6, 6, 6, one merged
- host moved before the cut by 0.002, 0.005, 0.01, 0.02: 6, 6, 7, 6
  iterations, with 0, 2, 6, 62 merged on the split level

No assertion changes; test_1176 and test_1152 pass on one rank (31).

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 13, 2026

Copy link
Copy Markdown
Member Author

#1119 at c1eebf0 (after development 01dec8d with #1111): the parallel runs

Run by H1 (review and parallel test runs on a 96-thread Linux workstation: Intel Xeon Gold 6240R, AVX-512; MPICH), on a build of c1eebf0.

All pass, and every number equals the pre-#1111 runs on 09fbc36.

test_1176, parallel entry: 3 passed on every rank at np 2 and 4.

  • The largest transfer change is exactly 0.0 for the wall, split-level and tetrahedral cases at both rank counts.
  • Wall velocity iterations: 3, 3, 4, 4; 4 for a solver built afterwards.
  • Split level: 6, 7, 7, 7; 7 afterwards.
  • Tets: 3, 3, 3.

test_1152: 2 passed on every rank at np 2 and 4. The progress lines:

np 2:

test_1152[zone] move 1/3: velocity iterations kept 7, zone recomputed 7, kept mask registered again 7, no zone 12
test_1152[zone] move 2/3: velocity iterations kept 8, zone recomputed 6, kept mask registered again 8, no zone 10
test_1152[zone] move 3/3: velocity iterations kept 7, zone recomputed 6, kept mask registered again 7, no zone 10
test_1152[split] move 1/3: velocity iterations kept 18, zone recomputed 18
test_1152[split] move 2/3: velocity iterations kept 19, zone recomputed 19
test_1152[split] move 3/3: velocity iterations kept 18, zone recomputed 18

np 4:

test_1152[zone] move 1/3: velocity iterations kept 8, zone recomputed 7, kept mask registered again 8, no zone 15
test_1152[zone] move 2/3: velocity iterations kept 8, zone recomputed 7, kept mask registered again 8, no zone 11
test_1152[zone] move 3/3: velocity iterations kept 7, zone recomputed 7, kept mask registered again 7, no zone 10
test_1152[split] move 1/3: velocity iterations kept 19, zone recomputed 19
test_1152[split] move 2/3: velocity iterations kept 18, zone recomputed 19
test_1152[split] move 3/3: velocity iterations kept 20, zone recomputed 20

The tests do not print merged-unknown counts. np 8 was not run this time; it passed at 2f1f33a.

Underworld development team with AI support from Claude Code

@lmoresi
lmoresi merged commit 8be8bf1 into development Nov 13, 2026
10 checks passed
lmoresi added a commit that referenced this pull request Nov 13, 2026
… level selection

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.

2 participants