Repository navigation
Description
tests/test_0022_rotated_adjoint.py takes 18 to 52 minutes depending on the BLAS kernel, because the last Newton step of each forward solve runs its linear solve past round-off. It is the same failure as #911, and this issue is its cost on CI. #967 does not change it: this fixture has no null space, by its own comment, and the iteration counts on Nehalem and Zen are identical with and without #967's fix.
Where the time goes
All of it is in the module-scoped rotated_gradient fixture, in its four forward solves. Log of one run, eddab70, Nehalem, 27:26 in all with logging on:
| solve | last Newton step's outer iterations | outer reason | Newton reason | wall |
|---|---|---|---|---|
solve_at(0.05) |
110 | -11 | -6 | 642 s |
J_at(ETA_1) |
300 (cap) | -3 | -6 | 847 s |
J_at(ETA_1 + FD_STEP) |
28 | -11 | -6 | 86 s |
J_at(ETA_1 - FD_STEP) |
23 | -11 | -6 | 59 s |
| the two adjoint solves | 2 | under 1 s |
In every solve the first five Newton steps take one outer iteration each and reach about 1e-10 of the reference residual. A solve in this file with six such steps takes 3.7 s, so the last step is nearly all of the cost. Its starting state, from solve_at(0.05):
it=4 rnorm=9.837e-05 rel=2.094e-05 lin_its=1 reason=2
it=5 rnorm=1.151e-09 rel=2.450e-10 lin_its=110 reason=-11 |d|=inf
In J_at(ETA_1) that step ends with |d| = 5.7e8 at reason -3; in the other three, |d| = inf at reason -11. The rotated loop's tolerances are rtol 1e-11 and atol 1e-11, so it asks for one more step. My reading, not tested: that step's relative target is 1e-11 of 1e-9, about 1e-20 absolute, which the linear solve cannot reach.
Do the inner solves run to their caps?
Pressure does; velocity does not. So this differs from #963, where the velocity block stalled. Totals for a whole run of the file:
| kernel, tree | wall | last-step outer its, 4 solves | pressure solves at the 200 cap | outer at the 300 cap | velocity its, total | velocity max (cap 200) |
|---|---|---|---|---|---|---|
| Nehalem, eddab70 | 18:37 | 110, 300, 28, 23 | 465 of 493 | 1 | 7.17M | 141 |
| Nehalem, #967 at 488c53b | 21:52 | same | 465 of 493 | 1 | 7.17M | 141 |
| default, eddab70 | 28:26 | 23, 300, 179, 212 | 718 of 746 | 1 | 9.28M | 140 |
| default, #967 | 30:10 | 33, 300, 179, 212 | 728 of 756 | 1 | 9.53M | 139 |
| Zen, eddab70 | 47:12 | 5, 300 + 300, 300, 300 | 1208 of 1235 | 4 | 15.17M | 138 |
| Zen, #967 | 52:07 | same | 1208 of 1235 | 4 | 15.17M | 138 |
Six serial runs at once on one machine, with converged_reason logging. Each pressure iteration costs 60 to 74 velocity iterations, so wall time follows the velocity total, at 156 to 187 us per iteration. The kernel sets how long that last solve runs before it breaks down: on Nehalem 3 of the 4 solves break down on a NaN (-11) early; Zen mostly goes on to the outer cap. A velocity solve ends DIVERGED_NANORINF 1 to 3 times per run, the same count as the outer -11s.
Load matters too. Earlier uninstrumented runs of the same trees, at a different load: #967 Nehalem 22:10, Zen 42:22, default 52:14; eddab70 Zen 45:22, default 30:33, Nehalem 30:00. Same tree and kernel, default moved from 30:10 to 52:14.
On CI
Shard 4's first batch, which holds this file, ranged from 541 to 1678 s over CI runs on nearly the same tree, so no single merge is at fault. I did not measure which kernel CI's runners select, nor the iteration counts there. A fifth shard is coming to hold this file; that moves the cost and does not reduce it.
Also worth knowing
- All four forward solves end
snes_reason=-6and with the last accepted iterate, at about 1e-10 and not the 1e-11 asked for. Nothing in the file reads that:test_the_adjoint_ksp_convergedchecks only the adjoint's reason. All 7 tests pass, and the gradient matches its finite difference within the 2e-3 bound. - Rotated solve past round-off fails its last linear solve; since #907 a time loop rebuilds its KSP every step #911 reports 1e-6 and 1e-9 converging on this fixture. I did not try a tighter stopping test (Rotated solve past round-off fails its last linear solve; since #907 a time loop rebuilds its KSP every step #911's option 1) or a looser fixture tolerance here, so I can't say what either does to this time or to the gradient check.
Evidence: serial, Linux, conda-forge PETSc 3.25.3, through an overlay adding ksp_converged_reason to each rotated solve's prefix and a line per Newton step. OPENBLAS_CORETYPE set for each kernel, "default" unset.
Underworld development team with AI support from Claude Code
Activity
lmoresi commentedon Nov 6, 2026
Tracked under #911, at the hub's direction; the measurements are also posted there. This stays open until #911's fix lands.
Underworld development team with AI support from Claude Code
lmoresi commentedon Nov 8, 2026
Fixed in #1014 (
feature/convergence-reference-policy), which carries the evidence table. Labelled fixed-in-PR.Underworld development team with AI support from Claude Code
Merge pull request #1014 from underworldcode/feature/convergence-refe…
Design: one convergence reference for every solver (underworldcode#911)
CI gets a fifth shard: test_108*/test_109* leave shard 3