Skip to content

Rotated solve: the Schur sub-solve stops at iteration 0 when its right-hand side is round-off of its own terms (#910) - #1061

Merged
lmoresi merged 9 commits into
developmentfrom
bugfix/rotated-workspace-cache-910
Nov 12, 2026
Merged

lmoresi merged 9 commits into
developmentfrom
bugfix/rotated-workspace-cache-910

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

A warm rotated free-slip re-solve whose pressure equations already hold hands the pressure (Schur) sub-solve b_p - A10 x_u with b_p at round-off. A10 x_u is the divergence of a divergence-free increment, so the right-hand side is the rounding of a sum: 4e-15 against 7e-2 cold. A relative tolerance on that asks for a cut below what the arithmetic carries. The sub-solve ran to its 200-iteration cap, one velocity solve per iteration. Or the noise grew past the divergence tolerance at FGMRES's restart, and the outer solve failed at iteration 0 (PC_FAILED, -11). On test_1157's annulus, development fails 10 of 10 serial probe runs and 5 of 5 at np 2.

rotated_bc._SchurRoundoffTest is prepended on the pressure sub-KSP. At iteration 0 it compares r0 with 1e6 eps || |A10| |x_u| ||, where x_u is the velocity sub-KSP's solution, and stops the sub-solve if r0 is below it. After iteration 0 the default test decides. The scale is the sub-solve's own, because the outer FGMRES hands the fieldsplit unit Krylov vectors. A first form scaled by the convergence reference cut genuine sub-solves short at large forcing: the A = 1e8 annulus was 9.3e-7 off the direct solve, where development is 1.7e-8 (hyperion's review).

Where the threshold sits

r0 / (eps || |A10| |x_u| ||) at pressure iteration 0, over 833 decisions (hyperion's review records and wombat):

population ratio development on the same solve
cold solves (forcing 1e3–1e10, mu 1e-8–1e2, selfp, GAMG) 5.7e9 (test_1018 late Newton increments) to 2e15; the annulus ~6.7e14 never fires
genuine warm corrections 1.45e6 (mu 1e-4), 2.27e6, up to 1.8e8 (mu 1) solved; this branch solves them too
the band just below 3.9e5–6.5e5 200 cap (test_1018 reuse, test_1158 solve 2, power-law warm re-solve); 5 iterations for one grey case
cap-only 363–3e4 200 cap
every -11 (60 decisions) 2.4–301 PC_FAILED

The margins are narrow at both ends. A wrong decision costs iterations, not accuracy: the outer FGMRES converges to its tolerance either way, and every misfire we measured matched the direct solve as closely.

  • A skipped genuine correction costs an outer iteration. Its next Krylov vector can then run its own Schur solve to the cap: on a power-law warm re-solve at tolerance 1e-9, outer iterations go from 3 to 4 and velocity iterations from 1458 to 2246, with the same answer.
  • A grind left alone costs the cap or a -11. On test_1018's reuse case that is 3623 velocity iterations in the solve that fires, against 38 with the test.
  • Near 1e6 the ratio of one solve moves with the partition. test_1158's second solve is 6.5e5 at np 1 and 1.4e6 at np 2, so its iteration count differs between np there. The decision is the same on every rank.

Counts against development

Hyperion's round-2 record, serial and np 2:

test branch against development
test_1088 interface law, np 2 same counts (425 / 109)
test_1018 nonlinear (all) same counts
test_1115, 1089, 1112, 1087, 1111 same counts
test_1136, 1064, 1142 (serial) noise only; the test never fired
test_1018 workspace reuse the solve that fires: velocity 3623 → 38; the test: 3995 → 410, pressure 217 → 17 (development ran the Schur solve to its cap)
test_1158 second solve, np 1 that solve: velocity 5301 → 44 (development capped too; at np 2 the ratio is 1.4e6 and the test does not fire)
test_1157 probe, serial / np 2 development fails 10/10 (8 with -11) / 5/5; branch 0/15
power-law warm re-solve, tolerance 1e-9 outer 3 → 4, velocity 1458 → 2246, same answer (a misfire; see above)

Tests

  • tests/test_1157_rotated_warm_resolve_at_roundoff.py (new, tier B):
    • four warm re-solves converge, with the pressure sub-solve under 50 iterations;
    • the first warm solve keeps its genuine correction (at least 6 pressure iterations; 7 here and on development);
    • a genuine warm correction at mu 1e-4 is solved, and the test does not fire;
    • a cold solve at forcing 1e8 matches the direct solve to 5e-8, and the test does not fire.
    • It fails on development at np 1 and 2. A threshold of 1e7 and a test that fires at every iteration both fail it.
  • Serial rotated set on wombat: 215 passed, 28 skipped, 1 xfailed.
  • np 2 and np 4: hyperion's review records (posted below). At np 4, test_1142, 1144 and 1157 pass on every rank. Counts match development on 1064, 1088 (437 / 110), 1089, 1112 and 1142, and the test does not fire there. The probe fails 3/3 on development (-11) and 0/3 on the branch. test_1158 goes from velocity 11604 to 832. The four ranks take the same decision in all 85 cases.

The #546 m3 commit this branch first carried merged separately in #1056.

Issues

Underworld development team with AI support from Claude Code

…'s scale (#910)

A warm rotated re-solve whose pressure equations already hold (started from
v = 1.05 v_solved with the solved pressure) hands the pressure Schur sub-solve
a right-hand side that is round-off: 4e-15 against 7e-2 on the cold solve. Its
relative tolerance then asked for a cut below what the arithmetic carries.
The sub-solve ran to its 200-iteration cap, a velocity solve per iteration. Or
the noise grew past the divergence tolerance (1e5 times 4e-15), and the next
velocity solve saw a NaN, failing the outer solve at iteration 0 (PC_FAILED,
-11). Which one happened depended on the rounding, so the failure looked
random. It was not cached state: it happens with the garbage collector off,
and on rebuilt workspaces.

The sub-KSPs now also stop at 1e3 machine epsilons of the convergence
reference, which is passed in from the Newton loop. That is about seven
orders below the Newton target.

- Probe, 10 serial runs of a cold solve and 6 warm re-solves on test_1115's
  annulus: development fails at least once in every run; this branch gives 0
  of 60.
- On that annulus the cold solve's counts are unchanged (velocity 4, pressure
  7). Warm re-solves take pressure 4, 0, 0, where development took 7 and then
  200 or a failure.
- The rotated, fault and adjoint files with iteration-count anchors (about 35
  files, serial) pass: 212 passed, 27 skipped (parallel only), 1 xfailed
  (marked in the file).

test_1157 (new, tier B) runs four warm re-solves and asserts each converges
with fewer than 50 pressure iterations. It fails on development in both runs
tried.

Underworld development team with AI support from Claude Code
…#910)

Underworld development team with AI support from Claude Code
…e kernels (#546, m3)

The workspace reassembles the operator when a variable it depends on changes.
It reads which variables those are from the constitutive parameters, and used
to reuse that list whenever the geometry matched. A rewire that adds a variable
was safe only because every rewire also tore the workspace down. The list is
now reused only when the cached constants signature carries the same JIT key,
so the new variable is watched by construction.

test_1158 (new, tier B) leaves a workspace that claims older kernels with no
coefficients, then changes the newly added variable. With the old reuse the
first increment rode the viscosity-1 operator (residual 0.19 -> 0.072) and the
linear solve took 2 increments; with this change it takes 1 and matches a
fresh solver to 1e-6.

#546 m1, probed on development: a new set_custom_fmg registration rebuilds the
workspace (velocity MG 3 -> 2 levels, prolongations 2 -> 1), and a new tolerance
drops the KSP context (tol_ok). Nothing to fix there.

Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…s, not of ref (#910)

Review round 1 (hyperion): the floor of caa31c1 was in the wrong units. The
outer FGMRES hands the fieldsplit unit Krylov vectors, so a sub-solve's
right-hand side does not scale with the convergence reference. On test_1157's
annulus the cold pressure sub-solve starts at 7.1e-2 at every forcing from 1e3
to 1e10, while 1e3 eps ref grew from 8.9e-12 to 8.9e-5. The floor then bound on
genuine sub-solves: at forcing 1e8 the answer was 9e-7 off the direct solve,
where development is 1e-8. This reverts that floor and its doc text.

The pressure (Schur) sub-KSP now carries a prepended convergence test
(_SchurRoundoffTest) that acts at iteration 0 only. Under the full
factorisation its right-hand side is b_p - A10 x_u. In the #910 warm start,
b_p is at round-off and A10 x_u is the divergence of a divergence-free
increment, zero by the physics. So the scale is that of the terms,
||A10| |x_u||, with x_u read from the velocity sub-KSP's solution as the Schur
solve starts. The test stops the solve when r0 <= 1e6 eps ||A10| |x_u||;
otherwise, and after iteration 0, the default test decides. |A10| is read once
per operator refresh.

Measured on that annulus at forcings 1e3 and 1e8, as r0 / (eps ||A10| |x_u||):
6.7e14 cold, 1.8e8 for the first warm solve (a real pressure correction, 7
iterations), and 30 to 2.7e4 for the round-off ones.

- Cold solves at forcings 1e3, 1e7, 1e8 and 1e10: the test never fires.
  Counts (outer 1, velocity 4, pressure 7) and the error against LU (1.16e-8)
  are the same at every forcing, as on development.
- #910's probe (10 runs, cold then 6 warm): 0 of 60 failures.
- test_1157 now has two tests.
  - The warm re-solves must converge with fewer than 50 pressure iterations,
    and the first must still iterate. With no test (development) it fails at
    200; with a threshold of 1e12 eps it fails because the real correction is
    skipped.
  - A cold forcing-1e8 solve must match LU to 5e-8 with no skip. caa31c1's
    floor fails it at 8.8e-7.
- Serial, the rotated, fault and adjoint files with count anchors: 213
  passed, 27 skipped (parallel only), 1 xfailed (marked).

Underworld development team with AI support from Claude Code
… via #1056)

Underworld development team with AI support from Claude Code
…; two guards

- _SchurRoundoffTest is destroyed first in _destroy_rotated_ksp_ctx and destroys
  its velocity sub-KSP reference. In parallel a dropped reference is released late,
  and it kept the velocity KSP and its multigrid alive past the context: test_1142
  failed at np 2 (hyperion's review, F-A; the fix is theirs).
- The threshold stays at 1e6 eps. The comment and the convergence-policy doc carry
  the measured populations (833 decisions): every -11 at 2.4-301, cap-grinds at
  363-6.5e5, genuine warm corrections from 1.45e6. A wrong decision costs
  iterations, not accuracy; the power-law warm re-solve's cost and the partition
  dependence near 1e6 are recorded.
- test_1157: the first warm solve takes at least 6 pressure iterations (7 here and
  on development), and a genuine warm correction at mu 1e-4 (ratio 1.45e6) is solved.
  A threshold of 1e7 and a test that fires at every iteration both fail it.

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

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

Copy link
Copy Markdown
Member Author

Review record, round 1 of 2: 4d66372 (src as 005a34b), pre-PR

This round reviewed the first form of the #910 fix, a sub-KSP floor scaled by the convergence reference. Its F1 (the floor is in the wrong units) led to the Schur round-off test now on this PR; round 2 below reviews that. The #546 m3 part of this record was posted on #1056, which has merged. Paths under review/ are on hyperion, in runs/2026-11-11-910/.


C4 review: bugfix/rotated-workspace-cache-910 at 4d66372 (src as 005a34b)

Reviewed on hyperion, 2026-11-11. The branch is development 8417977 plus:

The source is identical to 005a34b, so every measurement below applies to the head.

Verdict. The branch fixes #546 m3 and the #910 failure as reported. It should not merge as is, because the #910 floor is in the wrong units. The sub-KSP right-hand sides come from the outer FGMRES's unit-norm Krylov vectors, not from the residual that ref measures. So 1e3·eps·ref grows with the problem's forcing while the sub-solve right-hand sides stay the same size. It binds on genuine sub-solves:

  • in test_1088 at np 2;
  • in nine test_1018 tests;
  • in two test_1136 tests;
  • on every annulus run with a reference of 4e5 or more, where the velocity error against LU grows up to 56 times.

The m3 commit is sound and could merge on its own.

Method

  • Build. The branch build in wt-910 at 005a34b was used as is. The installed rotated_bc.py was checked byte-identical to the worktree. All other .py files match, apart from one installed test file.

  • Development and mutants. Other variants of rotated_bc.py were loaded in-process, without touching disk:

    • development, from git show 84179775:…;
    • caa31c1 alone, which equals "m3 reverted";
    • the mutants: nofloor, noscale (ref = 1), x1e6, and two of my own, presonly and presonly_noscale.

    Two loaders do this. probes/sitecustomize.py is a meta-path loader that execs the swap source when the module is first imported, so it also covers the child process that test_1064's serial_reference spawns. probes/swapsrc.py, a pytest plugin and importable module, prints a one-line check on every run: the live source, its sha, whether _set_absolute_target takes scale, the value of _SUBSOLVE_ROUNDOFF, and whether the m3 variable exists. Every log carries that line, and every variant reported as expected.

  • Instrumentation (INSTR). swapsrc wraps solve_rotated_freeslip and _set_absolute_target. It attaches KSP monitors to the fieldsplit velocity and pressure sub-KSPs. Per application it records the first residual r0, the iterations, the final residual, and the rtol and atol in force.

    • "Binds" means atol > rtol·r0 with the floor active. That is the condition under which PETSc stops on the floor rather than on rtol.
    • Outer counts come from the solver's own ksp_its, Newton counts from nonlinear_iterations.
    • The *_its_last fields are last-application samples, so the sub-KSP totals below are monitor sums.
  • Tests. All tests ran from git archive 005a34b8 tests copies, with PYTHONDONTWRITEBYTECODE=1 and -p no:cacheprovider. MPI ran under mpi_supervisor.py --silence 600.

    • I added one file to the review copy: test_1158_behaviour_only.py, which is test_1158 with its white-box assertion turned into a print.
  • Core limit. At most 4 cores were in use, with one exception: test_1064's serial-reference child briefly made it 5 during the two np 2 test_1064 runs.

  • Probes and logs are in review/probes/ and review/logs/. summary.txt has one line per run.

Check 1: iteration counts, branch against development

np 2, count-anchored parallel files

All files pass on both. Cells are development/branch, summed over each test's rotated solves. "Binds" counts velocity/pressure applications where the floor binds, on the branch.

file :: test Newton outer KSP vel sub its pres sub its binds v/p change
1064 :: all 9 tests same same same, except box tests ±1 (1225/1226) same 0/0 none (1)
1088 :: 12 smoother tests (stokes, sheet) same same same same 0/0 none
1088 :: test_the_direct_lu_path_takes_an_interface_law 12/12 12/12 425/382 109/98 0/4 CHANGED
1089 :: 4 solving tests same same same (141, 2406, 78, 161) same 0/0 none
1112 :: coarse_solve_is_shifted_lu_in_parallel 1/1 1/1 44/44 9/9 0/0 none
1142 :: projection_holds_and_is_released 1/1 1/1 80/80 18/18 0/0 none

(1) The ±1 on the box velocity totals is run-to-run noise. Two development runs gave 1226 and 1225 on the same test.

The 1088 change, in detail: the second solve runs at tol 1e-8, ref 55.8, so the floor is 1.24e-11. The pressure sub-solves' r0 are 3.5e-3 to 1.7e-4, so rtol·r0 lies between 3.5e-12 and 1.7e-13. The floor binds on genuine pressure corrections, including the first increment's. The per-application pressure counts go from 21, 21, 21, 21, 16, 9 to 19, 19, 18, 17, 16, 9. The Newton residual history is the same to the printed digit (final 4.6e-11), so the answer did not move.

The noscale mutant (floor 2.2e-13 absolute) leaves 1088 identical to development: 425/109.

Serial, count-anchored rotated files

file tests changed what changed (development/branch) Newton / outer
1018_rotated_freeslip 9 of 26 2 workspace-reuse tests: vel 3995/551, pres 217/25 (development's third solve runs pressure to the 200 cap: #910 inside test_1018). 7 nonlinear tests: vel −0.4 to −1.5 %, pres −2 (e.g. 10827/10781, 490/488), floor binding in 1 to 14 pressure applications, including mid-solve increments (16 to 15 at increments 9 and 11 of 43) all same; final residual same
1115 1 of 7 failed_warm_rotated_solve_keeps_the_state: vel 74/54, pres 15/10 same
1136 2 of 6 cap_raised_past_50: vel 20973/19085, pres 815/743, 28 pressure binds; negative_cap: 40981/37198, 1567/1423, 56 binds same (60, 110)
1142 0 (2) — same
1087, 1111, 1077, 1079 0 — same

(2) In the last two 1142 tests the per-test totals swap between runs (124/266 against 266/124). The pair sums are equal. This is test attribution, not a count change.

The cold test_1115 annulus is unchanged (vel 34, pres 7). The branch's warm pressure counts are 4, 0, 0…, as W1 reports.

For Louis. No Newton count or outer KSP count changed anywhere. Sub-KSP counts changed in four count-anchored files: 1088 at np 2; and 1018, 1115 and 1136 serially. The branch always does fewer sub-KSP iterations, because the floor binds on genuine pressure solves (and, at larger references, velocity solves), not only on round-off.

Check 2: does the floor bind on a legitimate right-hand side?

Yes, and the reason is structural [read, then measured].

The outer KSP is FGMRES. It applies the fieldsplit PC to normalised Krylov vectors, so every sub-solve right-hand side has a size set by the operator, not by ref. Measured on the test_1157 annulus: the cold pressure sub-solve's r0 is 7.1e-2 at every forcing amplitude from A = 1e3 to A = 1e10, a reference range of 40 to 4e8. The floor, meanwhile, grows from 8.9e-12 to 8.9e-5. The policy doc's claim that the floor sits "about seven orders below eta·T, so it does not bind on a right-hand side that carries anything" compares quantities in different units.

Annulus sweep (test_1157 fixture, tol 1e-6, reference: direct LU of the same state)

case ref floor variant reason outer vel/pres sub its binds v/p velocity error vs LU
A 1e3, cold 40 8.9e-12 dev / branch 3 / 3 1 / 1 34,7 / 34,7 0/0 1.66e-8 / 1.66e-8
A 1e6, cold 4e4 8.9e-9 dev / branch 3 / 3 1 / 1 34,7 / 34,7 0/1 1.66e-8 / 1.66e-8
A 1e7, cold 4e5 8.9e-8 dev / branch 3 / 3 1 / 1 34,7 / 29,6 2/1 1.66e-8 / 2.37e-7
A 1e8, cold 4e6 8.9e-7 dev / branch 3 / 2 1 / 1 34,7 / 24,5 4/1 1.66e-8 / 9.34e-7
A 1e8, warm 4e6 8.9e-7 dev / branch 3 / 3 1 / 1 32,7 / 9,1 2/1 1.56e-8 / 1.27e-7
A 1e10, cold 4e8 8.9e-5 dev / branch 3 / 3 1 / 2 34,7 / 30,7 11/2 1.66e-8 / 1.96e-8
mu 1e-4, cold 40 8.9e-12 dev / branch 3 / 3 2 / 2 466,15 / 466,15 1/0 3.39e-8 / 3.39e-8
mu 1e-6, cold 40 8.9e-12 dev / branch 3 / 2 2 / 2 466,15 / 104,15 17/0 LU reference unusable (inf)
  • Large background (hydrostatic). f = −1e9 r̂ on top of a dynamic part of 1e3 (ref 7.6e7, floor 2e-5). The floor binds in 13 velocity and 2 pressure applications. The cold error is 7.9e-4 on development and 1.1e-6 on the branch; the warm error is 1.25e-5 and 4.8e-5. Both are dominated by the outer target, which T = rtol·ref sets from the hydrostatic part. The floor moves the error both ways. It is not the limiting factor here, but it does bind.
  • Small perturbation on a large background. Warm re-solves at 1.0001 v (ref 40) and at 1.00001 v with A = 1e8 (ref 4e6). The errors are identical to development's (1.56e-8). The floor binds only on pressure, where the pressure right-hand side is genuinely round-off.
  • Nonlinear, power law (eta = (edot + 1e-3)^(−2/3), tol 1e-9).
    • At A = 1e3: same 9 Newton steps on both. The branch binds in 28 velocity and 4 pressure applications, with vel 757 against 732. The cold error is the same, 5.0e-7. The warm re-solve is much cheaper on the branch (1458 against 139 vel), because development's warm pressure solve hits the 200 cap.
    • At A = 1e8: the branch fails PC_FAILED (−11) in 3 s. It binds in 576 velocity applications, and the pressure FGMRES goes to its cap and then to DTOL. Development did not finish the cold solve in 1500 s, and neither did presonly_noscale. The problem is pathological on every variant, but the branch changes the failure mode to a hard failure. The LU reference also failed to converge on this case.

Margin in practice. On the annulus, the velocity floor starts to bind between ref 4e4 and 4e5. That is a nondimensional forcing of about 1e7, the Rayleigh-number regime of the science runs now on hyperion. The pressure floor already binds at ref 56 and tol 1e-8 (test_1088), and on the late and middle Newton increments of the test_1018 and test_1136 box problems. In every measured linear case the outer FGMRES keeps the answer within the solver tolerance, but the error grows by up to 56 times, and "cold counts unchanged" holds only at the test_1157 scale.

Mutants on the same sweep

variant #910 warm (A 1e3, 6 warm) A 1e7 cold err A 1e8 cold err A 1e10 cold 1088 np 2 1018 serial
development 200 cap, −11 1.66e-8 1.66e-8 34,7 425/109 baseline
branch 4, 0, 0 … 2.37e-7 9.34e-7 outer 2 changed 9 changed
x1e6 pres 1, 0, 0 — 1.68e-6 — — —
presonly (ref-scaled, pressure only) 4, 0, 0 … 7.1e-8 8.2e-7 vel 238 — —
noscale (2.2e-13 absolute) 6, 0, 0 … 1.66e-8 (identical) 1.66e-8 (identical) identical identical 12 changed (pressure binds up to 32, ref < 1 there)
presonly_noscale 6, 0, 0 … identical identical identical — —

No fixed absolute floor works either. noscale removes every change on the annulus and in 1088, but binds more than the branch on the small-reference box problems of test_1018. The floor has to be in the sub-solve's own units. One option [not tested]: the cancellation scale of the Schur right-hand side, eps·(‖b_p‖ + ‖A10·x_u‖), on the pressure sub-KSP only.

Check 3: test_1157 and W1's probe

run development branch
test_1157 np 1 3 of 3 fail: [(True,3,7),(True,3,200),(True,3,200),(True,3,200)] 3 of 3 pass (5 runs in total)
test_1157 np 2 3 of 3 fail, with −11: [(True,3,9),(True,3,200),(False,-11,30),(False,-11,30)] 3 of 3 pass
W1 probe, cold + 6 warm at 1.05 v_solved, np 1, 10 fresh processes 10 of 10 hit the 200 cap; 7 of 10 fail −11 0 of 10 (warm pressure 4, then 0)
same, np 2, 5 processes 5 of 5 hit the cap and fail −11 0 of 5
same with caa31c1 alone, np 1, 10 processes — 0 of 10
  • Development's failure reproduces in parallel.
  • The mechanism is as W1 describes. The first warm solve's pressure right-hand side is 2.7e-8 and converges in 7. From the second warm solve on, the right-hand side is 2.3e-14 to 6.0e-14, against 7.1e-2 cold, and the solve runs to 200 or to DTOL.
  • It needs the pressure from the previous warm solve. My first probe reset p to the cold solution before each warm solve, and then development did not fail in 10 of 10 runs (right-hand side 2.7e-8 every time).
  • The −11 failures latch: once a warm solve fails, every later warm solve in that run fails too (30 to 90 pressure iterations).
  • test_1157 does not distinguish the mutants that matter. noscale and x1e6 pass it, and so does development at any forcing scale. It pins the fix, not the units.

Check 4: the vector route

[read] _set_absolute_target builds subs only when the PC type is fieldsplit. _solve_rotated_vector uses PCMG or GAMG, so subs is empty and scale has no effect. The outer atol path is unchanged.

Measured: test_1077 and test_1079 (thin sheet, serial) and the six "sheet" cases of test_1088 (np 2) record no sub-KSP applications, and identical outer counts on development and the branch (74, 53, 98, 270; 117, 727, 597; 11, 26, 182, 11, 27, 181).

Check 5: #546 m3 (and m1)

test_1158

development branch caa31c1 (m3 reverted) nofloor / noscale / x1e6
np 1 fail (the white-box [] == ['T1158']) pass fail pass
np 2 fail pass fail pass
behaviour only, np 1 2 increments, rel 4.0e-10 1 increment, rel 4.9e-10 — —
behaviour only, np 2 2 increments, rel 8.4e-10 1 increment, rel 8.4e-10 — —

W1's behavioural claim holds: 2 increments against 1, the same answer.

Can the JIT-key comparison be rank-divergent?

  • [read] The key is _GextResult.cache_key, a sha256 of the canonical C source. _agree_source_across_ranks allgathers it and adopts rank 0's source on any disagreement, so the key is identical on all ranks by construction.
  • [read] The stored operator_sig is None only when did_assemble or reuse_operator is false. Both follow collective decisions; op_ok is allgathered before it gates anything.
  • [read] The enumeration (_operator_coefficient_variables) is symbolic: unwrap, mesh_vars_in_expression and a sort by _uw_id. It makes no PETSc, DM or MPI calls, so a rank that enumerates while the others reuse cannot desynchronise a collective.
  • Measured, at np 2: I forced the divergence. Rank 0 got a forged key, so it re-enumerates. Rank 1 got a stale empty coefficient list, so it reuses. Then T changed twice.
    • Result: no hang, 1 Newton increment each time, and a velocity relative difference of 1.8e-10 against a fresh solver, on both development and the branch.
    • The per-rank lists then stay divergent ([Tc4] on rank 0, [] on rank 1) until the next rebuild. The allgathered op_ok absorbs this: any watching rank forces the refresh everywhere.
  • Not tested: a mesh with an empty rank. The repository's empty-rank fixture needs a one-cell mesh at np 2, which cannot carry a rotated annulus problem, or np 3. The key itself does not depend on the cells.

Cost. The extra enumeration when the key is None costs 0.11 to 0.13 ms per call; the constants signature costs 0.012 ms. Both were measured at np 2 on a 0.2 annulus. That is negligible next to a solve.

Is the stale state reachable through the public API today? It is not. Setting Parameters.shear_viscosity_0 = 1 + T takes the function-rewire path (flags (False, False, True)), and the next solve rebuilt the rotation: new Q handle, rotation_reused False, enumeration ['Tc4']. This was measured at np 1 and np 2, on development and the branch. W1's "hardening" description is accurate.

m1, measured at np 1 and np 2, the same on development and the branch:

  • A tolerance change (1e-8 to 1e-9) drops the KSP context (ctx None) and keeps Q. The next solve builds a context at the new tolerance: outer rtol 1e-9, atol 4.95e-12.
  • set_custom_fmg re-registration sets is_setup = False. That triggers a full teardown (cache None, Q None), and the next solve builds a new workspace with velocity_pc = custom-FMG.

W1's m1 verdict is confirmed.

Check 6: regressions

  • Serial set on the branch. Fifty files: adjoint 0018 to 0026, 0062, 0762, faults 0845 to 0866, 1018 (three files), 1029, 1060 to 1087, 1111 to 1158. All pass, 385 tests in total.
    • Not counted: test_0023_field_realness fails one test because it reads src/…/petsc_generic_snes_solvers.pyx, which the test-only archive does not have. This is environmental and unrelated.
    • Not counted: my glob also picked up test_1060_stress_store_smoothing and test_1061_stress_forward_history, which are not rotated. I stopped them after 20 to 27 minutes.
  • Parallel rotated files at np 2 on the branch. All pass: 1063, 1064, 1066, 1068, 1086, 1088, 1089, 1112, 1116, 1131, 1140, 1142, 1144, 1147, 1156.
  • Mutants against test_1157 and test_1158 (np 1 and np 2).
mutant test_1157 test_1158
no floor fails (np 2) passes
floor with ref = 1 (noscale) passes passes
multiplier 1e6 passes passes
m3 reverted (caa31c1) passes fails (np 1 and np 2)

Each test kills the mutant aimed at its own fix. Neither test kills the scale mutants: nothing pins the floor's units or the "cold counts unchanged" claim.

Check 7: issue verdicts

Findings

  • F1 (high: changes answers and counts on legitimate solves). The sub-KSP floor 1e3·eps·ref is in the outer residual's units, but the sub-solve right-hand sides are in the units of the outer FGMRES's unit-norm Krylov vectors. Measured: the pressure sub-solve's r0 is 7.1e-2 at every forcing from A = 1e3 to 1e10. The floor binds on genuine sub-solves:

    • test_1088 at np 2 (pres 109/98, vel 425/382);
    • test_1018, 7 nonlinear tests (mid and late increments);
    • test_1136 (pres 815/743 and 1567/1423);
    • the annulus at ref ≥ 4e5 (velocity error 1.7e-8 to 2.4e-7 at A 1e7, and to 9.3e-7 at A 1e8);
    • a power law at A = 1e8, where it turns a grinding solve into a −11 failure in 3 s.

    Newton counts and outer KSP counts never changed, and every linear answer stayed within tolerance.

  • F2 (medium). Two doc statements do not hold: "the floor is about seven orders below eta·T, so it does not bind on a right-hand side that carries anything" (in the policy doc and the _set_absolute_target docstring), and the PR's "cold sub-solve counts unchanged", which is true only at the test_1157 scale. The policy doc records a rejected round-off bound (10·eps·‖A‖·‖u‖); this floor repeats that kind of scale mismatch.

  • F3 (medium). The tests do not pin the floor's units. test_1157 passes with noscale and with x1e6, and no test checks sub-KSP counts at a large reference. A cold solve at A = 1e8 would catch F1: its counts equal to development's, or its error against LU at development's level.

  • F4 (low). An absolute floor without the reference (the noscale mutant) is not the fix either. It leaves the annulus and 1088 identical to development, but binds more than the branch on the small-reference box problems (12 changed tests in 1018, up to 32 pressure binds). The floor has to come from the sub-solve's own scale; one candidate, untested, is in Check 2.

  • F5 (low, m3). A forced rank divergence leaves per-rank coefficient lists that differ until the next rebuild. The allgathered op_ok makes this harmless, and the JIT key is agreed across ranks by construction [read], so it is not reachable. If a guard is wanted, allgather same_kernels, which costs one bool.

  • F6 (information). Warm rotated solve on the fast path fails at iteration 0 with no cause (pressure sub-KSP DTOL, then NaN) #910 needs the pressure from the previous warm solve. With p reset to the cold solution, development does not fail (0 of 10). test_1157 has this right.

  • F7 (information). test_1018's workspace-reuse tests already hit Warm rotated solve on the fast path fails at iteration 0 with no cause (pressure sub-KSP DTOL, then NaN) #910 on development: their third solve runs pressure to the 200 cap (vel 3995 against 551 on the branch).

  • F8 (information, 4d66372). The scripts/test.sh change is correct.

    • test_1157 and test_1158 each appear once, in batch 4 tests/test_1157*py and batch 4 tests/test_1158*py, inside the PARALLEL_ONLY -eq 0 block.
    • No other batch glob matches them. The neighbouring globs are test_110*, test_1110*, test_1150*, test_1151* and test_1153*.
    • Both files are tier_b, so the -m "not tier_c" filter runs them.
    • Each glob matches exactly one file at 4d66372.

Merge conditions

  1. Rework the Warm rotated solve on the fast path fails at iteration 0 with no cause (pressure sub-KSP DTOL, then NaN) #910 floor so that it is in the sub-solve's units, not ref's. Pressure-only is probably sufficient: the velocity sub-solves never received a round-off right-hand side once the pressure solve was floored. Re-measure 1088 at np 2, 1018, 1115, 1136, and the annulus at A = 1e7 and 1e8, against development.
  2. Add a test that pins F1, for example a cold annulus at A = 1e8 whose sub-KSP counts equal the unfloored ones, or whose velocity error against LU stays at development's level.
  3. Correct the "seven orders below eta·T" text in the policy doc and the docstring.
  4. The m3 commit (005a34b's change) can merge as is, or be split out.
  5. Run review/queue_np4.sh once the core limit allows.

Queued for np 4 (review/queue_np4.sh, not run)

  • 1064, 1088, 1089, 1112 and 1142 at np 4, development and branch, instrumented.
  • test_1157 ×3 and test_1158 ×1, development and branch.
  • W1's probe ×3, development and branch.
  • cache_probe.py on the branch.

Its results land in logs/summary.txt and logs/instr_np4_*, and can be compared with probes/counts.py.

What I could not test

  • np 4 (the core limit).
  • An empty-rank partition with a rotated problem: the fixture needs a one-cell mesh at np 2, or np 3.
  • The mu = 1e-6 accuracy: the LU reference failed there.
  • The power law at A = 1e8 to completion on development and presonly_noscale: more than 1500 s.
  • A fix for F1: only mutants were measured.
  • The science-run configuration itself. My statement that the velocity floor binds there is inferred from the annulus scaling.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Review record, round 2 of 2: 5efb6e5 (the Schur round-off test)

6f13fd6 answers F-A (the velocity KSP release), F-C (the documented margins), F-D (two new guards) and F-E (m3 moved to #1056). The np 2 check of 6f13fd6 follows in a separate comment. Paths under review2/ are on hyperion.


C4 review, round 2: #910 at 5efb6e5 (Schur round-off test)

Reviewed on hyperion, 2026-11-11, serial and np 2 only, at most 2 cores. The build is wt-910 at 5efb6e5, BUILD EXIT 0. The installed rotated_bc.py is byte-identical to git show 5efb6e52:….

Verdict. Not yet. The Schur round-off test fixes #910 and resolves round 1's F1 to F4: cold and genuine solves are untouched at every forcing, and the count-anchored files match development. One blocker is new. tests/parallel/test_1142 fails at np 2 on the branch, 3 runs out of 3, because the test object keeps the velocity sub-KSP alive after the context is destroyed. The fix is two lines, and a candidate passes. Two further findings should be decided before merge: the margin between round-off and genuine right-hand sides is a factor of 2.3 on either side of the threshold, not the 1.8e8 calibration suggests; and one nonlinear warm re-solve costs more than on development.

Method

The round-1 method carries over (see review/c4-review.md). sitecustomize swaps the source at its first import, and swapsrc.py's one-line check is in every log. Tests ran from git archive 5efb6e52 tests; MPI ran under the supervisor.

  • Instrumentation. review2/probes/swapsrc.py wraps _SchurRoundoffTest.__call__. At iteration 0 it records:

    • r0, the threshold norm ‖|A10||x_u|‖ recomputed from getSolution(), and the ratio r0/(eps‖|A10||x_u|‖);
    • whether the test fired;
    • with XUCHECK=1, the relative difference between the test's x_u and the solution of the last velocity application, built by my own monitor at its last iteration;
    • the largest difference between the test's |A10| and |A10| from the A10 the Schur complement holds at that moment (getSchurComplementSubMatrices()[3]).

    Threshold = 1e6, so "margin" below means ratio / 1e6.

  • Variants.

    • "Development" is git show 84179775:…/rotated_bc.py.
    • The mutants are notest, thr1e12, thr1e2, xzero, noabs and everyit. My first everyit commented out .getSolution() and crashed; it was fixed and rerun, and only the rerun is reported.
    • fixrel is my candidate fix for F-A.
    • SELFP=1 replaces _pressure_mass_schur_pmat with a function that returns None, which forces the selfp/jacobi branch.
    • --gamg skips set_custom_fmg, which gives the GAMG velocity fallback.
  • Reference. A direct-LU solve of the same state (_rotated_use_lu, tol 1e-11), velocity relative L2.

Check 1: forcing sweep and margins

Every case was run on the branch and on development, on the test_1157 annulus at tol 1e-6 unless stated. "Fired" counts the Schur solves the test stopped at iteration 0.

Cold solves

The test never fired in any cold solve: 0 of more than 400 cold Schur solves across the probes and the count-anchored files.

case branch = development? velocity error vs LU (both) smallest cold ratio
A = 1e3, 1e6, 1e7, 1e8, 1e10 yes, vel 34 / pres 7 each 1.66e-8 at every A 6.68e14
mu 1e-4, 1e-5 yes (466/15) 3.39e-8, 6.28e-8 6.68e14
mu 1e-6, 1e-8 yes LU reference unusable (inf) 6.68e14, 1.70e14
mu 1e2 yes 5.45e-8 6.68e14
hydrostatic, 1e6 and 1e9 yes (32/7) 7.93e-4 9.07e14
power law, tol 1e-9 (9 Newton steps) yes (757/113) 5.01e-7 2.45e12
selfp yes (58/13) 2.69e-8 6.68e14
GAMG velocity yes (248/7) 5.47e-8 6.61e14
1018 nonlinear tests (43, 19 and 17 increments) yes — 5.65e9
1136 (60 and 110 increments) yes — 5.4e10

This resolves round 1's F1: the A = 1e8 error is 1.66e-8, against 9.34e-7 in round 1.

Warm solves with a genuine pressure correction (did not fire; development iterated as well)

Here r0 = ratio × eps × ‖|A10||x_u|‖, so these are r0 values relative to round-off.

case ratio margin pressure iterations
1.05 v, first warm solve (mu 1, mu 1e2) 1.79e8 179 7
1.05 v, first warm solve, selfp 1.05e9 1050 16
1.05 v, first warm solve, GAMG 3.51e8 351 7
1.05 v, first warm solve, mu 1e-4 / 1e-5 / 1e-6 / 1e-8 2.27e6 to 2.29e6 2.3 7
p reset to cold, v × 11 / 101 / 1001 2.64e6 / 2.30e6 / 2.28e6 2.3 to 2.6 7 or 8
p reset to cold, v × 101, selfp 2.35e6 2.4 17
p reset to cold, v × 101, np 2 7.32e6 7.3 9
p reset, v × 2 9.73e6 9.7 8
warm 1.00001, A 1e8, third warm solve 5.75e6 5.8 3
power law, warm, increments 2 to 4 2.40e7 24 7 to 11
warm 1.0001, second warm solve 1.66e7 17 4
hydrostatic, warm 4.07e9 or more 4000 5

The smallest genuine ratio found is 2.27e6, a margin of 2.3. It is a floor: it does not fall further with viscosity (1e-4 to 1e-8) or with the size of the velocity perturbation (×11 to ×1001). It is the pressure residual a tol-1e-6 solve leaves behind, measured against x_u. W1's 1.8e8 holds for mu = 1 only.

Fired

population ratio when fired development on the same solve effect on the answer
round-off right-hand sides (test_1157 pattern) 3.3 to 6.5 (mu ≤ 1e-4), about 300 (mu 1, 1e2), 363 (GAMG), 1.1e3 (selfp), 8.7e3 (warm 1.0001) 200 cap, or −11 none (error equal to development's)
p reset, v × 11 or × 1001, tol 1e-9 3.0e4, 2.7e4 200 cap × 11: equal (1.56e-8). × 1001: 1.19e-7 against development's 1.28e-8; both meet the outer target (residual 4.45e-7 against 4.34e-7, T 2.4e-5)
1018 workspace-reuse tests 3.93e5, 2.25e4 200 cap test passes
power-law warm, increment 1, outer iteration 1 3.98e5 200 cap equal (8.24e-9), but see F-B
warm 1.000001, tol 1e-9, second and third warm solves 6.19e5 5 iterations equal (1.56e-8), residual equal

The largest fired ratio is 6.19e5, a margin of 0.62. The two populations are therefore separated by a factor of 3.7 (6.19e5 against 2.27e6), with the threshold 1.6 times from each side. Every fire I could construct either replaced a 200-cap grind or left the answer unchanged, except the × 1001 tol-1e-9 case, which is 9 times less accurate than development but within the outer target.

Power law at A = 1e8. The branch timed out at 900 s and recorded nothing. Development timed out at 1500 s in round 1. I could not measure it.

Check 2: count table against development

file, test rank count development / branch fires verdict
1088, direct_lu_path_takes_an_interface_law np 2 vel 425/425, pres 109/109, outer 12/12 0 same (round 1: changed)
1088, the other 12 tests np 2 same 0 same
1064, 9 tests np 2 same, except dynamic_topography vel 1225/1226 0 noise (±1 also between development runs in round 1)
1089, 1112 np 2 same 0 same
1142 np 2 same counts 0 the test fails: F-A
1018, 24 tests, including all 7 nonlinear serial same 0 same (round 1: 9 changed)
1018, workspace_reuses_unchanged_operator serial vel 3995/410, pres 217/17 1, at 3.93e5 round-off (development: 200 cap)
1018, workspace_constant_ramp_invalidates serial vel 4853/869, pres 236/36 1, at 2.25e4 round-off (development: 200 cap)
1136, cap_raised_past_50 serial vel 20940/20976, pres 814/815, Newton and outer same 0 noise: development gave 20973 in round 1
1136, negative_cap serial vel 40912/40978, pres 1565/1567 0 noise, as above
1115 failed_warm_keeps_state, and the other 6 serial same 0 same (round 1: changed)
1087, 1111, 1077 (vector route) serial same 0 same
1142, tight_tolerance[slide3e-05] serial outer 2/1, vel 242/100 0 development-side noise: development was 100 in round 1, and the test never fired
annulus probe, power-law warm re-solve serial outer 3/4, vel 1458/2246, pres 218/218, Newton 3/3 1, at 3.98e5 CHANGED: F-B

Every count difference is either a round-off fire, where development ground to the 200 cap, or run-to-run noise in a test where the test never fired. The one exception is the power-law warm re-solve, F-B.

Check 3: test_1157, test_1158 and W1's probe

run development branch
test_1157 at np 1 (2 tests) 2 failed. Test 1: [(T,3,7),(T,3,200),(T,3,200),(T,3,200)]. Test 2: KeyError: 'schur_roundoff' 2 passed (3 runs)
test_1157 at np 2 2 failed in each of 3 runs. Test 1 has −11; test 2 the KeyError 2 passed in each of 3 runs
test_1158 at np 1 and np 2 failed passed
W1's probe, serial, 10 processes 10 of 10 hit the 200 cap; 8 of 10 fail −11 0 of 10; warm pressure 7, then 0
W1's probe, np 2, 5 processes 5 of 5 hit the cap and fail −11 0 of 5

On development, test_1157's second test fails on the white-box KeyError, not on its accuracy criterion. Its error bound (< 5e-8) would have caught round 1's ref-scaled floor, which was at 9.3e-7 [inferred from round-1 numbers].

Check 4: robustness of the inputs

x_u timing.

  • [read] The configuration is schur_fact_type full. PCFieldSplit's full factorisation solves kspA for x_u, forms b_p − A10 x_u, then solves the Schur KSP. The Schur KSP starts from a zero guess, so no Schur matvec, and so no inner velocity solve, runs before the iteration-0 test.
  • Measured, in 243 serial decisions and the np 2 runs: getSolution() equals the solution of the velocity application immediately before the Schur application exactly (difference 0.0). It was never zero.
  • This depends on the full factorisation and a zero Schur initial guess. A user option that changes either would invalidate the assumption [read]. The comment says so only implicitly.

PC configurations.

  • The test is attached unconditionally on the fieldsplit route (after the cns block).
  • selfp: valid. It fires on round-off (1.13e3) and not on genuine solves (1.05e9, 2.35e6). Development ground to 200 in three of three warm solves; the branch ran 0 iterations with the same error.
  • GAMG fallback: the same (fires at 363; genuine 3.51e8; development 5839 velocity iterations).
  • LU route: no fieldsplit, so no test [read]. The 1088 LU test is unchanged.
  • Vector route: no sub-KSPs [read]. 1077 is unchanged.
  • Adjoint: solve_rotated_adjoint builds its context through _solve_rotated_iterative, so it gets the test too [read]. The adjoint files pass (Check 6).

|A10| refresh. The difference between the test's |A10| and the Schur complement's current A10 was 0.0 in every decision:

  • power-law Newton (9 increments);
  • the 1018 nonlinear tests (up to 43 increments);
  • 1018's workspace_deform_invalidates (geometry move);
  • 1087's moving fault;
  • 1088 and 1089 at np 2.

[read] refresh runs whenever refresh_operator is true. The fast path skips it, which is correct because the operator is unchanged there.

Collectives.

  • [read] __call__ runs on every rank; mult and norm are collective, and the decision uses the global rnorm and the global norm.
  • Measured: 272 np 2 decisions, 0 disagreements between ranks, and ratios bit-identical across ranks.

Check 5: mutants

mutant test_1157 probe behaviour caught?
no test test 1 fails (−11) development's behaviour yes
threshold 1e12·eps test 1 fails (records[0][2] > 0, the genuine warm solve skipped) fires on genuine 1.79e8 and 2.30e6; × 101 error 8.31e-7 against 8.56e-8 yes
threshold 1e2·eps test 1 fails (200 cap) does not fire at about 300 yes
x_u = 0 test 1 fails (−11) never fires yes
|A10| without abs passes threshold about 5 times smaller (round-off ratio 1.68e3 against 300); still fires on round-off; does not fire on the power-law 3.98e5 case, so it avoids F-B no
fires at every iteration passes stops genuine solves early: first warm pressure solve 7 → 2, cold power law vel 757 → 669, × 101 error 1.02e-7 against 8.56e-8 no

Check 6: regressions

  • Parallel rotated files at np 2, branch. All pass except 1142: 1063, 1064, 1066, 1068, 1086, 1088, 1089, 1112, 1116, 1131, 1140, 1144, 1147, 1156.
  • Serial set, branch. All 36 files pass, 274 tests in total: adjoint 0018 to 0026, 0062, 0762, faults 0845 to 0866, 1018 every_rheology and nodal_normal, 1029, 1060, 1061, 1065, 1066, 1079, 1085, 1113, 1131, 1141, 1143, 1145. In the adjoint files (0022_rotated_adjoint, 1145) the test never fired; the smallest ratio was 2.99e12.
  • Serial count files, branch: 1018, 1136, 1115, 1087, 1111, 1142 and 1077 all pass.

Status of round-1 findings

  • F1 (floor in the wrong units): resolved. Cold solves are identical to development at every A and viscosity; 1088, 1018 nonlinear, 1115 and 1136 match development within noise.
  • F2 (doc claims): resolved. The "seven orders" text is gone. The new paragraph describes the test and its scale. It repeats W1's calibration (1.8e8 genuine), which this review shows is 2.3e6 at low viscosity: see F-C.
  • F3 (tests do not pin the units): resolved for the units. test_1157's second test pins the large-forcing cold solve. Two mutants still survive: F-D.
  • F4 (no absolute floor works): resolved. The scale is the sub-solve's own.

New findings

  • F-A (high, blocker): parallel release regression. tests/parallel/test_1142 fails at np 2 in 3 runs out of 3 (released == [False, False]), with and without instrumentation. It also fails with the test object built but not attached (the notest mutant); it passes on development.
    • Cause [read]: _SchurRoundoffTest holds self.vel_ksp. _destroy_rotated_ksp_ctx destroys it last and only drops the reference. In parallel, petsc4py defers the destruction of a dropped reference, as that function's own comment says, so the velocity sub-KSP, its projection PC and the multigrid it wraps survive the context destroy.
    • Candidate fix (fixrel): destroy schur_roundoff first in _destroy_rotated_ksp_ctx, and call self.vel_ksp.destroy() in its destroy(). With it, 1142 at np 2 passes 2 of 2 and test_1157 at np 2 passes. CI's shard 4 runs tests/parallel, so it would catch this.
  • F-B (medium): one nonlinear warm re-solve costs more.
    • Case: the power-law annulus at tol 1e-9, warm re-solve. Newton steps are the same (3); outer KSP goes from 3 to 4; velocity sub-iterations go from 1458 to 2246 (+54 %), the same at np 2 (2121).
    • The test fires at 3.98e5 on the first outer iteration, where development's Schur solve ran to the 200 cap. The residual passes to the next outer Krylov vector, and that Schur solve (ratio 7.3e16) runs to the 200 cap as well.
    • So in this nonlinear warm case, Warm rotated solve on the fast path fails at iteration 0 with no cause (pressure sub-KSP DTOL, then NaN) #910's grind to the cap is not removed, only moved. The final error is the same (8.24e-9). The noabs mutant, which does not fire here, has development's counts.
  • F-C (medium): the margin is narrow.
    • The smallest genuine ratio is 2.27e6 (factor 2.3 above the threshold). It is reached at viscosity 1e-4 and below, and for any large warm perturbation with p from a tol-1e-6 solve.
    • The largest fired ratio is 6.19e5 (factor 1.6 below). The populations are 3.7 apart, not about 1e4 apart as the calibration in the comment and the doc implies.
    • Firing on a genuine solve was measured with the 1e12 mutant: the error grows up to 10 times but stays within tolerance. The comment and doc should state the measured range, and the second test could pin a low-viscosity genuine warm solve (mu 1e-4, ratio 2.3e6).
  • F-D (low): surviving mutants. "Fires at every iteration" and "|A10| without abs" both pass test_1157. A test asserting that the first genuine warm solve takes development's 7 pressure iterations, rather than just more than 0, would catch the first.
  • F-E (low, process): the branch still carries m3. 005a34b (same_kernels) and test_1158 are still in 5efb6e5, although m3 was split out as PR Rotated workspace: reuse the coefficient enumeration only for the same kernels (#546) #1056. Either rebase it out or merge Rotated workspace: reuse the coefficient enumeration only for the same kernels (#546) #1056 first, to avoid a duplicate change.
  • F-F (information). x_u's provenance depends on the full factorisation and a zero Schur initial guess. Both are set by this module, and it would help to state that in the class comment.

Merge conditions

  1. Fix F-A (fixrel or equivalent) and rerun tests/parallel/test_1142 at np 2 and np 4, plus test_1144.
  2. Decide F-B: either accept it and document it, or keep the cap from recurring on the next outer iteration.
  3. Correct the calibration statement (F-C) in the class comment and the policy doc, and consider pinning a low-viscosity genuine warm solve in test_1157.
  4. Resolve F-E: m3 should go in through Rotated workspace: reuse the coefficient enumeration only for the same kernels (#546) #1056 only.
  5. Run the round-2 block of review/queue_np4.sh. It is extended for this round; the round-1 block is marked superseded, because wt-910 now builds 5efb6e5.

Queued for np 4 (not run)

The round-2 block of review/queue_np4.sh:

  • 1064, 1088, 1089, 1112 and 1142 at np 4, development and branch;
  • test_1157 ×3, development and branch;
  • W1's probe ×3, development and branch.

What I could not test

  • np 4.
  • The power law at A = 1e8 (more than 900 s on the branch, more than 1500 s on development).
  • Accuracy at viscosity 1e-6 and 1e-8: the LU reference fails there. The counts and fires were measured.
  • An empty-rank partition.

Process notes

  • Core use. About 2 cores throughout. Two exceptions: around 1 minute at 3 cores while a 1142 diagnostic overlapped a serial file (the process I meant to pause had already exited), and test_1064's serial-reference child.
  • Writes. Nothing was written outside review2/, with two exceptions: the round-2 block appended to review/queue_np4.sh, with its note, and the mesh and XDG caches that activate.sh points at runs/2026-11-06/cache-r910, as in round 1.

Underworld development team with AI support from Claude Code


Addendum: threshold data (review2/thresholds.md)

This uses round-2 data only; no new runs. The branch is 5efb6e5 and development is 8417977's rotated_bc.py.

The ratio is r0/(eps·‖|A10||x_u|‖) at the Schur solve's iteration 0, as the branch measured it. Each branch decision is paired with development's pressure application on the same solve: the same case, the same solve index and the same outer iteration. The pairing script is probes/pair.py, and its output is logs/pairs.json, with 833 paired decisions.

Caveat on the pairing. In the W1-probe and test_1157 warm sequences, development's state diverges from the branch's after development's first failure, because the next warm solve starts from a different p. Those later pairs are the same solve index, not an identical state.

1. Development failed −11 or hit the 200 cap on the same solve

case np ratio (branch) development on that solve fired on branch
W1 probe (1.05 v, p from the previous solve), warm 1 to 5, 10 processes 1 300 to 301 200 cap (16 solves), −11 (32 solves) yes, all 48
W1 probe, warm 1 to 5, 5 processes 2 104 200 cap (5), −11 (20) yes, all 25
test_1157 test 1, warm 1 to 3 1 300 200 cap (3) yes
test_1157 test 1, warm 1 to 3 2 104 200 cap (1), −11 (2) yes
annulus A = 1e3, 1e6, 1e7, 1e8, 1e10, warm 1 1 300, 300, 304, 302, 301 200 cap yes
mu 1e2, warm 1 and 2 1 303 200 cap yes
mu 1e-4, warm 1 1 3.3 200 cap yes
mu 1e-5, warm 1 / warm 2 1 2.44 / 2.44 −11 / 200 cap yes
mu 1e-6, warm 1 and 2 1 3.99 −11 yes
mu 1e-6 with A 1e8, warm 1 1 3.42 −11 yes
mu 1e-8, warm 1 and 2 1 6.51 −11 yes
selfp, warm 1 to 3 1 1.13e3 200 cap yes
GAMG velocity, warm 1 and 2 1 363 200 cap yes
p reset, v × 11, tol 1e-9, warm 0 and 1 1 3.02e4 200 cap yes
p reset, v × 1001, tol 1e-9, warm 0 and 1 1 2.71e4 200 cap yes
test_1018 workspace_constant_ramp_invalidates 1 2.25e4 200 cap yes
test_1018 workspace_reuses_unchanged_operator, solve 3 1 3.93e5 200 cap yes
test_1158, solve 2 1 6.49e5 200 cap yes
test_1158, solve 2 2 1.37e6 200 cap no: the branch solved it in 29 iterations
test_1018 geometric_fmg_velocity_block, cold 1 2.36e14 200 cap no (genuine; both cap)
mu 1e-8, cold, 99 outer iterations 1 1.7e14 to 2.0e15 200 cap no (genuine; both cap)

2. The two fires named in the request

case np ratio development on that solve fired
F-B: power law, tol 1e-9, warm re-solve, increment 1, outer iteration 1 1 3.98e5 200 cap (converged in the end: 3 Newton, 3 outer, vel 1458) yes; the branch then needs an extra outer iteration, which also hits the cap (vel 2246)
warm 1.000001, tol 1e-9, warm 1 and 2 1 6.19e5 5 iterations, converged, same error (1.56e-8) yes (vel 21 → 6)

3. Ratios on the −11 solves alone

The −11 solves span ratios 2.44 to 301 at np 1 and 104 at np 2, across 60 decisions.

The low end is the low-viscosity cases (2.44 to 6.51), and the high end is the mu = 1 W1 probe (300 to 301). Every −11 case is at least 330 times below a 1e5 threshold.

4. What a 1e5 threshold would no longer catch

All the −11 cases stay caught, and so do all the 1157-pattern 200-cap cases. Their ratios are at most 1.13e3, and the tol-1e-9 reset-p cases are at 2.7e4 to 3.0e4.

The test_1018 workspace_constant_ramp case (2.25e4) is still caught.

Lost at 1e5. These are all the fires between 1e5 and 1e6. In each case development converges, so the outcome stays correct and only the cost changes:

case np ratio cost at 1e5, assuming the solve behaves as development's does cost at 1e6 now
test_1018 workspace_reuses_unchanged_operator, solve 3 1 3.93e5 vel 3623, pres 200 (the cap), converged (development's numbers) vel 38, pres 0
test_1158, solve 2 1 6.49e5 vel 5301, pres 200 (the cap), converged vel 44, pres 0
F-B power law, warm re-solve 1 3.98e5 3 outer, vel 1458, pres 218, err 8.24e-9 (development) 4 outer, vel 2246, pres 218, err 8.24e-9. 1e5 is cheaper here
warm 1.000001, tol 1e-9 1 6.19e5 vel 21, pres 5 per solve, err 1.56e-8 vel 6, pres 0, err 1.56e-8

The noabs mutant shifts the ratio up by about 5 times, which is roughly a 2e5 threshold. It does not fire on the F-B case, and it reproduces development's 1458 there. It still fires on every 1157-pattern case. That corroborates the F-B row.

The ratio depends on the rank count near the threshold. test_1158's solve 2 measures 6.49e5 at np 1 but 1.37e6 at np 2. At 1e6 it fires at np 1 and not at np 2; at 1e5 it fires at neither. Without the fire, the branch solved it in 29 iterations at np 2 where development capped. So round-off cases in the 1e5 to 2e6 band do not always cap without the test.

Effect on genuine solves. None get worse at 1e5. The smallest genuine ratio is 2.27e6, so the margin grows from 2.3 to 23.

Plain answer. A 1e5 threshold still catches every development −11 failure measured (ratios at most 301) and every test_1157-pattern cap. It gives up:

  • the test_1018 workspace_reuses_unchanged_operator fire (3.93e5): that solve goes back to a 200-iteration pressure cap, about 3600 velocity iterations instead of 38, but still converges;
  • the np-1 test_1158 fire (6.49e5): the same kind of cap, about 5300 instead of 44;
  • the 6.19e5 fire, which is harmless either way.

The test_1018 constant_ramp fire (2.25e4) is unaffected. In exchange, F-B goes away, with development's cost restored, and the genuine margin goes from 2.3 to 23.

Underworld development team with AI support from Claude Code

@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Check of 6f13fd6 at np 1 and np 2

The build is fresh at 6f13fd6 (wt-910c). Tests ran from a git archive copy under mpi_supervisor.py.

test np 1 np 2
tests/parallel/test_1142 skipped (parallel only) 1 passed on both ranks; failed 3 of 3 on 5efb6e5 (F-A)
tests/parallel/test_1144 skipped 1 passed on both ranks
tests/test_1157 (3 tests) 3 passed 3 passed on both ranks

F-A is fixed. Against its merge-base with development, the branch now contains only #910: rotated_bc.py, test_1157, the policy doc and the test.sh line.

The np 4 runs of these three files, and the round-2 np 4 queue, are owed. They wait until the core budget on hyperion allows, and will be posted here.

Underworld development team with AI support from Claude Code

… per-solve and per-test counts

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

np 4 record: 6f13fd6 (src as ab48189)

At np 4, on every rank and the same fresh build as the np 2 check:

  • tests/parallel/test_1142: 1 passed;
  • tests/parallel/test_1144: 1 passed;
  • tests/test_1157: 3 passed.

The count comparison against development follows. Paths are on hyperion, in runs/2026-11-11-910/review2/np4/.


#910 at np 4: branch against development

The runs were on hyperion, 2026-11-11, one np 4 job at a time.

Cells below are development/branch. "Fires" counts the branch's Schur round-off test firing at iteration 0.

file or run tests Newton outer KSP vel sub its pres sub its fires result
1064 (9 tests) pass/pass same same same (1150, 489, 80, 80, 844, 512, 2594, 1150, 1150) same 0 same
1088 (13 tests) pass/pass same same same; interface-law test 437/437 same; interface-law test 110/110 0 same
1089 (4 solving tests) pass/pass same same same (142, 2286, 78, 183) same 0 same
1112 pass/pass 1/1 1/1 44/44 9/9 0 same
1142 pass/pass 1/1 1/1 80/80 18/18 0 same; the release check passes
test_1157 ×3 development 3 failed ×3; branch passed (your run) — — — — — development: test 1 [(T,3,9),(T,3,200),(F,-11,90),(F,-11,30)]; tests 2 and 3 KeyError: 'schur_roundoff' (white-box)
W1 probe ×3 (cold, then 6 warm at 1.05 v) — 1 each 1 each development 44, 44, 832, 533, 128 ×3 / branch 44, 44, 8 ×5 development 9, 9, 200, 90, 30 ×3 / branch 9, 9, 0 ×5 5 per run, at 149 changed: round-off fires. Development: 3 of 3 runs cap at 200, then fail −11 on warm 3 to 6. Branch: 0 of 3 fail
test_1158 pass/pass 1 each 1 each 11604/832 428/28 2, at 8.29e5 and 2.4e5 changed: round-off fires. Development caps at 200 on both solves

Changes. There are two, both round-off fires, and both replace a development pressure solve that capped at 200 or failed −11: the W1 probe and test_1158. Nothing else moved; no parallel file has a fire or any change in counts.

Ratios for genuine solves.

  • The first warm solve of the probe has a ratio of 5.03e8, so it does not fire.
  • Cold ratios in the parallel files range from 3.2e13 to 1.2e15.
  • The nonlinear box in 1064 goes down to 6.18e11.

test_1158 at np 4. The ratio on solve 2 is 8.29e5, below 1e6, so the test fires; solve 3 is 2.4e5. At np 1 the same solve measured 6.49e5 (fired), and at np 2 it measured 1.37e6 (did not fire, solved in 29 iterations). It sits in the band where the ratio straddles the threshold with rank count. A 1e5 threshold would fire on it at no rank count.

Rank uniformity. In 85 np 4 decisions, all four ranks agreed on whether to fire, and the ratios were bit-identical. x_u equalled the preceding velocity solve's solution, and |A10| matched the operator, in every decision.

Core use. One np 4 job at a time. During the two test_1064 runs, its serial-reference child briefly made it 5 processes.

Underworld development team with AI support from Claude Code

One conflict, in the test list: both entries kept.

Underworld development team with AI support from Claude Code
@lmoresi
lmoresi merged commit ca2a9ee into development Nov 12, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants