Skip to content

Adjoint gradients are right in a units model, and the datum sensitivity runs in parallel (#763, #1048, #1067) - #1071

Merged
lmoresi merged 5 commits into
developmentfrom
bugfix/adjoint-sensitivity-frame-763-1048
Nov 11, 2026
Merged

lmoresi merged 5 commits into
developmentfrom
bugfix/adjoint-sensitivity-frame-763-1048

Conversation

@lmoresi

@lmoresi lmoresi commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Adjoint gradients are right in a model with reference quantities, and the Dirichlet-datum sensitivity runs in parallel. Fixes #763, #1048 and #1067, and the sinker_transcript example's units failure.

What was wrong

The adjoint state, the residual templates and the duals all live in the frame PETSc assembles in. Several sites read numbers back through the dimensional gateway instead, or did not run at all.

Site Effect, measured
sensitivity() (volume and facet), and TranscriptAdjoint.gradient's J and explicit dJ/dm, took float(Integral.evaluate()), which re-dimensionalises and labels the result in coordinate units (#763) dJ/dα with a dimensional viscosity came back 1e21 too large, the viscosity reference. A misfit carrying a coordinate was off by the length scale. A transcript in a units model was off by 3.3e19.
_essential_datum_sensitivity evaluated the datum's derivative with uw.function.evaluate (#1048) 9.0e8 too large on a 30 km box, which is (L in m)²
_essential_datum_owner guarded getStratumIS with is None (#1067) segfault at np ≥ 2 on any rank holding no point of the boundary, with or without units
_essential_datum_sensitivity evaluated the datum's derivative once per owned node with a datum reading a mesh variable, the evaluation is collective, so at np ≥ 2 the ranks hung
TranscriptAdjoint._linearise_at restored a history through .array "Cannot assign plain array ... when units are active": sinker_transcript/taylor_test_library.py failed
the peels stopped after 8 levels a misfit or residual named more than 8 levels deep had dJ/dα = 0, silently

The change

  • The raw integral. Integral and BdIntegral keep PETSc's number in a private _integrate(), which evaluate() then labels. evaluate()'s output is bitwise unchanged. adjoint.integral() returns _integrate(), and every adjoint site goes through it.
    • non_dimensionalise(evaluate()) is not that number. A first attempt used it, and H1's review measured traction ×30 and field duals ×900 off.
  • The datum derivative is evaluated by adjoint._value_at, in the frame the JIT compiles it in: evaluate_nd of _unwrap_for_compilation(..., keep_constants=False).
  • _essential_datum_owner asks the rank's own value set before getStratumIS, and tests the IS itself, as rotated_bc does.
  • _essential_datum_sensitivity evaluates each condition and component once, on every rank and in the same order, whether or not the rank owns any of its nodes.
  • _linearise_at copies a field to its own history through .data. That is a raw copy inside the solver's frame, the one the Charter sanctions, and it is also what the solver reads.
  • The peels expand to the end. They raise RecursionError past 64 levels, rather than stopping at 8 and returning a half-expanded expression.

Tests

  • tests/test_0033_adjoint_gradients_in_a_units_model.py (tier B), with references of 30 km and 1e21 Pa s:

    • dJ/dα against central differences for a dimensional viscosity, a datum, a traction, a dimensional traction and an explicit misfit;
    • J and dJ/dα equal to the same problem without references.

    All the original cases fail on development. The two added from H1's review each fail under the mutant that sends their term back through evaluate().

  • tests/test_0034_transcript_adjoint_in_a_units_model.py (tier B): test_0020's rig in a units model, against central differences. It raised before.

  • tests/parallel/test_0035_adjoint_datum_sensitivity_parallel.py (tier B): a lid-datum gradient against central differences, for a coordinate datum and a datum that reads a mesh variable, with and without units.

  • tests/test_0032 gains a misfit named ten levels deep, which gave 0 before. It also pins that a 64-level chain expands fully and that a self-reference raises.

  • docs/examples/adjoint/fault_segments/fault_friction.py -uw_check_only 1: adjoint/FD 0.99999 to 1.00000, as on development.

  • sinker_transcript/taylor_test_library.py: adjoint/FD 0.99947, 1.00000, 1.00000 for h = 5, 0.5, 0.05 km.

  • 129 serial files (adjoint, transcript, Integral and BdIntegral users, custom MG): 1163 passed, 0 failed.

  • Adversarial review (H1, three rounds): the records are in runs/2026-11-11-h3/763-1048-review.md on hyperion. In summary:

    • every units mode and case matches FD at np 1;
    • nine datum forms are fixed;
    • the SUPG units transcript is at 0.99999998;
    • the np 2 timeouts match development exactly;
    • round 3 found the field-datum hang above (now fixed), and the depth bound.

Not in this PR

Checklist (UW3 Style Charter)

  • I have read the Style Charter and followed it over the surrounding code
  • No drive-by refactors, renames, or cleanups
  • Bug fixes ship their regression tests, written first, with level_* and tier_* markers
  • No hedging names, and no commented-out code
  • No new exception swallows
  • Data access: the one .data use is the Charter's sanctioned raw copy inside the non-dimensional boundary
  • Parallel: np 2 and np 4 checked for the datum path; test_0033 at np 2
  • No dependency changes
  • AI-assisted work carries the attribution line

Underworld development team with AI support from Claude Code

)

The adjoint state, the residual templates and the duals all live in the
frame PETSc assembles in. Two kinds of site read numbers back through the
dimensional gateway instead:

- J, the volume and facet sensitivities and TranscriptAdjoint's explicit
  term took float(Integral.evaluate()), which re-dimensionalises and labels
  the result in the mesh's coordinate units. A dimensional viscosity
  alpha*eta gave dJ/dalpha 1e21 too large (#763); a misfit carrying a
  coordinate gave J off by the length scale.
- _essential_datum_sensitivity read the datum's derivative through
  uw.function.evaluate, re-dimensionalised to m**2: 9e8 too large on a
  30 km box (#1048).

Integral and BdIntegral keep PETSc's number in a private _integrate(),
which evaluate() then labels; adjoint.integral() returns it, and every
adjoint site goes through adjoint.integral(). The datum derivative is
evaluated by adjoint._value_at, in the frame the JIT compiles it in.
(non_dimensionalise of evaluate() is not that number: H1's review of the
first attempt measured traction x30 and field duals x900 off.)

test_0033 (tier B): with references 30 km and 1e21 Pa s, dJ/dalpha
against central differences for a dimensional viscosity, a datum and a
traction, and J and dJ/dalpha equal to the same problem without
references. All five failed on the #765 branch. fault_friction.py
-uw_check_only 1: adjoint/FD 0.99999 to 1.00000, as on base. H1's frames
probe: every mode and case matches FD except flag-off with a 1e22
viscosity, which is the forward solve's conditioning, as on base.

Underworld development team with AI support from Claude Code
TranscriptAdjoint._linearise_at saves the field a history tracks before
replaying a solve, and writes it back into psi_star[0] afterwards. It went
through .array: np.array of the view dropped the units, and the write back
was refused ("Cannot assign plain array ... when units are active"). That
happened when the field carried units, and also when the field had none
but its history was built in 'dimensionless'. The sinker_transcript
example's taylor_test_library.py failed that way (found by H1).

The copy is now raw, through .data: a field and its own history hold
non-dimensional values in one layout, which is also what the solver reads.

test_0034 (tier B): test_0020's rig in a units model, the level set in K,
dJ/deta against a central difference. It raised before the fix.
taylor_test_library.py: adjoint/FD 0.99947, 1.00000, 1.00000 for h = 5,
0.5, 0.05 km. 42 serial adjoint and transcript files: 554 passed.

Underworld development team with AI support from Claude Code
_essential_datum_owner asked for each boundary's points with
getStratumIS and guarded with `is None`. On a rank holding no point of
that boundary, PETSc hard-aborts for a value missing from the rank's own
value set, and otherwise returns an IS wrapping a NULL handle, not None,
whose first use segfaults: every datum sensitivity died at np >= 2, with
or without units. The rank's value set is now asked first and the IS
itself tested, as rotated_bc already does.

tests/parallel/test_0035 (tier B): a lid-datum gradient against central
differences, with and without units; it aborted (exit 59) before, and
passes at np 2 and 4. test_0026 and test_0033 now also pass at np 2.

test_0033 gains a dimensional traction and an explicit misfit (H1's review
F2): each now fails under the mutant that sends its term back through
evaluate(), which before survived the test.

129 serial adjoint, transcript, Integral and custom-MG files: 1158 passed.

Underworld development team with AI support from Claude Code
The peels stopped after eight levels and returned what was left, so a
misfit or residual named more deeply kept a name in front of its field,
the derivative through it was zero, and the gradient came back silently 0
(H1's review, F2 on #1047). They now run until nothing is left to expand,
and raise RecursionError past 64 levels rather than return a half-expanded
expression.

test_0032 gains a misfit named ten levels deep: dJ/dalpha was 0.0 before.
129 serial adjoint, transcript, Integral and custom-MG files: 1159 passed,
none raising RecursionError.

Underworld development team with AI support from Claude Code
@lmoresi

lmoresi commented Nov 11, 2026

Copy link
Copy Markdown
Member Author

Adversarial review (H1 worker), rounds 1 and 2, from runs/2026-11-11-h3/763-1048-review.md on hyperion

Round 2 reviewed ead0914. After it, this branch added the #1067 fix (np 2 datum), the two test_0033 cases from F2, and the peel depth fix, all listed in the PR body.

Adversarial review: 4437bc0 (#763, #1048), bugfix/adjoint-sensitivity-frame-763-1048

FROM H1 worker TO H3 units | ORIGIN H3 (review request, ed019ce rebased to 4437bc0) | RE 4437bc0, #763, #1048

Verdict

The fix is right: merge after #1047 is repaired and two test cases are added. Every gradient term we
could reach matches central differences in every frame (no units, scaling on, scaling off), including
TranscriptAdjoint. J equals the no-units J of the same problem, and Integral.evaluate() returns exactly
what it did before. The branch inherits #1047's #1019/#1020 revert (test_1149 red, see the #1047 record),
and test_0033 misses two of the four sites the change converts.

Method

  • Builds: wt-h763 at 4437bc0, against wt-h765d at 08bc58b, its parent, as "before". The r765 record
    holds development 8f0ed0a numbers for the same probe. No rebuilds.
  • Tests from git archive 4437bc01 tests (src-h763/). The same test copy ran on both builds, so the "before"
    runs execute the branch's tests against the parent library. We used PYTHONDONTWRITEBYTECODE=1 and
    -p no:cacheprovider, and MPI ran under mpi_supervisor.py --silence 600.
  • Mutants are runtime pytest plugins in plugins/ (mut_sites.py, mut_datum.py). Probes and their output
    are in probes/, and logs in logs/.

Checks

4. H3's evidence, reproduced

p_grad_frames.py (from r765, unchanged), every mode and case. These are adjoint/FD ratios
(probes/grad/h763_*.out, h763plain_*.out).

case none on off r765, development 8f0ed0a (on / off)
visc 0.99999999 0.99999999 0.99999999 0.0333 / 1
visc_dim (α·1e22 Pa s) n/a 0.99999999 -11 (#1059) SympifyError / -11
datum 1.00000000 1.00000000 1.00000000 3.0e7 / 9.0e8
traction 1.00000000 1.00000000 1.00000000 0.0333 / 1
explicit 1.00000000 1.00000000 1.00000000 1 / 1
field dual 1.00000000 1.00000000 1.00000000 0.0333 / 1

The --plain misfit gives the same picture (datum 0.99999983 in all three modes, and the rest between
0.99999999 and 1.00000000).

J with references set now equals the no-units J bitwise in the visc, datum, traction and explicit cases.
For example, on visc gives hex -0x1.9ab5e85bcc4bcp-13 in both. The field case differs between modes
because the probe sets f from f.coords, which are dimensional in a units model. That is a different
problem, not a defect. The off visc_dim failure is the forward solve at a viscosity of 1e22 in PETSc's frame
(#1059), as on base.

fault_friction.py -uw_check_only 1 (logs/ex_h763.log): J = 1.484255e-03, with ratios 0.99999, 1.00000,
1.00000 and 1.00000. That is identical to development 8f0ed0a in r765.

5. test_0033

run result
4437bc0, np 1 5 passed
08bc58b library, np 1 5 failed, as H3 states
4437bc0, np 2 aborts, SEGV (PETSc error 59) in both datum cases. Dimensional viscosity and the two traction cases pass on both ranks.

The np 2 abort predates this branch. Here is what we measured:

  • The same SEGV happens with no units on both builds (p_datum_forms.py none poly at np 2,
    probes/datum/np2_h765d_none_poly.txt).
  • Tracing the Python-visible steps puts it in SolverBaseClass._essential_datum_owner, before
    _value_at is reached (probes/datum/np2_where.txt).
  • r765 saw the same thing as test_0026 aborting with exit 59 at np 2, on development and on the branch.

So no datum sensitivity runs at np ≥ 2 on either build. That is F3.

6. _integrate() against evaluate()

  • Output unchanged. Integral.evaluate() prints the same repr, bitwise, as development 8f0ed0a in every
    p_grad_frames case and mode (r765 grad_base.out against probes/grad/h763_*.out). An example is
    -0.005875261927995465 [kilometer ** 3].
  • Serial regression: 70 files, the adjoint, transcript, Integral and BdIntegral users without test_1064,
    at -n 2.
    • 4437bc0: 841 passed, 3 skipped, 1 xfailed.
    • 08bc58b library: the same, except the 5 test_0033 cases fail.
    • The per-test junit comparison shows those five as the only difference (logs/ser_*.r0.xml).
  • Sites [read, grep]: adjoint.py has no .evaluate( or function.evaluate left. The volume and facet
    sites in sensitivity, gradient's J and explicit terms, and TranscriptAdjoint's J and explicit term all go
    through adjoint.integral(). _integrate() has no caller outside adjoint.integral, so no non-adjoint caller
    gets the raw number.
  • Other gateway reads in the same frame [read], which are not adjoint and not this PR:
    • free_surface.py:1253,1740,1741,1760,1761, rotated_bc.py:3312,3316 and solvers.py:2614,3621 take
      float() of evaluate().
    • petsc_generic_snes_solvers.pyx:10277 evaluates nullspace modes with uw.function.evaluate on
      coords_nd.
    • Most of these divide one integral by another, or are scale-free, so they may be benign. We did not test
      them.
  • The @timing.routine_timer_decorator moved from evaluate to _integrate, so timing tables now say
    _integrate. This is cosmetic.

7. #1048, datum forms (probes/p_datum_forms.py, probes/datum/)

These are adjoint/FD ratios on 4437bc0. The references are 30 km, 1e21 Pa s and 1 Myr, and J = ∫ u_y sin(πx) + u_x y.

datum on the lid none on off
α x(1-x) 1.00000000 1.00000000 1.00000000
α x(1-x) + c (c a named constant) 1.00000000 1.00000000 1.00000000
α c x(1-x) 1.00000000 1.00000000 1.00000000
α V x(1-x), V = 1 cm/yr (dimensional) 1.00000000 1.00000000 1.00000000
α x(1-x)(1+y), a second coordinate 1.00000000 1.00000000 1.00000000
α sin²(πx) 1.00000000 1.00000000 1.00000000
α q, q = expression(x(1-x)), nested 1.00000000 1.00000000 1.00000000
α g x(1-x), g a MeshVariable 1.00000000 1.00000000 1.00000000
α x(1-x)(1+t), mesh time symbol 1.00000000 1.00000000 1.00000000
  • The 08bc58b library on the same forms with scaling on gives ratios of 3.0e7, and 0.0285 for the dimensional
    V. That matches Adjoint: the Dirichlet-datum sensitivity is off by (L_ref in m)^2 in a units model #1048's 9e8 once J's own factor of 30 is taken out.
  • In the dimensional-V case the adjoint gives V_nd·6.1673e-3 with V_nd = 0.33333 = (1 cm/yr · 1 Myr)/30 km,
    so _value_at applies the constant's non-dimensional value.
  • A datum that reads a MeshVariable is not refused on this branch, contrary to the request's "not tested"
    note, which says Adjoint field dual is silently zero for a field that enters through a Dirichlet datum #787 refuses it. It runs and matches FD at np 1. At np ≥ 2 there are two problems:
    • _value_at calls evaluate_nd once per constrained node, and for an expression with a mesh variable
      evaluate_nd calls mesh.update_lvec(), which is collective [read]. Ranks that own different numbers of
      datum nodes would deadlock. The old uw.function.evaluate loop had the same shape.
    • We could not reach that code at np 2, because of the SEGV in check 5.
  • The time-dependent datum: t is 0 throughout this static probe, so the FD agreement shows only that the
    derivative is taken correctly at t = 0. That is weak evidence.

8. TranscriptAdjoint in a units model (probes/p_transcript_units.py, probes/tr/)

run J dJ/dparameter: adjoint/FD
Stokes-only steps, no units, η0 = 1 (and the explicit α_J) -1.7665217147e-03 0.99999999 (η0), 1.00000000 (α_J)
same, scaling on -1.7665217147e-03 0.99999999, 1.00000000
same, scaling off -1.7665217147e-03 0.99999999, 1.00000000
Stokes-only, scaling on, viscosity α·(1e21 Pa s) -1.7665217147e-03 0.99999999 (α), 1.00000000 (α_J)
same, 08bc58b library -5.2995651441e-02 (×30) 3.3e19 (α), 1.00000000 (α_J, consistent with the ×30 J)
test_0020's run (Stokes + SUPG history), no units, and scaling off 2.4202914765e-03 0.99999998
test_0020's run, scaling on (both builds) raises ValueError: Cannot assign plain array to 'psi_star_Eulerian_19_0.array' when units are active, at adjoint.py:680 (_linearise_at: h.psi_star[0].array[...] = before)
test_0020's run, scaling off, viscosity α·1e21 Pa s 0 the forward gives u = 0 (#1059)

So the branch fixes TranscriptAdjoint's J and explicit terms in a units model. A history-carrying transcript
in a scaled model can't be differentiated at all, before or after this change (F4).

Another pre-existing observation: after TranscriptAdjoint.gradient, the live fields are not at the final
state. Integral.evaluate taken right after differs from J (2.44088e-3 against 2.42029e-3) on both builds.

9. Mutants (logs/mut_*.log; probes/grad/mut_*)

mutant test_0033 + test_0032 probe where it bites
J site back on float(evaluate()) caught: 5 failed n/a
volume sensitivity on evaluate() caught: 1 failed (dimensional viscosity) n/a
facet sensitivity on evaluate() survives: 9 passed traction α·T0·sin(πx), T0 = 3e7 Pa, scaling on: ratio 3.2e7
explicit term on evaluate() survives: 9 passed explicit case, scaling on: ratio 30.0
_value_at → uw.function.evaluate caught: 2 failed (the datum cases) 9.0e8 on every datum form
_value_at with keep_constants=True survives: 9 passed identical on all 5 forms tried, so equivalent here

The facet mutant is equivalent when the traction carries no units: BdIntegral.evaluate labels the number in
km but does not rescale it. It bites as soon as the traction has a dimensional factor.
TranscriptAdjoint's sites are covered by no test in a units model.

10. Regressions

  • Serial: see check 6. No difference outside test_0033.
  • parallel/ files that use Integral or BdIntegral, the adjoint or transcripts, run one per file at np 2:
    19 of the 20 files pass on both ranks (logs/np2_summary_h763.out). The exceptions:
    • ptest_0863_fault_network_3d_width_parallel timed out (exit 124: 4 F, then the supervisor's silence
      kill, with the stacks inside KSPSolve). It has no adjoint content. We did not compare it with base.
    • serial_reference is a helper module (exit 5, nothing collected).
    • The Integral and BdIntegral users (0765, 0766, 1065, 1069_boundary_normal, 1063, 1064_rotated) are green.
  • Adjoint and transcript files at np 2, one per file: 39 files (logs/np2adj_summary_h763.out).
    • Pre-existing, the same failure set on the 08bc58b library at np 2 (logs/np2/h765d_*): test_0007
      (2), test_0014 (26), test_0015 (2), test_0017_solve_outcome (2) and test_0018_transcript_query (5). These
      are transcript-file and snapshot tests that are not parallel-safe.
    • Pre-existing per r765 on development: test_0018_adjoint_support (1, rank 1), test_0019 FD (empty-rank
      max), test_0812, test_1057 (rank 1), test_0026 (exit 59, which is F3) and test_1131 (timeout).
    • test_0033 aborts with exit 59 (F3).
    • test_0017_describe_and_render timed out (124), and test_1069_pressure_gauge_is_recorded ended with
      exit 142 after 10 passes and 1 F. We have no base comparison for these two.
    • Everything else passes, including test_0020 (TranscriptAdjoint), 0021 to 0025, 0028, 0032 and
      test_1145_stokes_adjoint_keeps_custom_mg.
  • test_1064 alone (serial, 4437bc0): still running at hand-off (PID 3033345, logs/t1064_h763.log). After 70 minutes it had 1 of 4
    passed and no failure. The machine's load average is about 20.

Which results depend on the stale solver file

H3 has since confirmed the cause we found from the diff: the solver pyx was taken whole from an old commit.
In 7814510 that file differs from e7fdcb2 only in the _peel_except delegation and the three #1019/#1020
hunks. The diff is in 1047-delta-review.md.

  • Depends on it, so rerun at the new heads:
    • test_1149, serial and parallel;
    • test_1145_stokes_adjoint_keeps_custom_mg (green here);
    • anything that installs custom MG (FAC), or switches preconditioner after a solve;
    • the np 2 timeouts in test_0017_describe_and_render, test_1069_pressure_gauge and test_1131, which have
      no base comparison here (test_1131 timed out on development in r765 too);
    • test_1064 (in progress).
  • Does not depend on it, because none of these reach the deleted calls with a FAC install: our Stokes
    solves fall back to GAMG on a mesh with no hierarchy (the warning is in the logs), and the calls only
    release FAC keys. On that reading [read], the following carry over:
    • every frame, datum, TranscriptAdjoint and mutant result;
    • test_0033 at np 1;
    • the serial regression comparison;
    • the np 2 datum SEGV in _essential_datum_owner.
  • Superseded by ead0914 (by H3's description, not run): F4, the _linearise_at history assignment.
    Check it in the short round with probes/p_transcript_units.py on bare and on explicit, which raise here.

Findings

# sev finding evidence
F1 Blocker (inherited) 4437bc0 carries 7814510's revert of #1019/#1020 in petsc_generic_snes_solvers.pyx, and test_1149 fails on this build: 3 of 12. See 1047-delta-review.md, F1. logs/t1149_h763.log
F2 Medium test_0033 does not guard two of the four converted sites. The facet mutant survives, and with a dimensional traction it is wrong by 3.2e7. The explicit-term mutant survives, and is wrong by ×30. Add a dimensional-traction case and an explicit-misfit case, both FD with references set. A Stokes-only TranscriptAdjoint case in a units model would cover its two sites (p_transcript_units.py on stokes_dim is ready, 08bc58b gives 3.3e19 there). mutant table
F3 Medium (pre-existing) Any essential-datum sensitivity SEGVs at np 2, in _essential_datum_owner, on both builds and with no units. So test_0033's datum cases and test_0026 cannot run in parallel. It needs an issue. It also hides whether a datum that reads a MeshVariable deadlocks (collective update_lvec per node, [read]). probes/datum/np2_*.txt
F4 Medium (pre-existing) TranscriptAdjoint over a solve with an Eulerian history in a scaled units model raises ValueError at adjoint.py:680, which assigns a plain array to psi_star[0].array. It should probably use .data. It is loud. H3 reports ead0914 (.data, test_0034) fixes it: verify in the next round. probes/tr/*_on_bare.txt
F5 Low H3 says a datum that reads a field "is refused today". On this branch it is not refused: it runs and is right at np 1. Either the refusal lives only on #787's branch, or the claim is stale. probes/datum/h763_fix_*_field.txt
F6 Low keep_constants=False in _value_at could not be distinguished from True on any datum form. The choice may be right, but nothing tests it. mutant table
F7 Info [read] Non-adjoint float(Integral.evaluate()) sites in free_surface, rotated_bc and solvers.py, and uw.function.evaluate for nullspace modes, may share the frame hazard. They are out of scope. grep
F8 Info After TranscriptAdjoint.gradient the live state is not the final state. This is pre-existing. Document it, or restore the final state. probes/tr/*_none_bare.txt

Merge conditions

  1. A dimensional value in the residual no longer stops an adjoint gradient (#765) #1047 restores the preconditioner = "gamg" on an adapt child with a FAC level fails with PETSc error 73: GAMG reads the leftover FAC composite key #1019/Custom-P reinstall on the standard path leaks deferred PETSc objects at np > 1: +28 entries and 8 MB per reinstall on Stokes (#1007 pattern) #1020 blocks (its F1), and this branch is restacked on it. test_1149 serial and
    parallel are green.
  2. Add to test_0033 a dimensional-traction FD case and an explicit-misfit FD case (F2). A units-model
    TranscriptAdjoint case is recommended.
  3. Open an issue for F3 (the datum SEGV at np ≥ 2). Verify F4 at ead0914.

Issue verdicts

What we could not test

  • A datum sensitivity at np ≥ 2, including the field-reading datum's possible deadlock, because of F3.
  • TranscriptAdjoint with history in a scaled model (F4), and therefore H3's sinker_transcript in units.
  • A time-dependent datum at t ≠ 0.
  • A dimensional parameter (α itself a quantity) in the datum. We don't know the contract for what dJ/dα
    means then.
  • np 4.

Round 2: new heads (de6ead8 + ead0914)

Verdict: ready to merge after #1047. The F2 test additions are still missing; we recommend them but they don't block.

Build wt-h763b (ead0914 on de6ead8 on ddcdb92); tests from git archive ead09149 (src-h763b/); logs in
logs/r2/, probes in probes/.

  • Where ead0914 lives. The coordinator's note said ead0914 was only in the shared local repo, with
    origin's branch at 37e273f. By the time of this round (git ls-remote), origin's
    bugfix/adjoint-sensitivity-frame-763-1048 is at ead0914, and bugfix/adjoint-peel-leaf-765 is at
    ddcdb92.
  • de6ead8 against 4437bc0: identical +/- lines, so the round 1 frame, datum and mutant results
    carry over for that commit.
check result
test_0032 + test_0033 + test_0034, np 1 10 passed
p_peel_cases.py identical to 08bc58b (the depth-8 limit stands, see the #1047 record F2)
p_transcript_units.py on bare (SUPG history, scaling on) fixed. It raised at adjoint.py:680 before. Now J = 2.4202914765e-03, equal to the no-units J bitwise, and dJ/dη0 adjoint/FD = 0.99999998.
p_transcript_units.py on explicit (history, scaling on) η0 0.99999998, α_J 1.00000000. J = 4.8405829530e-03, equal to no-units.
test_0017_describe_and_render, np 2 timeout (124) on ead0914 and on development wt-910c. Pre-existing.
test_1069_pressure_gauge_is_recorded, np 2 10 passed, then F, exit 142, on both builds. Pre-existing.
test_1131_rotated_nullspace_from_mesh, np 2 the same F/pass pattern, then timeout (124), on both builds. Pre-existing.
git merge-tree --write-tree against development ef4ed89 clean

The three np 2 files used the same test copy on both builds; the files are unchanged between 5234423 and
ead0914.

ead0914 copies the tracked field into psi_star[0] through .data on both sides, which assumes the two hold
the same layout. Both are built from the same field. test_0034 and the probe agree to FD; for the rest we
have only read the code.

Open items:

  • F2 is not addressed. test_0033 still has only the dimensional-viscosity, datum and traction cases. On
    ead0914 the facet-on-evaluate mutant still survives (test_0033 + test_0034: 6 passed), and so does the
    explicit-term mutant (6 passed).
    • In round 1's probes these mutants are wrong by 3.2e7 (dimensional traction) and ×30 (explicit misfit).
    • The recommendation stands: add a dimensional-traction FD case and an explicit-misfit FD case.
    • test_0034 covers TranscriptAdjoint's history path in units. Its J and explicit sites still have no
      mutant-killing case.
  • F4 is resolved by ead0914.
  • F3 is unchanged: the datum SEGV at np ≥ 2 in _essential_datum_owner. It needs an issue. Not rerun.
  • F5 to F8 are unchanged.

Issue verdicts (round 2): #763 and #1048 are fixed at np 1. The np ≥ 2 datum gap is F3 and pre-existing.
#765 is fixed by #1047 at ddcdb92.

Underworld development team with AI support from Claude Code

Copilot AI balanced review requested due to automatic review settings November 11, 2026 15:35

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.

_essential_datum_sensitivity evaluated a datum's derivative once per
owned constrained node. A derivative that reads a mesh variable is
evaluated collectively, and ranks own different numbers of nodes, so at
np >= 2 the ranks fell out of step: one in the final allreduce, another
in update_lvec (H1's review, R3-F1). Before #1067's guard this crashed
earlier; after it, it hung silently. The nodes are now grouped by
condition and component, and each group is evaluated once, on every rank
and in the same order, whether or not this rank owns any of its nodes.

The peels also allow their full depth: a chain of exactly 64 expanded
completely and still raised (R3-F2).

test_0035 gains a field datum (lid alpha*g*x(1-x), g a mesh variable),
with and without units: it hung (exit 124) before, and passes at np 2
and 4. test_0032 pins a 64-level chain and a self-reference. 129 serial
adjoint, transcript, Integral and custom-MG files: 1163 passed.

Underworld development team with AI support from Claude Code
@lmoresi
lmoresi merged commit c5e5900 into development Nov 11, 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.

3 participants