Skip to content

test_0022 takes 18 to 52 minutes by BLAS kernel: its last Newton step solves past round-off, with pressure at its cap #985

Open

Description

@lmoresi

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

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.

Refs #911, #963, #967

Underworld development team with AI support from Claude Code

Activity

  1. lmoresi commented on Nov 6, 2026

    @lmoresi
    MemberAuthor

    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

  2. added
    fixed-in-PR
    on Nov 8, 2026
  3. lmoresi commented on Nov 8, 2026

    @lmoresi
    MemberAuthor

    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

  4. added a commit that references this issue on Nov 8, 2026
  5. added
    fixed-in-development
    and removed
    fixed-in-PR
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed-in-development

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions