Skip to content

Custom-P hierarchy state no longer outlives a change to its solver or mesh (#1019, #1020, #1017, #1012) - #1036

Merged
lmoresi merged 11 commits into
developmentfrom
bugfix/custom-mg-hierarchy-lifecycle
Nov 10, 2026
Merged

lmoresi merged 11 commits into
developmentfrom
bugfix/custom-mg-hierarchy-lifecycle

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

A custom-P hierarchy's state outlived a change to its solver or mesh in four ways. This is bundle A of the issue sweep: one PR for the custom-P lifecycle, fixed together because the four share the install and solve paths.

What changes

#1019: the FAC keys leave the options database. The FAC install wrote its smoother keys (mg_levels_<l>_pc_type composite, the blocks' LU, shift and ordering) into the database, and the standard paths left them there. A later preconditioner = "gamg" on an adapt child read the composite back on a GAMG level with no members: PETSc error 73.

  • The top-level PC sets its levels up inside the solve, so its keys are dropped once a solve has run a linear iteration (custom_mg._release_fac_keys, called at the end of each solve, and forced when the preconditioner changes).
  • The velocity block sets up explicitly, so its keys are dropped at once.
  • A qmd ordering goes on the drop list only where the install wrote it, so a user's ordering stays in place.

#1020: a reinstall frees what it dropped. In parallel petsc4py defers each destroy to a collective garbage_cleanup, and nothing on the standard paths ran one. Each reinstall kept its predecessor's transfers and level objects: +6 entries per reinstall on Poisson and +28 on the Stokes velocity block at np 2. A solve that installed now empties the list at its end (custom_mg._free_after_install), as the rotated path does (#1007).

#1017: a move of the mesh kills the FAC patch (Louis's ruling, 2026-11-08), except a fac_zone patch (2026-11-10, below).

  • A new Mesh._move_version counts committed moves. remesh_with_field_transfer bumps it, so it covers mesh.deform and every mover (smoothing, MMPDE). The trial moves inside ephemeral_coords and a snapshot restore don't count.
  • _mesh_version keeps its meaning, so a snapshot taken before a mover still restores.
  • This is the dedicated counter A swarm proxy stays at the pre-move nodes after a mover: only Mesh.deform bumps _mesh_version #966 proposes; only the FAC patch reads it here.
  • Every install route records the geometry its patch was built on: the standard one and both rotated add_fault_bc routes.
  • The verdict is allreduced. The re-solve installs the hierarchy without the patch, records pc_fallbacks["custom_mg.fac_patch"] (reason unavailable) and warns once.

A fac_zone patch survives a move. Louis, 2026-11-10: "this is mostly about efficiency and I am good with what works but I don't want to compromise accuracy."

  • A zone patch is cut from the masked cells' rows, which a node move leaves in place, and it only preconditions, so a move keeps it.
  • On a split level the move still drops what the coincidence test found, the structural rows outside the zone. That is warned once and recorded.
  • A change of the finest mesh's cells (a repartition, a topology change in place) kills the whole patch, keyed or not. It is read from a checksum of each rank's cell-node table, which a move or a new field leaves unchanged.
  • Hyperion (round 3): no kept patch changed the converged answer at np 1, 2 and 4, including a mask in the wrong place. A stale patch costs only iterations (7-33 against 2-3), because the outer solve converges on the true residual.

The first solve after a move reads the moved fields. The mesh-move transfer wrote the remapped fields without marking the mesh's assembly vector stale. A solver that had solved before a move then assembled its first solve after it with pre-move coefficients: on a zone-viscosity fixture, 6 % in velocity and 80 % in pressure after mesh.deform. #959 (H2) fixes this and merged first; its copy of the mark is the one kept here. test_1151 stays beside #959's test_0766: it covers mesh.deform and a Stokes assembly against a solver built after the move.

#1012: a rebuilt SNES lets its KSPs go. The solver instrumentation hung bound methods of its entries on the KSPs (monitor, post-solve hook, deadline test) while the entries held the KSPs. That cycle runs through a PETSc object, which the collector cannot see. Every discarded SNES kept its KSP tree resident: +3 KSPs and about 23 MB per solve when a Stokes bodyforce is reassigned, in serial too. Releasing an entry now takes its callbacks off (_InstrumentedKSP.detach, ksp_convergence_tests.unregister).

  • Freeing those KSPs exposed a test bug. test_1145's dense-reference helper took a global vector before the tangent switch, which can rebuild the DM. It now takes the vector after the switch, as adjoint_solve does.

#611: the stale np 4 deselect of test_0760 leaves scripts/test.sh. The test passes 6 of 6 at np 4.

Tests

  • tests/test_1149_custom_mg_hierarchy_lifecycle.py (tier B). GAMG after a FAC install on an adapt child, for Poisson and the Stokes velocity block. The FAC keys leave the database and the blocks keep LU. A user's block ordering survives. A deform kills the patch: Poisson, Stokes velocity, and the rotated fault route. A mover kills it too. A snapshot taken before a mover restores. A rebuilt Stokes SNES lets its KSPs go, with and without the guard.
  • tests/parallel/test_1149_custom_mg_reinstall_frees_parallel.py (tier B, min 2 ranks): a reinstall leaves nothing deferred.
  • tests/parallel/test_1152_fac_zone_survives_a_mover_parallel.py (tier B; serial and np 2). After each of 3 MMPDE moves, the kept zone patch matches a fresh registration with the zone recomputed: velocity, pressure and slip to the solver tolerance (1e-8), at no more than one velocity iteration more. Both the plain zone and the zone on a split level are covered.
  • tests/test_1151_first_solve_after_a_mesh_move.py (tier B): the first solve after mesh.deform and after an MMPDE move matches a solver built after the move.
  • test_1149 also covers: a split-level zone keeps its blocks after a deform, and a changed topology kills it; the topology signature follows the cells, not the nodes.
  • Each test fails on development or on the mutant it guards (records below).

Review

Three rounds on hyperion, records on this PR. Round 2 found that the first design, bumping _mesh_version in the mover helper, made a snapshot taken before a mover refuse to restore. It also broke Model.rewind() across a mover step. The design above replaced it.

After round 2, the restore no longer bumps _move_version. Hyperion measured the kill there as never needed for correctness: every solution matched to 1.4e-9. It cost 3 → 6 iterations on the fault fixture and 2 → 15 on a zone patch.

Left open

Underworld development team with AI support from Claude Code

… mesh (#1019, #1020, #1017, #1012)

- #1019: FAC keys leave the options database once a solve has set the levels up
  from them (top-level path: after a solve that ran a linear iteration; velocity
  block: straight after its set-up), and when the preconditioner choice changes.
  A GAMG level read the leftover composite with no members: PETSc error 73. The
  qmd ordering key is dropped only where we wrote it, not a user's own.
- #1020: a solve that installed a hierarchy empties petsc4py's deferred list
  collectively at its end, as the rotated path does (#1007).
- #1017: mesh.deform kills the FAC patch (Louis's ruling, 2026-11-08). The
  re-install runs without it, pc_fallbacks["custom_mg.fac_patch"] records it,
  and a warning says the fault is absent until the hierarchy is registered again.
- #1012: the solver instrumentation's KSP entries take their monitor, post-solve
  hook and deadline test off the KSP on release; the bound methods and the entry's
  KSP made a cycle through the PETSc object, so every discarded SNES kept its KSP
  tree (+23 MB per Stokes solve with bodyforce reassigned, serial too). Root cause
  from H1.
- scripts/test.sh: #611's np 4 deselect removed (H1 verified #611 at np 4).

Tests: test_1149 (serial, tier B) and tests/parallel/test_1149 (np 2, #1020).

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
… mover

H1's review of 03c33e2.

- B1: test_1145's dense-reference helper took a global vector before the
  tangent switch, which can rebuild the DM and SNES. The leak #1012 fixes
  kept the old objects alive; with it fixed the solve read a freed vector
  (segfault in SNESComputeJacobian). The helper now takes the vector after
  the switch and gives it back before undoing it, as adjoint_solve does.
- M1: the rotated routes (add_fault_bc) configure the velocity block in
  rotated_bc and never call install(), the only place the patch's geometry
  was recorded, so a deform there declined the moved patch silently. Every
  install route now records through CustomMGHierarchy._record_installed_patch.
- M2: only mesh.deform moved _mesh_version; the movers that commit through
  remesh_with_field_transfer (smoothing, MMPDE) did not. The bump moves into
  the helper, so swarms and kd-trees also see a smoothed mesh. ephemeral_coords
  and snapshot restore call _deform_mesh directly and still do not bump. The
  kill's verdict is allreduced: the helper's no-move test is rank-local.
- L2: the kill's warning says to register the new levels; the old coarse
  levels registered again get the patch declined at the cover gate.
- L3: tests for the Stokes adapt-child GAMG case and for a user's block
  ordering key; tests for the rotated route and a mover. Each fails on the
  mutant it guards.
- L4: the parallel test_1149 leaves the serial batch (it has min_size 2;
  the MPI phase runs it by glob).
- L1: _release_fac_keys says what a setFromOptions on the FAC smoother does
  after the drop.

Underworld development team with AI support from Claude Code
…apshot restorable

H1's review of bundle A, round 2. d22d225 moved the _mesh_version bump
from mesh.deform into remesh_with_field_transfer so that movers would kill
the FAC patch. Snapshot restore refuses a moved _mesh_version, so a
snapshot taken before smoothing or an MMPDE step became unrestorable,
which development allows (the case #966 records for #959).

_mesh_version is back to development's meaning. A new Mesh._move_version
counts committed moves: remesh_with_field_transfer bumps it (mesh.deform
and every mover), and snapshot restore bumps it when it moved the nodes.
_deform_mesh does not, so the trial moves inside ephemeral_coords do not
count. The kill keys on it (solver._fac_patch_move_version). This is the
dedicated counter #966 proposes; only the patch reads it here.

New test: a snapshot taken before a mover restores (fails if the helper
bumps _mesh_version). Serial: 1057 passed over the bundle files, every
mover and deform test, and every snapshot test.

Underworld development team with AI support from Claude Code
H1's review of bundle A, round 2, item 2. The restore puts the coarse
levels back with the fine mesh, so the patch built before the move applies
exactly again. Killing it there was never needed for correctness (every
solution matched to 1.4e-9) and cost 3 -> 6 iterations on the fault
fixture and 2 -> 15 on a zone patch, with a warning that said "deformed".
Where the coarse levels stay moved, the cover gate declines the patch as
before.

Serial: test_1149, test_1146 and the 25 snapshot files, 358 passed.

Underworld development team with AI support from Claude Code
Copilot AI balanced review requested due to automatic review settings November 10, 2026 08:57

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

Copy link
Copy Markdown
Member Author

Review record, round 1 of 2: 03c33e2

This is the first round, on the branch's first commit. Its merge conditions were answered in d22d225 and cce8112. Round 2 follows in the next comment, with the verdict on the PR head. Paths under runs/ are on hyperion.


Adversarial review: bugfix/custom-mg-hierarchy-lifecycle (bundle A: #1019, #1020, #1017, #1012, #611)

Tip reviewed: 03c33e2, built as wt-bA. It is one commit on development a6eebb6 (wt-sweep).

Probes and logs are in runs/2026-11-10-bundleA/review/:

Housekeeping:

  • We changed nothing in either worktree: git status --short is empty in both. Tests ran from git archive copies: ../t for the branch, base/ for development. Every run set PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider.
  • We pushed, posted and commented nothing, and killed no process.
  • We used at most 24 cores. Other sessions kept the machine at load 50 to 64, so wall times are noisy. Iteration counts, live types and deferred counts are not affected.
  • We did not repeat what H1 already ran: parallel test_1149 at np 2 on both builds, and the Stokes: reassigning bodyforce leaks about 23 MB per solve (28 MB per rank at np 2); Poisson and an updated uw.expression do not #1012 plain_leak.py reproduction.

[read] marks a finding that comes from reading code and has no run behind it.

Verdict

Not ready to merge. There is one blocker (B1) and two medium findings (M1, M2).

What the branch gets right:

What stops it:

Findings

B1 (blocker). test_1145 segfaults on the branch: the #1012 detach exposes a use-after-free in the test helper

What happens. tests/test_1145_stokes_adjoint_keeps_custom_mg.py::…[powerlaw_picard_matrix_route] stops at np 1 with "Fatal Python error: Segmentation fault".

  • It crashed in every branch run that keeps the detach: the serial batch, and 6 of the 8 mutation runs.
  • Development passes the file: 5 passed.
  • The branch also passes with the detach undone (m1012): 5 passed.
  • Logs: logs/T-bA-np1-test_1145*-r0.log, logs/M-*-np1-test_1145*.log, logs/K-*.

Which part of the detach. We ran the one test id under each mutation (rk.sh):

mutation result
none, m1017, m1019top, m1019vel, m1020 segfault
m1012 (detach a no-op) passes
m1012nullonly (detach only sets self.ksp = None) segfault

So the crash comes from the old KSP being freed, not from taking the callbacks off.

Backtrace (gdb, logs/gdb1145.log): SNESComputeJacobian → PetscObjectCompose → PetscObjectListAdd → PetscObjectDereference → VecDestroy_Seq. It is reached from the computeJacobian in SNES_Stokes_SaddlePt.adjoint_solve.

Cause. _dense_adjoint_error (test_1145:131-147) does three things in this order:

  1. It takes gvec = stokes.dm.getGlobalVec().
  2. It calls _consistent_tangent_for_adjoint(). Its rewire hands back a new DM and SNES, as its docstring says.
  3. It runs computeJacobian(gvec, …) and restoreGlobalVec(gvec) against the new DM.

Before the fix, the leak kept the old SNES and its objects alive, so the stray reference stayed valid. Now they are freed.

Evidence for the fix. With getGlobalVec moved after the tangent switch, the file passes on the branch: 5 passed in 246 s (fix1145/, logs/F-bA-1145fixed.log).

Production is not affected. A user-level sequence ran clean on both builds (p1145.py, logs/U-*): a Picard forward on the matrix route, three adjoint_solve calls, another forward, another adjoint_solve. adjoint_solve itself takes its vector after the switch [read].

Fix: reorder the helper.

M1 (medium). The #1017 kill does not reach the rotated (fault-BC) path

The rotated route builds through build_transfers and calls _configure_pcmg itself (rotated_bc.py:2192, 2701, 2897). It never calls CustomMGHierarchy.install, which is the only place _fac_patch_mesh_version is recorded. So _fac_patch_killed always answers False there [read].

Measured with p17.py deform (stokes_rotated uses add_fault_bc):

path np branch after deform base after deform
poisson 1, 2, 3, 4 killed: sor, warned once, pc_fallbacks "unavailable", its 3 → 5 silent decline (gate False), 3 → 5
stokes_plain 1, 2, 3, 4 killed, warned, recorded, 4 → 7 silent decline, 4 → 7
stokes_rotated 1, 2, 3, 4 silent decline: gate False, no warning, no record, 3 → 5 (np 1) or 3 → 6 (np 2-4) the same

The ruling says: "Neither a stale patch nor a silent decline by the cover gate." A fault that slips takes the rotated path. The new guide text in fault-multigrid.md is also wrong for this path. It says that after mesh.deform the hierarchy is installed again without the patch and pc_fallbacks[...] says so.

Fix:

  • Record the version where the patch rows are made, in build(), which both routes call. Recording it in the rotated configure also works.
  • Parametrise test_1149's deform test with an add_fault_bc case.

M2 (medium). The kill's key covers too few moves and too many patches

(a) Mesh movers do not trigger the kill.

  • mesh.deform bumps _mesh_version (discretisation_mesh.py:4342). remesh_with_field_transfer, which every mover in meshing/smoothing/api.py goes through, does not.
  • We moved the mesh with smooth_mesh_interior(..., method="spring"); the largest node move was 0.0143. Result on all three paths, np 1 and 2, both builds:
    • the gate declines, the solve runs sor, and there is no warning and no record;
    • iterations rise 3 → 4 (Poisson), 4 → 7 (Stokes), [3] → [5] (rotated).
  • This is H2's MMPDE route.
  • Keying on _geometry_version instead would kill when nothing moved. Both nuke_coords_and_rebuild and an ephemeral_coords round trip bump it, and both leave the patch valid: composite is kept on both builds.
  • Suggest bumping _mesh_version in remesh_with_field_transfer when nodes moved. An allreduced coordinate checksum would also work.

(b) A fac_zone patch is killed although it still works.

  • Fixture: a painted band on an unsplit box (p17.py zone_deform).
  • On development, after the same deform, the zone patch stays composite at 1 iteration (np 1).
  • On the branch it is killed: sor, 2 iterations, warning and record.
  • Zone blocks are keyed on cells, not on coordinate coincidence [read]. The ruling was worded about the fault patch.
  • Either take a ruling that zone patches die too, or exempt zone-keyed blocks and kill only the structural rows.

L1 (low). setFromOptions on the FAC level's own smoother now loses the composite

Of the 246 states compared (cmp.py), all 16 that differ come from one event: an explicit KSPSetFromOptions on the level-2 smoother (pr.py sfo, sfo_lvl).

  • On the branch the level then reads the generic mg_levels_pc_type sor, and composite becomes sor: Poisson 3 → 5 iterations, Stokes velocity 4 → 7, at np 1 and 2.
  • Development keeps composite.

These events keep the composite on both builds:

  • setFromOptions on the SNES, the outer KSP, the velocity sub-KSP and the managed PCMG;
  • a user option change and a tolerance change;
  • _force_setup, is_setup=False, pc.reset(), and a reset of the level PC alone;
  • an adjoint solve, estimate_difficulty, and continuation with picard=2.

No library code calls setFromOptions on a level smoother [read]. The only getMGSmoother uses are custom_mg.py:1616, 1704 and rotated_bc.py:2726. The rotated path has carried this exposure since #892. One line in _release_fac_keys's docstring would cover it.

L2 (low). Following the warning's advice with the same levels gives a silent decline and erases the record

  • After a kill, the warning says to register again. set_custom_fmg(s, levels) with the original coarse levels lets the gate decline (False). The solve runs sor at 5 / 7 / [5] iterations with no warning, and pc_fallbacks["custom_mg.fac_patch"] is gone.
  • Re-registering after moving every level by the same map does restore composite, at 3 / 4 / [3] iterations.
  • The warning and the guide should say that the coarse levels must be rebuilt from the moved fault. A gate decline right after a re-registration on a killed solver should keep a record.
  • [read]: solver._fac_patch_killed is reset only by set_custom_fmg. An auto-picked adapt-child hierarchy stays killed for the rest of that solver's life.
  • Nit: the method CustomMGHierarchy._fac_patch_killed and the solver flag _fac_patch_killed share a name.

L3 (low). Two of the five changes have no test that fails without them

Mutation matrix: each row undoes one change by in-process monkeypatch (mutplug.py, branch build). "segfault" is B1.

mutation (one change undone) test_1149 np 1 test_1149 np 2 parallel test_1149 np 2 test_1146 np 1 test_1090 np 2 test_1145 np 1
none 6 passed 6 passed 2 passed 4 passed 8 passed segfault
m1019top (top-level drop and setter drop) 2 failed 2 failed passed passed passed segfault
m1019vel (velocity-block drop) passed passed passed passed passed segfault
m1019qmd (ordering key always dropped) passed passed passed passed passed segfault
m1020 (no collective free) passed passed 2 failed passed passed segfault
m1017 (no kill) 2 failed 2 failed passed passed passed segfault
m1012 (detach a no-op) 2 failed 2 failed passed passed passed 5 passed
m1012guard (callbacks off, test left registered) passed passed passed passed passed segfault
  • m1019vel brings preconditioner = "gamg" on an adapt child with a FAC level fails with PETSc error 73: GAMG reads the leftover FAC composite key #1019 back on Stokes. Under it, probe_1015 pcchange adapt_stokes gives error 73 twice, then 56, at np 1 and 2 (logs/bA-np*-mutwrap-*). test_1149's GAMG case is Poisson only; add the Stokes adapt child.
  • m1019qmd deletes a user's ordering key. A user's …sub_1_sub_pc_factor_mat_ordering_type nd is gone after the first solve, and the next rebuild silently runs qmd (logs/MU-m1019qmd-*). The branch keeps the user's nd through solves and rebuilds on Poisson and on the velocity block. Add a test line with a user key.
  • m1012guard is not a gap. Once the entry has let its KSP go, the registered test pins nothing, so unregistering it is hygiene.

L4 (nit). test.sh runs the parallel test_1149 in the serial batch, where it skips

Residual of #1012 (not a merge condition)

  • Deleting a solver still keeps its KSPs: +3 live KSPs per deleted Stokes solver, on both builds, at np 1 and 2 (p12.py delete).
  • Calling release() before del brings this to 0 on the branch. So it is the cycle this fix breaks; nothing calls release() when a solver is deleted. weakref.finalize(solver, inst.release) would close it.
  • RSS grows +4.6 MB per deleted solver with or without the release. At this size the KSP tree is not the main cost, and the rest is outside this change.

Attacks that failed (numbers)

Attack 1: reconfiguration after the drop.

  • These events left the live level types, block PC/ordering, LU fill and iterations equal to development at np 1 and 2:

    • an adjoint solve on the Poisson kernel route, and on Stokes with Stokes adjoint_solve drops the custom-FMG velocity hierarchy and its FAC patch: one-level mg, 29 iterations against the forward's 4 #1016's re-inject (velocity 4 → 5 iterations in the adjoint on both builds);
    • estimate_difficulty, which reaches its cap with reason −5 on the visco-plastic case on both builds;
    • continuation with picard=2: 3 SNES iterations and 4 velocity iterations on both builds;
    • setFromOptions on the SNES, the outer KSP, the velocity KSP and the PCMG;
    • a user ksp_rtol change and a snes_type change;
    • _force_setup, is_setup=False and pc.reset();
    • a tolerance change on the standard and rotated paths (1e-8 then 1e-6);
    • a warm re-solve that converged at 0 linear iterations.
  • FAC fill, all lu/qmd and equal on both builds:

    path np 1 np 2
    Poisson 3101 3076
    Stokes velocity block 12404 12301
    rotated 15788 16181
  • FAC keys left in the database after a solve: 0 on the branch, 4 on development. The rotated path was already 0 on both.

  • estimate_difficulty refuses on the rotated path on both builds, by design.

  • probe_fac (45 states, np 1, 2 and 4) is identical to development in iterations, v_rms and block kinds:

    fixture iterations
    Poisson 3
    stokes_plain (velocity) 4
    stokes_rotated [3]
    sheet_rotated [2]
    zone_split [4] at np 1 and 2, [5] at np 4
    zone_struct [3]

Attack 2: collective safety of _free_after_install.

  • p20.py at np 2, 3 and 4 ran five scenarios:
    • a coarsest level with empty ranks (cells per rank [0,2], [0,2,0], [0,0,0,2]);
    • a reinstall whose solve diverges and is retried;
    • the guard firing in every reinstall solve;
    • an exception injected on every rank after the install;
    • two solvers, of which only one reinstalls.
  • No hang: 15 of 15 runs exited 0. The installed flag agreed on every rank at every step.
  • Deferred entries after each step on the branch were 0 throughout. The one exception is a raised solve, which keeps 6 / 9 / 12 entries (np 2 / 3 / 4) until the next solve frees them.
  • On base, at np 4, the same runs grow: empty-rank 12 → 76, guard 72 → 296, two-solver 32 → 56.
  • The verdict is rank-uniform by construction [read]:
  • Deform cycles (probe_1015 cycles, np 2, 10 cycles):
    • Poisson: the branch stays at 2 deferred entries, with RSS +0.4 MB in total. Base adds +14 entries and +2.4 MB per cycle.
    • Stokes: the branch stays at 2 entries and RSS is flat at 409.4 MB.

Attack 3: the #1017 kill.

  • The kill is rank-uniform at np 2, 3 and 4: the killed flag, the live smoother and the warning count are identical on every rank.
  • The warning fires once per kill: 1 on the first post-deform solve, 0 afterwards. A second deform does not warn again, and the record stays.
  • A zero-displacement deform, an ephemeral_coords round trip and nuke_coords_and_rebuild do not kill, and the patch stays valid (composite, 3 / 4 / [3]).
  • Iterations after the kill equal development's after its silent decline: 5 / 7.

Attack 4: the #1012 detach.

  • Rebuilds tried at np 1 and 2: a reassigned bodyforce, mesh.deform, a flipped preconditioner (the setter's _build calls release), and an adjoint solve (its kernel rewire releases).
  • Live KSPs stay at 3 per rank, and at 0 after the adjoint. Development adds 3 per rebuild.
  • Sub-reports still count on the new SNES: velocity 143 / 166 iterations and pressure 11 / 13, at np 1 / 2.
  • With guard(1e-9) armed and bodyforce reassigned 6 times, the deadline fired on every rebuilt SNES (reason −3, deadline_expired True), with 3 live KSPs throughout.
  • A user monitor on the live outer KSP keeps firing: begin_solve detaches only when the outer handle changes.
  • Each sub-KSP entry unregisters its own test [read].

Attack 5: regressions.

  • Serial, 34 files: adjoint 0018-0022, 0052, 0203, 0753, 0847, 1014-1022, 1068, 1077, 1087, 1096, 1111, 1113, 1115, 1131, 1134, 1142, 1145, 1146 and 1149. Counts are identical on both builds, except test_1145 (B1).
  • test_0052 fails in the archive copy because it needs src/. With src/ present (s0052/) it gives 5 passed on both builds.
  • Parallel np 2, identical on both builds: 0078, 1017, 1064, 1089, 1090, 1095, 1106, 1108, 1114, 1133, 1134, 1135, 1144, 1147. 1149 runs on the branch only.
  • np 3: 1139 gives 9 passed on both builds.
  • np 4 on the branch: the same 15 files all pass. 1103 gives 3 passed, as it does on development.
  • test_0760 at np 4 on the branch, without the deselect: 4 passed in each of 6 repeats.

#1019 itself (probe_1015 pcchange, adapt children):

  • Development: GAMG gives error 73, 73, then 56, for Poisson and Stokes at np 1 and 2.
  • Branch: GAMG converges (Poisson 4 iterations, Stokes 18 velocity iterations), and auto restores composite at 2 / 2.

The ordering key. A user's nd survives solves and rebuilds on Poisson and the velocity block, on both builds. On the rotated path, on both builds, the solve runs qmd although the key is set, because the key does not reach that path's prefix. That predates this branch.

Merge conditions

  • B1: reorder _dense_adjoint_error in test_1145 so it takes the global vector after _consistent_tangent_for_adjoint, then rerun test_1145.
  • M1: make the kill reach the rotated route and add an add_fault_bc case to test_1149. The alternative is to narrow the claim and keep After mesh.deform the FAC patch is declined: the custom-P coarse levels do not move with the fine mesh #1017 open for the rotated path.
  • M2: bump _mesh_version in remesh_with_field_transfer, or key the kill on the coordinates. Settle the fac_zone case, by a ruling or by exempting zone-keyed blocks.
  • L3: add a Stokes adapt-child GAMG case, which catches m1019vel, and a user ordering-key line, which catches m1019qmd.
  • Nice to have: the L1 docstring line, the L2 warning text, the L4 test.sh line.

Issue adjudication

issue verdict
#1019 Fixed by this branch, for Poisson and Stokes. The Stokes half needs the L3 test.
#1020 Fixed by this branch.
#1012 Fixed for rebuilds. Still live for solver deletion: +3 KSPs per deleted solver.
#1017 Fixed for mesh.deform on the standard paths. Still live on the rotated path and for mesh movers (M1, M2).
#611 Fixed: 6/6 at np 4.

What we could not test

  • 3-D fixtures, and the add-on hierarchy (set_custom_fmg after an add-on partition) after a deform.
  • An exception raised on only one rank. That hangs either way, and we did not try to construct one.
  • follow_metric and node_redistribution with a metric. We moved the mesh only with smooth_mesh_interior(method="spring"). All movers share remesh_with_field_transfer [read].
  • The 23 MB/solve Stokes: reassigning bodyforce leaks about 23 MB per solve (28 MB per rank at np 2); Poisson and an updated uw.expression do not #1012 annulus case. H1 ran it; we counted live KSPs on a box instead.
  • PETSc source, to see which PCSetUp paths call KSPSetFromOptions on MG levels: it is not installed. L1 rests on the measured events only.
  • The scripts/test.sh sharding itself, which we were not allowed to run.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Review record, round 2 of 2: cce8112, with the verdict on the PR head 09a6105

Verdict on 09a6105: ready to merge, with no merge condition. 09a6105 is cce8112 plus one change: snapshot restore no longer bumps _move_version. That is follow-up F2 below, taken.

Rebuilt and re-run on 09a6105:

  • test_1149, test_1146 and test_1145: 20 passed at np 1; 16 passed and 4 skipped at np 2.
  • Parallel test_1149: 2 passed at np 2.

Trade-off of dropping the restore bump (not a merge condition). Take a snapshot that does not hold the coarse levels, for example levels re-refined from the moved fault after it was taken (the stay rows in section 3). A restore then leaves the fault patch to be declined at the cover gate silently: 6 SOR iterations against 3, the same answer, and no warning or record. That is round 1's M2 failure mode, in this corner only. The zone patch keeps working there: 2 iterations against 15 when killed. The sharper key in F2 would cover it, if anyone needs that case.

F1 (the one-rank-mover hang) is now on #960, and F3 (stale caches after a mover) on #966, as the PR body says.


Adversarial review, round 2: bugfix/custom-mg-hierarchy-lifecycle

Verdict for cce8112: ready to merge. No merge conditions remain. Four follow-ups are listed at the end; none blocks the merge.

  • Tips reviewed:
  • Base: development a6eebb6 (wt-sweep).
  • Round-1 record: ../review/bundleA-review.md (tip 03c33e2).

Probes and logs are in runs/2026-11-10-bundleA/review2/:

  • p2.py traces the kill on every rank. Per rank it logs:
    • the patch rows recorded;
    • the rank-local "moved" verdict and the collective verdict;
    • warnings, the finest smoother and the fallback record;
    • (_mesh_version, _move_version).
  • p2.py fixtures and events:
    • paths: poisson, stokes_plain, stokes_rotated and sheet_rotated. stokes_rotated is the saddle route with add_fault_bc. sheet_rotated is ThinSheet with add_fault_bc, which takes the velocity-only _solve_rotated_vector route.
    • events:
      • deform;
      • smooth: spring;
      • mmpde: redistribute_nodes;
      • deform0;
      • onerank: nodes move on one rank only;
      • bumpone: the version moves on one rank only.
    • trace corner: a short fault, so one rank owns every patch row.
  • p3.py: what the counter change does to snapshot restore, rewind, the variable kd-tree and swarm migration.
  • p4.py: the fac_zone probe. p4_flat.py was a first version that could not tell the cases apart.
  • p5.py: the author's case (priority 4).
  • Mutations: mutplug.py, with rtm.sh (d22d225) and rtm2.sh (cce8112).
  • Runners: rt.sh, run2.sh and sched.py (24-core budget). s2.py summarises.
  • Test trees:
    • t/: git archive d22d2255 tests;
    • t2/: git archive cce81128 tests;
    • base tests: round 1's ../review/base/.
  • Logs: in logs/, prefixed bA2- for cce8112, bA- for d22d225 and sweep- for base.

Housekeeping:

  • Worktrees untouched: git status --short is empty in wt-bA, wt-bA2 and wt-sweep.
  • Run hygiene: every run used PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider, and at most 24 cores.
  • Nothing published: nothing was pushed, posted or commented.
  • Kills: I killed four of my own shell wait-loops by PID. mpi_supervisor stopped the hung probes (silence 400 s).

[read] marks a claim that comes from reading code and has no run behind it.

1. Snapshot after a mover, and after mesh.deform (priorities 1 and 2)

Probe: p3.py snap, a box with one P2 field T = x. After the move T is overwritten with 7, then load_state is called.

build move np load_state coords and T back _mesh_version after the move
base a6eebb6 spring smooth 1, 2 restored yes, yes 0
base MMPDE 1 restored yes, yes 0
base mesh.deform 1 refused (SnapshotInvalidatedError) - 1
d22d225 spring 1, 2 refused - 1
d22d225 MMPDE 1 refused - 1
d22d225 mesh.deform 1 refused - 1
cce8112 spring 1, 2 restored yes, yes 0
cce8112 MMPDE 1 restored yes, yes 0
cce8112 mesh.deform 1 refused, unchanged from base - 1
  • Rewind over a step that runs a mover. p3.py rewind: two steps under record_every = 1, the move in the second, then model.rewind().

    • Base and cce8112 rewind to step 1 for spring and MMPDE, with the coordinates back. Spring was checked at np 1 and 2 on cce8112.
    • d22d225 refused.
    • With mesh.deform every build refuses.
  • Snapshot restore: split geometry vs topology mesh version (deform should not invalidate) #296 is still live for mesh.deform, as expected.

  • The other counters do not separate the cases. _topology_version and _geometry_version move on every move on every build (0 → 3 under one spring smooth), so neither tells a mover from an adapt.

  • The d22d225 regression is gone. On that tip I had recorded it as N1: a snapshot taken before a mover could not be restored, and rewind refused across a mover step. cce8112 behaves like base. The new test test_a_mover_leaves_a_snapshot_restorable catches d22d225's coupling: the mutant m2snap (a committed move also bumps _mesh_version) fails it at np 1 and 2.

  • No code path restores a snapshot after a mover on purpose. The grep covered src/, docs/, examples/ and hyperion-work/campaigns (uw3-campaigns). Two generic paths do it implicitly:

    • Model.rewind() (model.py:1633);
    • TranscriptAdjoint (adjoint.py:559, :647) [read].

    No meshing, systems or utilities module calls save_state or load_state. The campaigns' ve_cylinder.py uses snapshots on a mesh that does not move.

  • A new interaction with Snapshot restore: split geometry vs topology mesh version (deform should not invalidate) #296. The author's case builds the patch, takes a snapshot, runs a mover, re-registers on the moved mesh, then restores. If the coarse levels are moved with mesh.deform, which is the obvious way to move them, the restore is refused: those level meshes are registered on the model and their _mesh_version moved. Measured in p5.py fault kill, the first version, at np 1. Moved with a mover-style commit, they restore (below). That is Snapshot restore: split geometry vs topology mesh version (deform should not invalidate) #296, not this branch.

2. The kill on _move_version (priority 3)

p2.py on cce8112. In every row, every rank gave a collective verdict of True, warned once, switched to sor and recorded unavailable, with no hang. Iterations are the velocity block's for Stokes and ksp for the sheet.

path event np 1 np 2 np 4 (mesh, move) versions after
Poisson mesh.deform 3 → 5 3 → 5 3 → 5 (1, 1)
Poisson spring smooth 3 → 4 3 → 4 3 → 4 (0, 1)
Poisson MMPDE 3 → 5 3 → 6 3 → 5 (0, 1)
Stokes velocity mesh.deform 4 → 7 4 → 7 4 → 7 (1, 1)
Stokes velocity spring 4 → 7 4 → 7 4 → 7 (0, 1)
Stokes velocity MMPDE 4 → 8 4 → 9 4 → 9 (0, 1)
add_fault_bc, saddle route mesh.deform [3] → [5] [3] → [6] [3] → [6] (1, 1)
add_fault_bc, saddle route, corner fault mesh.deform - [2] → [5] [2] → [5] (1, 1)
add_fault_bc, saddle route spring [3] → [5] [3] → [5] [3] → [5] (0, 1)
add_fault_bc, saddle route MMPDE [3] → [6] [3] → [7] [3] → [7] (0, 1)
add_fault_bc, velocity-only route (ThinSheet) mesh.deform [2] → [4] [2] → [4] [2] → [4] (1, 1)
add_fault_bc, velocity-only route (ThinSheet) spring [2] → [4] [2] → [4] [2] → [4] (0, 1)

The largest node moves were: deform 0.0100, spring 0.0143, MMPDE 0.025-0.026.

  • No-kill controls (p17.py, np 1 and 2): ephemeral_coords round trip, nuke_coords_and_rebuild and zero-displacement deform. Each keeps composite at 3 iterations with no warning. deform0 on the rotated route also keeps composite.

  • A rank with no patch rows. Every fixture has one: with the mid fault at np 2 and 4, and with the corner fault, every patch row is on one rank. The others record empty arrays, not None, so the "has a patch" allreduce agrees on every rank. Every rank recorded the version at 0, and every rank killed.

  • The version moves on one rank only (bumpone: _move_version += 1 on the last rank). The local verdicts were [0, 1] at np 2 and [0, 0, 0, 1] at np 4. The collective verdict was True on every rank for all four paths, each rank warned once and recorded, and nothing hung. This is the only way I could reach the allreduce.

  • A mover that moves only one rank's nodes hangs, on every build. The setup moved interior nodes of the last rank that appear in no other rank's local coordinates: 168 nodes at np 2 (Poisson) and 66 at np 4 (rotated, corner fault). It hangs on cce8112, on d22d225 (12 of 12 runs) and on base (Poisson at np 2). See F1. It hangs before any solve, so the kill is never reached.

  • The rest of cce8112's tip matches d22d225:

    • the kill on the rotated route (round-1 M1);
    • the kill after a mover (round-1 M2a);
    • zone patches killed universally (M2b, by ruling);
    • the L1-L4 changes.

    The only difference is the counter that is read.

3. The author's case: patch, snapshot, mover, re-register, restore (priority 4)

The author's claim: "the restore bumps _move_version, so the next solve kills the re-registered patch; conservative and intended".

Probe: p5.py. Each solve starts from u = 0 at tolerance 1e-8. I compared the solution after the restore with the first solve on the same geometry. There are two fixtures:

  • fault: pr.py's Poisson with a fault, spring smooth with the fault pinned;
  • zone: p4's weak band, contrast 1e-4.

Sequence:

  1. Build and solve.
  2. Take a snapshot.
  3. Run the spring mover. The kill fires.
  4. Move the coarse levels to match the fine mesh, using a mover-style commit, then re-register.
  5. Restore the snapshot. Fine mesh and coarse levels come back exactly, and _move_version goes 1 → 2.
  6. Apply one of four variants.

Variants after the restore:

  • kill: solve as is.
  • keep: the kill bypassed by hand.
  • rereg0: register the levels again.
  • fresh0: a new solver.

Level handling:

  • inplace: the coarse levels are in the snapshot, so they come back too.
  • stay: the coarse levels are put back on the moved geometry, as levels re-refined after the snapshot would be.

Results. Linear iterations and finest smoother, identical at np 1 and np 2 except where shown as np 1 / np 2. The kill row also warns and records.

fixture, levels 1 built 2 after mover (killed) 3 re-registered on the moved mesh after restore: kill keep rereg0 fresh0 base (no kill)
fault, inplace 3 comp (gate 117) 5 sor 3 comp (gate 89) 6 sor 3 comp (gate 117) 3 comp 3 comp 3 comp
fault, stay 3 5 sor 3 6 sor 6 sor (silent decline) 6 sor (silent) 6 sor (silent) 6 sor (silent)
zone, inplace 2 comp 14 / 16 sor 2 comp 15 / 16 sor 2 comp 2 2 2 (base never killed)
zone, stay 2 14 / 16 sor 2 14 / 16 sor 2 comp 2 2 2

The solution is right in every case. The largest difference from the first solve was ≤ 1.4e-9 at np 1 and ≤ 4.6e-10 at np 2. With the levels restored (inplace), keep, rereg0 and fresh0 match it bit for bit.

Reading:

  • With the levels restored, which is the normal case, the kill only costs speed.
    • The re-registered hierarchy holds the same level meshes, and they are back at the original geometry.
    • Its rebuild produces exactly the original patch: gate subdomain rows 117, the same as at step 1, not the 89 of the moved mesh. That gives 3 / 2 iterations, the same as the original registration, and an identical solution.
    • So the original registration's patch is what applies, and the re-registered hierarchy reproduces it.
    • The kill costs 3 → 6 iterations on the fault fixture and 2 → 15-16 on the zone fixture. It also warns that the mesh "was deformed after its FAC patch was built", which is untrue after a restore to the original geometry.
  • With the levels left on the moved geometry, the kill gives a warning, not a different result.
    • Without the kill, the fault patch is declined at the cover gate: 6 sor, silently. That is round 1's M2 failure mode.
    • The kill gives the same 6 sor, with a warning and a record.
    • The zone patch, which is keyed on cells, still works with mismatched levels: 2 composite against 14-16 when killed.
  • So the kill is never needed for correctness here. It is conservative, as the author says, but at an efficiency cost of 2× on the fault fixture and 7-8× on the zone fixture. When the levels come back with the fine mesh, it is also wrong on the facts.
  • A sharper key is possible (follow-up, not a merge condition). The kill could fire only when the finest mesh moved relative to its coarse levels. For example: record every level's _move_version at install, and kill when the finest moved and some coarse level did not. That keeps the kill for stay and skips it for inplace.
  • The restore bump is untested. The mutant m2restore (restore does not bump _move_version) passes all of test_1149. From the table, its only effect is the stay case: a silent decline at the cover gate in place of a recorded kill.

4. The fac_zone probe (priority 5; evidence for the ruling, not a merge condition)

Fixture (p4.py):

  • an unsplit box, cellSize 1/8, refinement 1, 648 cells;
  • Poisson, tolerance 1e-8;
  • diffusivity 1e-4 in a band fixed in space, 1 elsewhere;
  • fac_zone = the 36 cells whose centroids lie in the band.

Moves: k MMPDE moves (redistribute_nodes, n_outer = 2, density concentrated on the band) or 6 spring moves.

What was measured:

  • the solver registered once: on base its patch survives; on cce8112 and d22d225 it is killed;
  • after the last move, three fresh registrations with the coarse levels moved to match (0 unmatched vertices in every run): the zone recomputed from the moved centroids, the old cell mask, and no zone.

Results. Linear iterations, each solve from u = 0. The cce8112 numbers are the same as d22d225's to within one iteration.

move np max node move base: surviving patch cce8112: killed fresh, zone recomputed (cells / patch rows) fresh, old zone fresh, no zone
none 1, 2, 4 0 2 (215 rows) 2 - - -
MMPDE ×1 1 / 2 / 4 0.024 3 / 3 / 3 17 / 22 / 26 2 / 2 / 2 (48 / 247) 2 / 3 / 2 16 / 13 / 18
MMPDE ×3 1 / 2 / 4 0.045 3 at every move 17 / 22 / 25-28 2 / 2 / 2 (59 / 270) 2 / 2 / 2 18 / 19 / 21
MMPDE ×6 1 / 2 / 4 0.052-0.054 3 at every move 17-18 / 21-24 / 24-28 2 / 3 / 2 (63-64 / 278-285) 3 / 3 / 3 16 / 22 / 21
spring ×6 1 / 2 / 4 0.023 2 at every move 14-15 / 16 / 17-18 2 / 2 / 2 (37 / 215) 2 / 2 / 2 14 / 19 / 21
  • The surviving zone patch stays correct and efficient. On base it holds 2-3 iterations through six moves at np 1, 2 and 4, against 2-3 for a fresh registration.
  • It degrades by at most one iteration. It goes 2 → 3 once MMPDE has concentrated nodes on the band, so the band now covers 48-64 cells against the original 36 (35-36 of the original cells remain in it). It gets no worse with more moves.
  • The universal kill costs 14-28 iterations, 6-12× more. That is worse than a fresh registration with no zone at all (13-22).
  • The partition does not move. Movers do not repartition, so the partition stays the one taken at construction.
  • Limits: one 2-D Poisson fixture, one band, one contrast.
  • The evidence favours exempting zone-keyed blocks from the kill, as a follow-up for Louis's ruling.

5. Tests and mutations

Tests on cce8112:

file np 1 np 2 np 4
test_1149 (11 tests) 11 passed 11 passed -
parallel test_1149 - 2 passed 2 passed
test_1146 4 passed 4 passed -
test_1145 5 passed (344 s), no segfault 1 passed, 4 skipped -

d22d225 gave the same results; its test_1149 has 10 tests.

Mutation matrix on cce8112 (cce8112 tests, in-process monkeypatch, one change undone per row):

mutation what it undoes test_1149 np 1 test_1149 np 2 other caught by
none - 11 passed - parallel np 2: 2 passed -
m1019top top-level key drop 3 failed - - gamg[poisson], fac_keys_leave…, user_block_ordering
m1019vel velocity-block key drop 1 failed 1 failed - gamg[stokes_velocity]
m1019qmd ordering key always dropped 1 failed 1 failed - user_block_ordering_survives_the_drop
m1020 collective free 11 passed - parallel np 2: 2 failed parallel reinstall test
m1017 the kill 4 failed - - both deform cases, rotated, mover
m1017rot rotated-route record 1 failed 1 failed - rotated fault route
m2mover movers do not bump _move_version 1 failed 1 failed - mover kills the patch too
m2snap a move also bumps _mesh_version (d22d225) 1 failed 1 failed - mover leaves a snapshot restorable
m2restore restore does not bump _move_version 11 passed - - not caught
m1012 the #1012 detach 2 failed - test_1145: 5 passed rebuilt_stokes_snes[gauge, guard_armed]
m1012nullonly - - - test_1145: 5 passed (B1 is gone)

Round-1 findings:

finding status
B1 fixed
M1 fixed: the saddle and the velocity-only rotated routes, np 1, 2 and 4
M2a fixed
M2b ruled: zone patches killed universally
L3 fixed: Stokes adapt-child GAMG case, user ordering key
L4 fixed: parallel test_1149 is out of the serial batch, and gives 2 passed at np 2 and 4

Regression suites, cce8112 against base. 62 serial files and 23 np-2 files, run one by one: every swarm test, the mover and MMPDE tests (0750, 0751, 0762, 0764, 0773, 0850, 0855×2, 0861), and the snapshot, transcript and restart tests (0007-0014, 0020×3, 0060, 0077, 0140, 1060, 1063, 1074), plus the parallel snapshot, swarm and smoothing files.

  • Serial: 640 passed, 10 xfailed and 4 skipped on all three builds.
  • np 2: 101 passed, 5 skipped, 1 failed and 1 error, the same on all three builds, file by file.
    • The failure is the serial test_0764 run at np 2, which stops at PetscGarbageKeySortedIntersect … too big for PetscInt on every build.
    • The error is ptest_000d, which errors on every build. The ptest_* files are not collected by pytest.

Follow-ups (none blocks the merge)

  • F1 (pre-existing): a move that leaves some rank's local coordinates unchanged hangs.
    • Cause: _remesh_with_field_transfer_impl decides "moved" per rank (remesh.py:378-383). A rank whose local coordinates did not change returns False. The ranks that moved go on into remap_var_set, whose deform-back calls the collective _deform_mesh.
    • gdb at np 2: the moving rank is in UW_DMPlexCreateCoordinateSpaceWithinPlex → DMGetCoordinates → MPI_Allreduce, while the other has returned.
    • It hangs on base too.
    • Fix: allreduce moved before the early return. That also makes _move_version rank-uniform by construction, and the docstring's "a version could move on some ranks only" then describes a hang that no longer happens.
    • A real trigger would be a pass in which one rank's nodes are all pinned or all below the skip threshold [read]; I did not construct one.
  • F2 (the author's case): when the levels come back with the fine mesh, the restore bump kills a valid patch.
    • Cost: 3 → 6 iterations (fault) and 2 → 15-16 (zone).
    • The warning says "deformed", which is untrue after a restore.
    • Suggestion: key the kill on the finest mesh moving relative to its coarse levels.
    • Add a test for the restore bump; m2restore is uncaught.
  • F3 (pre-existing on base; cce8112 brings it back): caches stay stale after a mover.
    • After a mover the variable kd-tree is not rebuilt. The largest query miss on the moved DOFs is 1.3e-4 (spring) and 8.8e-4 (MMPDE).
    • Swarms are not migrated at the next solve entry: 0 migrate calls.
    • Measured on base and on cce8112 at np 1 and 2.
    • d22d225 fixed both by bumping _mesh_version and so broke the snapshots. cce8112 reverts both.
    • These consumers could read _move_version instead, which the snapshot does not check [read]. Candidates: variable and domain kd-trees, the swarm solve-entry sync, the proxy cache, and the cell projectors. That would fix them without touching restore.
  • F4 (fac_zone): exempt zone-keyed blocks from the kill. The evidence is in section 4.

What could not be tested

  • The kill's allreduce through a real rank-asymmetric mover: that hangs first (F1). It was exercised only through an injected per-rank bump, and no mutant of it was run.
  • TranscriptAdjoint over a mover run [read]; only rewind was run.
  • follow_metric and node_redistribution with a metric, beyond redistribute_nodes (MMPDE) and spring.
  • 3-D; the add-on hierarchy after a mover; a structural fault patch through several MMPDE moves.
  • The author's case with levels re-refined from the moved fault. stay stands in for levels the snapshot does not hold.
  • scripts/test.sh itself, which I was not allowed to run.

Underworld development team with AI support from Claude Code

… the moved fields

Louis, 2026-11-10: "this is mostly about efficiency and I am good with what
works but I don't want to compromise accuracy."

The zone exemption (#1017). A fac_zone patch is cut from the masked cells'
rows, which a node move leaves in place, and only preconditions, so a move
keeps it. On a split level the move still drops what the coincidence test
found, the structural rows outside the zone (warned once, recorded). A
change of the finest mesh's cells (a repartition, a topology change in
place), read from a checksum of the rank's cell-node table, kills the whole
patch, keyed or not. tests/parallel/test_1152: after each of 3 MMPDE moves
the kept patch matches a fresh registration with the zone recomputed in
velocity (2e-8), pressure (8e-7) and slip (5e-7) at the same velocity
iterations (6 and 6; 13 and 13 on the split level); a stale or killed zone
patch takes 12 and 15 and fails. test_1149: the split-level zone keeps its
blocks after a deform, and a changed topology kills them.

The stale first solve. remesh_with_field_transfer writes the transferred
fields through plain views of the variables' local vectors, which do not
mark the mesh's assembly vector stale, so a solver that had solved before a
move assembled its first solve after it with the pre-move coefficients: on
the zone fixture 6 % in velocity and 80 % in pressure after mesh.deform,
0.2 % and 15 % after one MMPDE move (confirmed on development by hyperion at
np 1 and 2). The transfer now marks it. test_1151 fails without the mark
(2.1e-2 and 4.1e-2 in velocity), and asserts that the move changed the field.

Underworld development team with AI support from Claude Code
test_0057 read T after mesh.deform as carried with the nodes. That was the
stale assembly vector the previous commit fixes: the deform remaps T into
T.data, and the first evaluation after the move read the pre-move nodal
values. With the mark the evaluation reads the remapped T, and beyond the old
boundary the remap can only extrapolate (the crest levels off and dips by
5e-3), which is not what the test is about. It now sets T to the radius on
the deformed mesh, so a located point reads its own radius (within 0.01) and
a point clamped to the old boundary reads ~r_o; its nav-coordinate and
membership checks are unchanged.

Serial: 1080 passed over the bundle files, every mover, deform and snapshot
test, test_1150, 1151 and 1152.

Underworld development team with AI support from Claude Code
The previous commit set T on the deformed mesh. #959 (open, H2), which has
the same stale-vector fix, makes the test carry T instead
(remesh_policy="carry"), so the field along the crest is known; this takes
its hunk verbatim, so the two branches agree on the file.

Underworld development team with AI support from Claude Code
H1's review of e57ad72.

- Merge condition: test_1152's bounds equalled the solve tolerance, so
  kept and fresh differed by convergence noise alone (1.46e-6 velocity,
  1.19e-5 slip at np 2). It now solves at 1e-8 and bounds velocity at
  100x and pressure and slip at 1000x the tolerance; hyperion measured
  kept against fresh at ~4e-9 there, and a stale patch costs only
  iterations, which the iteration guard catches.
- L2: test_1149 tests _topology_signature itself (the same after a move
  and a new field, different on other cells); a constant signature fails.
- L3: after a move on a split level the zone patch's gate verdict is None
  (the structural rows are dropped, not found again and declined); keeping
  them fails.
- M1: the stale mark's comment said every rank reaches it; only a rank that
  moved does (#960). #959's all-rank move decision carries the same mark
  and replaces this one at its merge.

Serial: test_1149 and test_1152, 15 passed; test_1151, 2 passed.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

Review record, round 3: 86c9bbe and e57ad72, with the verdict on the PR head 336fcce

Verdict on 336fcce: ready to merge. The round-3 merge condition C1 is met:

  • test_1152 solves at 1e-8, with bounds of 100× and 1000× the tolerance. Rebuilt and run here, it gives 2 passed at np 1, np 2 (where it failed before) and np 4.
  • test_1149 and test_1151: 15 passed at np 1 and at np 2.

The other findings, as answered in 336fcce:

One note on test_1152. At np 1 its kept and fresh preconditioners are bit-identical (§4), so its kept-against-fresh comparison only has teeth in parallel. That is where scripts/test.sh runs it.

Louis's accuracy condition holds throughout: no kept fac_zone patch changed a converged answer (§5).

Paths under runs/ are on hyperion.


Adversarial review, round 3: bugfix/custom-mg-hierarchy-lifecycle (PR #1036)

Verdict

86c9bbe and e57ad72 are not ready to merge yet. There is one hard condition: test_1152 fails at np 2. One more fix is recommended (section 6).

  • The source is the same in both tips. e57ad72 changes only tests/test_0057_deformed_domain_membership.py.
  • Louis's condition holds: a kept fac_zone patch never changed the converged answer. I tried a correct mask, a stale mask, a mask in the wrong place and a band that had moved, at np 1, 2 and 4.
    • Against a direct (MUMPS LU) solve, every kept-patch answer was within 2.7e-10 at tolerance 1e-8 (Poisson).
    • Against a tight multigrid reference on test_1152's Stokes fixture, it was at the solver tolerance in velocity, pressure and slip.
    • A stale patch costs iterations only: 7-33 against 2-3.
  • The efficiency claim holds as well. Kept, the patch takes 2-3 iterations; a fresh registration takes 2-3; killed, it takes 12-18 (Stokes).
  • Separately, I found a serious bug that is already on development and is not caused by this PR (P1). On a mesh built with refinement >= 1, a solve after any move runs on the pre-move geometry. It biased round 2's fac_zone evidence: the round-2 "survivor" was solving the unmoved problem. With that bias removed, the conclusions above still hold.

Builds and test trees:

  • Head: wt-bA2 at 86c9bbe. It is built, and its source equals e57ad72's.
  • Base: wt-dev8f at 8f0ed0a.
  • Test trees, made with git archive and stored under review3/:

Probes (in review3/):

probe what it tests
p6.py round 2's p4 fixture, plus accuracy against MUMPS LU, stale-mask variants and a sync switch
p6mv.py the stale-geometry check behind P1
p7.py (b): the signature differs on one rank only
p8.py, p8b.py how the topology signature behaves through mesh events, and its cost
p9.py test_1152's Stokes fixture against a tight reference, 6 moves
p10.py, p10b.py (c): the asymmetry of the stale mark
mutplug3.py the mutants

Logs and summaries: logs are in logs/. The summary tables are s6_table.txt, s9_table.txt and sT_table.txt.

Housekeeping:

  • Every run used PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider.
  • Core use stayed at 16 or fewer, except for brief overlaps of 17 between scheduler batches.
  • Nothing was rebuilt, and nothing was written into any worktree; git status is clean in wt-bA2, wt-dev8f and underworld3.
  • I killed two of my own redundant p9 runs by exact PID. mpi_supervisor stopped the expected hang (silence 300 s).

[read] marks a claim that comes from reading the code, with no run behind it.

0. e57ad72 (the coordinator's mid-task change): test_0057 carries T

  • The change. It sets T.remesh_policy = "carry" before the deform. It also restores the original "carried-T" assertions: ptp > 0.02, and monotone along the crest. It drops 86c9bbe's |T - r| < 0.01 check and its re-set of T on the deformed mesh.

  • The setter is honoured [read]. MeshVariable.remesh_policy has a real setter (discretisation_mesh_variables.py:620), and _gather_transfer_vars reads it into the carry bucket. So the deform leaves T.data alone.

  • Runs on the wt-bA2 build:

    test np 1 np 2
    test_0057 (e57ad72) 1 passed 1 skipped (by design: skipif(uw.mpi.size > 1))
    test_1151 (e57ad72 tree) 2 passed 2 passed
  • The same test elsewhere: it passes on dev8f, and it passes under the nostale mutant (the mark is irrelevant once T is carried).

  • Does it still test deformed-domain membership? Yes. The test was written for fix(mesh): boundary normals and domain membership must track a deformed mesh #264 fix (2), in commit 51ecd29, the file's only earlier change: _nav_coords and the boundary kd-tree were not refreshed on deform. I undid that fix in two ways, in-process, on the wt-bA2 build:

    mutant what it undoes e57ad72 test_0057 assertion that fails
    nonav the _nav_coords refresh in nuke_coords_and_rebuild is skipped fails _nav_coords stale: max radius 1.000 (deformed ~ 1.120)
    noindex the self._index = None invalidation is skipped fails points in the bulge "wrongly flagged exterior"

    The original 51ecd29 test fails both mutants in the same way.

  • Why the original test needed changing on this head: it fails here (evaluate not monotone along the carried-T crest). With the stale mark in place, the evaluation reads the remapped T, which can only extrapolate past the old surface. Carrying T is the right fix: the test is about point location, and the carried values are known.

  • Verdict on the test_0057 change: e57ad72 is the better version, and its intent is intact. The 86c9bbe variant is superseded.

  • Verdict on e57ad72 as a whole: the same as 86c9bbe (see the top), since src is identical.

1. (a) test_1152 at np 1, 2 and 4 (86c9bbe tests, wt-bA2 build)

np result time
1 2 passed 618 s
2 1 failed (zone_on_a_split_level), 1 passed. A repeat run failed with identical numbers. 290 s, 312 s
4 2 passed 216 s
  • The np 2 failure is deterministic. At move 2, velocity = 1.46e-6, against the < 1e-6 bound, with pressure 3.4e-6 and slip 1.19e-5 (above its < 1e-5 bound).

  • It is a tolerance artefact, not an accuracy loss. p9.py runs the same fixture at np 2 against a reference solved at 1e-10:

    tolerance (kept and fresh) velocity error, kept velocity error, fresh slip error, kept slip error, fresh
    1e-6 (the test's) 1.6e-6 1.8e-7 1.3e-5 1.3e-6
    1e-8 ≤ 4.8e-9 ≤ 9.6e-10 ≤ 3.5e-8 ≤ 3.7e-9

    At move 2 with tolerance 1e-6 the kept solve is the one further from the reference. At other moves the fresh solve is (move 6: velocity 3.0e-7 kept against 5.6e-7 fresh). The kept-to-fresh difference falls from about 1.5e-6 to about 4e-9 when the tolerance drops 100×. Both converge to the same answer.

  • The test's accuracy bounds are wrong in kind. They equal the solver tolerance, so they trip on ordinary convergence noise.

  • Each rank's own band mask. test_1152 registers mesh.cells_labelled("Band", 72), which is rank-local. At np 2 and np 4, each rank's mask is its own cells. Each rank warned once (said summed over ranks = np), and every rank recorded "the fac_zone blocks; …".

2. (b) A topology signature that differs on one rank only

p7.py monkeypatches _topology_signature on the last rank only (the checksum is XORed with 1), forces a rebuild and solves.

fixture np after the change, on every rank iterations warnings next rebuild hang
zone on a split level 1, 2, 4 killed "all", smoother sor, record "whole-level" 3 → 6 1 per rank stays killed, no new warning none
zone, unsplit level 2, 4 killed "all", smoother sor 2 → 2 1 per rank stays killed none
structural, no zone 2, 4 killed "all", smoother sor 3 → 6 1 per rank stays killed none

The BOR allreduce of moved | rebuilt << 1 works: one rank's difference kills on all of them.

3. (c) The stale-lvec mark and the rank-local early return

Reading the code [read]:

  • The mark (remesh.py:442) sits after the rank-local if np.array_equal(new_X, old_X): return False (remesh.py:381-386), which is the Mesh-move field transfer: remap_var_set can skip a collective on one rank, and ghosts are not synchronised #960 hang site.
  • With a REMAP variable present, a rank that moved goes on into remap_var_set, whose deform-back _deform_mesh(old_X) is collective. The hang happens there, before the mark, as it does on base.
  • Run: round 2's p2.py poisson onerank at np 2 (168 nodes moved on rank 1, none on rank 0). It hangs on this head as expected, inside the deform, with no output after onerank_moving. The supervisor stopped it after 301 s of silence.

But the mark does add a new asymmetry (finding M1):

  • Trigger: every registered variable is CARRY (or REINIT or managed), so remap_var_set returns at if not vars_ with no collective. Only the moved rank reaches the mark.

  • What follows: the next update_lvec runs its collective block (createFieldDecomposition, localToGlobal, globalToLocal) on that rank alone.

  • Probe: p10b.py carryfresh, np 2. A Poisson solve, then update_lvec(), then a deform that moves 28 nodes on rank 1 only.

    build _stale_lvec after the deform (rank 0 / rank 1) next solve()
    head False / True aborts: MPI error … Message truncated in DMGlobalToLocalBegin → DMCreateSectionSF, exit 142, twice out of two runs
    dev8f False / False completes (6 iterations)
  • The usual case does not trigger it. p10.py carry, with the lvec already stale from the previous solve, completes on both builds.

  • The comment at remesh.py:439-441 is wrong. It says "Every rank that moved reaches this line, so update_lvec's collective runs on all of them". The collective runs on the ranks that moved, not on all ranks.

  • The fix is F1's: allreduce moved before the early return, or allreduce the mark.

4. (d) The fac_zone table, with accuracy

Fixture: round 2's p4: Poisson, a band fixed in space with contrast 1e-4, cellSize 1/8, refinement 1, tolerance 1e-8.

Columns:

  • base: dev8f, where the patch survives;
  • head: 86c9bbe, where the exemption keeps the patch;
  • fresh: the coarse levels moved to match, and the zone recomputed;
  • accuracy: the kept solve against MUMPS LU, as a relative 2-norm.

The "sync" columns add a dummy MeshVariable after each move, which works around P1. "nosync" is round 2's protocol.

Iterations on honest geometry (sync). base and head are identical in every cell. Each cell gives iterations at move 1 … k.

move np 1 np 2 np 4 fresh (np 1 / 2 / 4) kept vs LU (worst) fresh vs LU (worst)
MMPDE ×1 3 3 3 2 / 2 / 2 5.5e-14 1.9e-11
MMPDE ×3 3, 2, 2 3, 3, 3 3, 3, 3 2 / 2 / 2 3.6e-12 2.9e-11
MMPDE ×6 3, 2, 2, 2, 2, 2 3 at every move 3 at every move 2 / 3 / 2 1.6e-11 6.9e-12
spring ×6 2 at every move 2, 2, 2, 2, 2, 3 2 at every move 2 / 2 / 2 3.9e-11 1.7e-10
  • Zone at the end: 48, 59, 63-64 and 37 cells, against 36 registered (35-36 of them still in the band).
  • No warning and no record in any row: the patch is kept, as intended.

Round 2's protocol (nosync). Iterations are the same as above, 2-3 at every move on both builds. But kept vs LU is 0.36-0.71 on both builds: the solver's DM still holds the pre-move coordinates, displaced by up to 0.0545. That is P1, not the patch.

Stale masks (head, sync, MMPDE). The patch is kept with the wrong mask. Iterations are given at move 0, then moves 1 …; errors are against LU.

registered mask np ×3 ×6 kept vs LU fresh (its; vs LU)
rolled by 400 (the author's mutant) 1 10; 14, 19, 19 10; 14, 19, 19, 17, 16, 20 ≤ 2.7e-10 2; ≤ 6.9e-12
rolled by 400 2 16; 12, 25, 20 16; 12, 25, 20, 23, 22, 25 ≤ 5.1e-11 2-3
a band 0.3 away (0 cells of the band) 1 16; 16, 21, 18 16; 16, 21, 18, 19, 16, 18 ≤ 8.2e-11 2
a band 0.3 away 2 16; 16, 33, 21 16; 16, 33, 21, 26, 25, 28 ≤ 2.2e-10 2-3
the physical band moved +0.1 1 9; 14, 8, 7 9; 14, 8, 7, 6, 9, 9 ≤ 4.1e-11 3
the physical band moved +0.1 2 11; 17, 11, 13 11; 17, 11, 13, 10, 17, 13 ≤ 6.9e-11 3

Stokes, test_1152's fixture (p9.py, tolerance 1e-6, reference at 1e-10, 6 MMPDE moves). The fixture's mesh has dm is dm_hierarchy[-1], so P1 does not apply (geometry offset 0 in every solve). Iterations are kept / fresh / reference; errors are kept-vs-reference.

case np iterations velocity pressure slip
zone 1 6 / 6 / 9 every move ≤ 6.9e-8 (= fresh's) ≤ 2.6e-6 -
zone 2 6-7 / 6-7 / 10 ≤ 5.4e-7 (fresh 3.1e-7) ≤ 1.2e-6 -
zone 4 6 / 6 / 9-10 ≤ 5.7e-7 (= fresh's) ≤ 2.8e-6 -
zone on a split level 1 12-13 / 12-13 / 19-20 ≤ 9.5e-7 (fresh 8.7e-7) ≤ 1.1e-5 ≤ 8.0e-6
zone on a split level 2 13-15 / 13-16 / 22-23 ≤ 1.6e-6 (fresh ≤ 9.2e-7) ≤ 8.0e-6 ≤ 1.3e-5
zone on a split level 4 15-16 / 15 / 21-22 ≤ 7.8e-7 (fresh ≤ 6.3e-7) ≤ 6.0e-6 ≤ 7.0e-6
zone, mask rolled by 400 1 12 / 6 ≤ 3.6e-7 ≤ 1.3e-5 -
split, mask rolled by 400 1 14-15 / 12-13 ≤ 5.7e-7 ≤ 9.1e-6 ≤ 4.8e-6
split, tolerance 1e-8 1 17 / 17 / 20-21 ≤ 9.9e-10 ≤ 6.1e-8 ≤ 4.7e-9
split, tolerance 1e-8 2 18-19 / 18-19 / 23-24 ≤ 4.8e-9 ≤ 2.3e-8 ≤ 3.5e-8
  • At np 1, kept and fresh are bit-identical (difference 0.0). The fixture's moved zone field selects the same cells as the registered cells_labelled mask, with the same coarse levels. So at np 1, test_1152's kept-vs-fresh comparison compares two equal preconditioners.
  • The noexempt mutant (whole patch killed) took 12 against 6 (zone) and 15 against 13 (split) at np 1, and 13 against 7 and 18 against 15 at np 2.

5. The accuracy assessment, against Louis's ruling

  • The preconditioner does not change the converged answer. The outer KSP is fgmres, right-preconditioned, with the unpreconditioned norm (side=1, norm=2 in every p6 solve). So convergence is measured in the true residual whatever the patch.
  • Measured:
    • Every kept-patch solve, correct or stale, hit tolerance (SNES reason 2).
    • Each was as close to the direct solve as a fresh registration was: ≤ 2.7e-10 against ≤ 1.7e-10 at tolerance 1e-8, Poisson.
    • The kept-to-fresh difference scales with the tolerance (Stokes: about 1e-6 at 1e-6, about 4e-9 at 1e-8).
    • I found no way to make a kept zone patch give a wrong answer that converged.
    • An invalid patch that broke convergence would show as non-convergence, not as a wrong answer.
  • "Iterations ≤ fresh + 1" is the right guard for what can actually go wrong: efficiency. A stale patch costs 7-33 iterations against 2-3, and the guard caught the noexempt mutant and the author's roll-by-400 mutant.
  • The accuracy asserts in test_1152 test only convergence, and they are mis-scaled. Bounds equal to the solver tolerance fail at np 2. They should either use a bound well above the tolerance (for example 1e-4 for velocity and 1e-3 for pressure and slip, at tolerance 1e-6), or solve at 1e-8 and keep bounds near 1e-6. Asserting getConvergedReason() > 0 on both solvers would make the intent explicit.
  • What does threaten accuracy is P1, not this PR. After a move on a refined mesh, every solve (kept, fresh or killed) runs on the old geometry, with errors of 36-71 % against the moved problem. It is identical on dev8f.

6. Findings

id severity what where
C1 merge condition test_1152 zone_on_a_split_level fails at np 2, deterministically: velocity 1.46e-6 against < 1e-6, slip 1.19e-5 against < 1e-5. The bounds equal the solver tolerance (§1, §5). It passes at np 1 and 4. Fix the bounds or tighten the tolerance; then run np 2 again. Louis asked for np 1 and 2, and scripts/test.sh now runs this file. tests/parallel/test_1152:136-142
M1 medium (new on this head; narrow trigger) The stale mark is rank-asymmetric when one rank's coordinates do not change and no variable is REMAP. The next solve aborts with an MPI mismatch; dev8f completes (§3). The code comment claims otherwise. Recommended before merge: allreduce moved before the early return (F1), or allreduce the mark, and fix the comment. remesh.py:381-386, 435-442
P1 high, pre-existing on development, not this PR On a mesh built with refinement >= 1, mesh.dm is a clone of dm_hierarchy[-1]. A move updates mesh.dm only, but every solver rebuild clones dm_hierarchy (clone_dm_hierarchy, discretisation_mesh.py:2064). So the solve runs on the pre-move geometry, with the moved fields, until a new MeshVariable is added (discretisation_mesh_variables.py:2389-2390 re-homes dm_hierarchy[-1]). Measured with mesh.deform, spring and MMPDE, with or without custom_mg, identically on dev8f. Plain Poisson after a deform gives 0.90 against a fresh solver. Meshes without refinement, and test_1152's placed mesh, are not affected. It should get its own issue. _deform_mesh, clone_dm_hierarchy
L1 low The record's detail says "a deform kills the patch" also on the "structural" path. The "all" warning says "was deformed" when the cause is a topology change. custom_mg.py _fac_patch_killed
L2 low No test can catch a broken signature. sigconst (the signature always equal) passes test_1149, 1151, 1152 and 0057. test_1149's topology test replaces _topology_signature itself, so it tests only the kill plumbing. No in-place topology change can be run on hyperion: mesh.remesh needs MMG, which is not registered. test_1149
L3 low The structkept mutant (keep the structural rows on a moved split zone level) is caught by no test (np 1: all pass; np 2: only the C1 failure). Its effect is unmeasured. [read]: with unmoved coarse levels the cover gate would decline those rows anyway. test_1149, test_1152
L4 low (doc) fault-multigrid.md credits "2-3 … iterations … test_1152". Those numbers are p4's Poisson fixture, whose round-2 survivor solves were on the pre-move geometry (P1). Re-measured on honest geometry, they still hold (§4). test_1152 itself shows 6 / 13-15. docs/developer/guides/fault-multigrid.md

The topology signature [mostly run]

  • It stays the same on every rank at np 1 and 2 (p8.py, p8b.py) under:

    • mesh.deform;
    • spring smoothing;
    • redistribute_nodes;
    • node_redistribution;
    • adding a variable;
    • ephemeral_coords (inside and after);
    • a snapshot restore over a spring move;
    • nuke_coords_and_rebuild;
    • a forced recompute (cache dropped).
  • It does not change when it should, as far as I could test. mesh.remesh is the only in-place topology change, and it cannot run here (no MMG). [read]:

    • remesh calls nuke_coords_and_rebuild, which clears _cell_node_array, so the signature is recomputed from the new cells.
    • adapt, add_fault and refinement return new mesh objects, so the old solver's finest mesh is unchanged.
  • Rank-order stability: each rank compares only with its own earlier value, and the BOR allreduce merges the flags. The same DM gave the same crc after a forced recompute.

  • Cost:

    • cold (table rebuilt): 4-6 ms at 330-650 cells, and 25 ms at 9.5 k cells;
    • warm: 15-25 µs, and 0.35 ms at 9.5 k cells.

    It is called only in build and in _record_installed_patch, not per iteration. That is negligible.

test_1151

  • It fails on dev8f: velocity 2.1e-2 (deform) and 4.1e-2 (MMPDE).
  • It passes on the head at np 1 and 2.
  • Its guard against a vacuous pass (more than half the values changed) is present.
  • The nostale mutant fails it at np 1 and 2, and it also fails test_1152 (velocity error 1.5e-2).

Mutants (in-process, mutplug3.py)

mutant test_1149 np 1 / 2 test_1152 np 1 / 2 test_1151 np 1 / 2 test_0057 (e57ad72)
noexempt (zone patch killed whole) 1 failed / 1 failed 2 failed / 2 failed (iterations) pass / pass pass
sigconst (= topology check dropped) pass / pass pass / C1 only pass / pass pass
nostale pass / pass 1 failed / 2 failed (accuracy) 2 failed / 2 failed pass
structkept pass / pass pass / C1 only pass / pass pass
nonav, noindex (#264 undone) - - - failed (also the original test)

Regressions

Each file was run on its own, head (t3) against dev8f (tbase).

  • Serial, 34 files: results are identical on both builds, except:

    • test_1151 fails on base (expected);
    • test_1149 is absent on base;
    • test_1150 fails on both builds, 18 each: scripts/check_examples_compile.py is not in a tests-only archive, which is an artefact of the setup;
    • test_1060_stress_store_smoothing was still running on both builds after 28 min, with no verdict.
  • Serial on the head, among others:

    • 1145 (5 passed), 1146 (4), 1149 (12), 1151 (2), 0057 (1);
    • the snapshot, transcript and restore tests, 0007-0020;
    • the movers 0750, 0751, 0762, 0764, 0773, 0850, 0855 and 0861;
    • 1060 nitsche, 1063 and 1074.
  • np 2, 11 files: 1146, 1149, parallel 1149, 1151, parallel 0020, 0079, 0773, 0775 and 0855 all pass on the head. Two failures are the same on both builds:

    • test_0007's test_backstepping_cfl_recovery_end_to_end fails;
    • test_0020_restore_continuation hits an MPI error.

    Both are pre-existing.

7. Merge conditions

  1. C1: make test_1152's accuracy bounds tolerance-aware, then show it passing at np 1 and 2 (and 4).
  2. Recommended, M1: allreduce the moved verdict, or the stale mark, across ranks, and correct the comment. A one-line allreduce before the early return (F1) closes M1, Mesh-move field transfer: remap_var_set can skip a collective on one rank, and ghosts are not synchronised #960/F1 and _move_version asymmetry together.

Not conditions:

  • Open an issue for P1.
  • L1-L4.
  • A signature test that does not replace the function (L2).

8. What I could not test

  • A real in-place topology change (mesh.remesh needs MMG, which is not registered in this PETSc). The "changes when it should" half of the signature rests on reading the code.
  • The one-rank-move hang (F1) under gdb. I only confirmed the silence; round 2 has the stack.
  • 3-D fixtures, the add-on hierarchy after a mover, and follow_metric.
  • The full scripts/test.sh, which I was not allowed to run.
  • test_1150 in a tests-only archive.
  • test_1060_stress_store_smoothing, which had no verdict within the time.

Underworld development team with AI support from Claude Code

#959 carries the same stale-mesh-vector mark, after an all-rank move
decision; its copy is kept and this branch's is dropped, which also makes the
_move_version bump collective (H1's M1). test_a_mover_leaves_a_snapshot_
restorable is dropped as a duplicate of #959's test_0766 snapshot test.
test_1151 stays: it covers mesh.deform and a Stokes assembly against a solver
built after the move, which test_0766 (a mover, read through an integral)
does not.

Underworld development team with AI support from Claude Code
lmoresi pushed a commit that referenced this pull request Nov 11, 2026
When #765 was split out of 19fdbc0, the solver file was taken whole from
that commit, which predates #1036. That reverted #1036's
_release_fac_keys and _free_after_install calls in the solver, and
test_1149 failed three ways (FAC keys left in the options database,
PETSc error 73). The file is now development's, with only this branch's
change: _peel_except delegates to adjoint._peel_except.

test_1149 and test_0032: 16 passed.

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