Repository navigation
Rotated solve: the Schur sub-solve stops at iteration 0 when its right-hand side is round-off of its own terms (#910) - #1061
Conversation
…'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
Review record, round 1 of 2: 4d66372 (src as 005a34b), pre-PRThis 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 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
The m3 commit is sound and could merge on its own. Method
Check 1: iteration counts, branch against developmentnp 2, count-anchored parallel filesAll 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.
(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
(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 Annulus sweep (test_1157 fixture, tol 1e-6, reference: direct LU of the same state)
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
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
Check 4: the vector route[read] 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
W1's behavioural claim holds: 2 increments against 1, the same answer. Can the JIT-key comparison be rank-divergent?
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 m1, measured at np 1 and np 2, the same on development and the branch:
W1's m1 verdict is confirmed. Check 6: regressions
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
Merge conditions
Queued for np 4 (
|
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 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 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. MethodThe round-1 method carries over (see
Check 1: forcing sweep and marginsEvery 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 solvesThe test never fired in any cold solve: 0 of more than 400 cold Schur solves across the probes and the count-anchored files.
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.
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
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
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
On development, test_1157's second test fails on the white-box Check 4: robustness of the inputsx_u timing.
PC configurations.
|A10| refresh. The difference between the test's |A10| and the Schur complement's current A10 was 0.0 in every decision:
[read] Collectives.
Check 5: mutants
Check 6: regressions
Status of round-1 findings
New findings
Merge conditions
Queued for np 4 (not run)The round-2 block of
What I could not test
Process notes
Underworld development team with AI support from Claude Code Addendum: threshold data (
|
| 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
Check of 6f13fd6 at np 1 and np 2The build is fresh at 6f13fd6 (wt-910c). Tests ran from a
F-A is fixed. Against its merge-base with development, the branch now contains only #910: 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
np 4 record: 6f13fd6 (src as ab48189)At np 4, on every rank and the same fresh build as the np 2 check:
The count comparison against development follows. Paths are on hyperion, in #910 at np 4: branch against developmentThe 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.
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.
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
A warm rotated free-slip re-solve whose pressure equations already hold hands the pressure (Schur) sub-solve
b_p - A10 x_uwithb_pat round-off.A10 x_uis 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._SchurRoundoffTestis prepended on the pressure sub-KSP. At iteration 0 it comparesr0with1e6 eps || |A10| |x_u| ||, wherex_uis the velocity sub-KSP's solution, and stops the sub-solve ifr0is 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):
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.
Counts against development
Hyperion's round-2 record, serial and np 2:
Tests
tests/test_1157_rotated_warm_resolve_at_roundoff.py(new, tier B):The #546 m3 commit this branch first carried merged separately in #1056.
Issues
Underworld development team with AI support from Claude Code