Repository navigation
The MMPDE mover reaches its minimum: no stall, and no wasted iterations near it - #1024
Conversation
…oes not burn its budget On an annulus with a sharp thermal layer the default mover stopped at the fifth of 150 outer iterations, its energy 9 % above what plain descent reaches. Two causes. A failed conjugate direction was taken for convergence; it now restarts along steepest descent. The metric, interpolated from its nearest nodes, made the energy jump where those nodes change; it is now a P1 field on a copy of the starting mesh, read with evaluate (global_evaluate in parallel), so it is continuous, a function of space, and the same at any rank count. Cost: the metric is read once per step and carried to each line-search trial to first order with that step's gradient, which is what the descent direction assumes; the gradient takes forward differences. A stagnation exit is on by default (stol=3e-4): near its minimum the mover otherwise spent all 150 iterations on moves too small to matter. Rigid bounding surfaces give their normal analytically instead of re-projecting it twice per iteration. A first move on this annulus takes 33 s and a second 15 s, against 73 s and 185 s with the frozen field alone. Underworld development team with AI support from Claude Code
…onfirmed on the metric read there The first-order carry can overshoot where the metric changes fast, and the SPD floor then lets the line search accept a step the true energy rejects. The read that confirms it is the next step's metric, so it adds no read, and the reported and windowed energies are the true energy again. A constant metric, as Mesh.relax passes, skips the frozen field. The test asserts how far the energy falls, not one descent against another. Underworld development team with AI support from Claude Code
Adversarial reviewOne independent review, by reading code, of the first commit. The second commit answers it and was not reviewed again. Fixed
Left, noted
Attacks that found nothing
Underworld development team with AI support from Claude Code |
Review of the final commit only (pre-rebase)This round covers only the final commit, which answered earlier review rounds and had not itself been reviewed. Each PR's own tests run again on its rebased head once H2 has rebased the stack onto development (#959 is merged). That record will follow as a separate comment. Paths under #1024, final commit 06fea90: adversarial reviewCommit: 06fea90 "Review of the mover change: a trial passed on the carried metric is confirmed on the metric read there". Parent d6423fd. Base: #1003 head 0b14c68 (wt-s1003). Verdict: approve once a test guards the change. The confirmation does what it says. The parent accepts line-search steps whose true energy rises, and the final accepts none. It adds no metric reads in the runs below, costs no wall time, and does not stall. The constant-metric skip returns the same mesh about 6× faster. Neither change is caught by any test: test_0765 and five other mover files pass with either change undone. Method
What it answersFrom the PR's first review:
Measured (
|
| case | variant | outers | final I | drop | wall | reads | rejects | bad accepts (worst rise) |
|---|---|---|---|---|---|---|---|---|
| A: w=.03, R=5, h=1/16, sf=.2, cg (test_0765), move 1 | final | 38 | 3.704125 | 13.07 % | 8.2 s | 154 | 0 | 0/38 |
| parent | 38 | 3.704052 | 13.07 % | 8.2 s | 153 | — | 0/38 | |
| A, move 2 | final | 16 | 4.661350 | 1.43 % | 4.5 s | 75 | 0 | 0/16 |
| parent | 16 | 4.661323 | 1.43 % | 4.5 s | 77 | — | 0/16 | |
| A, np 2, move 1 / move 2 | final | 34 / 15 | 3.674181 / 4.638191 | 7.7 / 4.5 s | 138 / 77 | 0 | 0 | |
| parent | 34 / 15 | 3.674038 / 4.638099 | 7.5 / 4.6 s | 137 / 81 | — | 0 | ||
| B: w=.005, R=20, h=1/16, sf=.5, cg | final | 116 | 2.812879 | 48.92 % | 26.5 s | 513 | 2 | 0/116 |
| parent | 126 | 2.812900 | 48.92 % | 28.9 s | 585 | — | 2/126 (1.9e-5) | |
| C: w=.03, R=5, h=1/8, sf=.2, cg (the PR's annulus), move 1 | final | 29 | 3.732659 | 19.98 % | 4.0 s | 120 | 2 | 0/29 |
| parent | 29 | 3.734504 | 19.94 % | 4.7 s | 137 | — | 2/29 (2.5e-5) | |
| C, np 2, move 1 | final | 26 | 3.743263 | 20.08 % | 5.4 s | 107 | 1 | 0/26 |
| parent | 23 | 3.744261 | 20.05 % | 4.7 s | 93 | — | 1/23 (4.9e-6) | |
C, metric_eval="rbf" |
final | 37 | 3.715967 | 1.3 s | 165 | 9 | 0/37 | |
| parent | 35 | 3.722441 | 1.2 s | 149 | — | 1/35 (2.3e-4) | ||
C, accel="none" |
final | 24 | 3.747652 | 19.66 % | 3.2 s | 98 | 0 | 0/24 |
| parent | 24 | 3.747334 | 19.66 % | 3.2 s | 97 | — | 0/24 |
Cost.
- The confirmation's read replaces the next step's read at the centroids. Reads per outer iteration are equal or lower: 4.05 against 4.03 (A1), 4.42 against 4.64 (B), 4.14 against 4.72 (C1). The parent re-reads after a CG restart; the final reuses the metric it already has.
- Each confirmation reject costs one read: 0 to 2 per move on the frozen metric, 9 on
rbf. - Wall time is the same or lower.
Can it reject a good step?
- A trial must now pass both the carried screen and the true check, so it is strictly more conservative than the parent.
- It can still reject a step the true energy would accept, where the carried screen fails first. The parent shares that behaviour.
Can it stall? We saw no stall in any run.
- Final energies match the parent's or are lower: by 5e-4 relative in C, and 1.7e-3 on
rbf. - Stol exits fire as on the parent, except
rbfcase C, where the final stopped on its other criteria after 37 outers. - On
rbf(Shepard, discontinuous), the 9 rejects did not prevent descent.
The rises the confirmation removes are small (≤ 2.5e-5 relative on the frozen metric, 2.3e-4 on rbf), but they are real violations of the line search's monotone contract.
Constant metric (probes/p_relax.py). Mesh.relax() on a once-adapted UnstructuredSimplexBox(cellSize=0.2, refinement=1):
| wall, np 1 / np 2 | meshes built | |
|---|---|---|
| final | 0.15 / 0.10 s | 0 |
| no_constskip | 0.84 / 1.08 s | 1 |
| parent | 0.85 / 0.90 s | 1 |
The coordinates agree to 1e-13 at np 1 and on both ranks at np 2. Across the six mover test files the skip saves 37 s: 74 s on the final against 111 s for no_constskip and 109 s for the parent.
The commit's own test
tests/test_0765_mmpde_descent_does_not_stall.py:
| build | serial | np 2 |
|---|---|---|
| final (s1024) | pass, 15 s (drop 13.07 %) | rank 0 pass, rank 1 IndexError |
| parent d6423fd (emulated) | pass | rank 0 pass, rank 1 IndexError |
no_confirm |
pass | — |
| #1003 build (s1003) | fail: "energy fell 0.5 % in 3 outer iterations" | fail on both ranks: rank 0 "3.2 % in 6", rank 1 IndexError |
The test guards d6423fd's no-stall fix, against the #1003 build, with a wide margin (13 % against a bound of 8 % against 0.5 %). It does not guard this commit: it passes on the parent.
Mutants against the mover suite (test_0751, 0752, 0764, 0765, 0766, 0845; serial):
| variant | result |
|---|---|
| final | 26 passed |
no_confirm |
26 passed |
no_constskip |
26 passed |
parent |
26 passed |
Findings
F1. Medium: no test fails without this commit.
- Undoing the confirmation, or the constant-metric skip, passes every mover test.
- Two suggested tests:
- Case C (
h=1/8) with a true-energy monotonicity check. The parent accepts 2 rising steps there, and the final none. Mesh.relax()assertingMesh.mesh_instancesis unchanged. It goes from 0 to 1 built underno_constskip.
- Case C (
F2. Low: test_0765 cannot run under MPI.
- Energies are parsed from
uw.pprintoutput, which appears only on rank 0, so rank 1 fails withIndexErrorat line 36. - This is the same on the parent. The file has no MPI marker; it is a fault only if
mpirun pytestever collects it. - Fix: broadcast the trace from rank 0, or mark the file serial-only.
Notes:
- [read] The reuse of
_M_nextholds only ifcoordsis unchanged between the line search and the next step.coords = acceptedis followed bymesh._deform_mesh(coords)and byboundary_slip(reference_coords=coords)at the top of the next step, and neither rewritescoords[read]. The final's energies agree with the parent's to ≤ 5e-4 relative, consistent with that. - [read] Parallel safety holds. The screen and the confirmation predicates come from
_energy, which is a global sum, so every rank enters the collectiveglobal_evaluateinside_eval_Mtogether. The np 2 runs completed. - Pre-existing, unchanged:
- The rank-local early return for a rank with no cells (
TODO(BUG)). - Step 1 reads the metric at the centroids twice (
prevIand the step).
- The rank-local early return for a rank with no cells (
- The refinement ≥ 1 defect is not exercised. No probe here moved a refined mesh and then solved on it.
Merge conditions
- F1: a test that fails with the confirmation undone. A test for the constant-metric skip is a should-fix.
- F2: mark test_0765 serial-only, or make it rank-safe. This is a should-fix.
What we could not test
- Only one geometry and one metric family were run. We did not run 3D (tetrahedra), a box,
accel="heavyball"or"hb-restart", or θ = 0.5 called directly through_mmpde_mover.node_redistributionsets its own θ, and we did not check which one it passes [read]. - Parallel was run at np 2 only, not np 4.
- The commit's mover suite was not re-run. The PR's full set of 118 mover tests, and their parallel files at np 4, will be re-run after the rebase.
- We did not find a case where the confirmation rejects every trial while descent is still available. That is reasoned, not shown: the carried and true energies agree to second order in the step.
Underworld development team with AI support from Claude Code
…fix/mmpde-mover-stall
…ic skip Only rank 0 prints the mover's trace, so broadcast it before parsing (H1 review F2, IndexError on rank 1 at np 2). Add a test that a constant metric, as Mesh.relax passes, builds no frozen metric field while a spatial one does; it fails with the skip in 06fea90 undone (H1 review F1, first half). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…confirmed read _mmpde_mover returns the energy of the starting mesh and of each accepted step. The new test checks the last one against the true energy a second call reads on the same mesh; with the line search's confirmation in 06fea90 undone they differ by 0.2 % (H1 review F1, second half). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every other exit returns the list (H1 review, low). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#1024 on its updated head d04ac6b: tests after the development mergeVerdict: the merge is clean and the PR's diff is unchanged. The mover suite and its parallel files pass at np 1, 2 and 4. test_0765 still drops the energy 13.07 % and still fails on rank 1 at np 2 (known, F2). The one new failure, Head d04ac6b, branch The method is as in
The merged04ac6b merges 06fea90 (the reviewed commit) with 84cd176 (#1003's updated head).
Tests
The PR's test still guards its change. On the #1003 build (wt-s1003b), test_0765 fails with "energy fell 0.5 % in 3 outer iterations", as in the earlier round. Failures
Earlier finding still open (06fea90 round, F1). No test fails with the confirmation, or the constant-metric skip, undone. The diff is unchanged, so neither of the suggested tests has been added. np 4 runsThese were queued in
Underworld development team with AI support from Claude Code |
Fixes check on the stack: #982 670b523, #988 dbfe47e, #1003 946646b, #1024 cac06a0This checks H2's fixes for the findings in Verdicts
Method
Results
Reading the diffs
Merges
Still open
Housekeeping
Underworld development team with AI support from Claude Code |
The stack after merging development 5ce73fd: re-testHeads and builds:
At most 6 cores were used, and np 4 jobs ran one at a time. Logs are Verdicts
Findings: none. No test fails on the stack that passes on development. Method
Merges
Tests
Notes on the table:
FindingsNone. Still open from earlier rounds, and not changed by this merge:
Housekeeping
Underworld development team with AI support from Claude Code |
…rldcode#1101) When the fine level moves far from coarse levels that did not move with it, two coarse unknowns can be left whose prolongation columns each have one entry, on the same fine row. Their Galerkin rows are proportional and the coarse operator is singular; in test_1152 (a mover after underworldcode#1024) SOR's inode block met a zero pivot on 4 of 8 1e-13 coordinate perturbations. restrict_unreached and rotated_split_transfers now find such groups (collectively, columns with at most 4 fine images), keep the largest-weight column (ties to the lowest global column), drop the others, and fold each dropped unknown's row of the level below into its kept twin's, scaled by the signed weight ratio. The composite transfer is unchanged, so constants still reach the shared row at full weight. The repair warns; more columns than rows on a multi-row support is refused on every rank; with no such group the transfers are returned untouched. Test: the configuration built directly, the shared fine row on rank 0 and the columns on the last rank, at np 1, 2 and 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MMPDE mover now reaches the minimum of its energy instead of stalling early, and it no longer spends its whole iteration budget once it is near that minimum. Stacked on #1003; merge #959, #982, #988 and #1003 first.
What was wrong
On an annulus with a sharp thermal layer, the default mover stopped at the fifth of 150 outer iterations. Its energy was 9 % above what plain descent reaches, and it moved nodes a quarter as far. Two causes:
Also, from a mesh already near its minimum, the mover ran all 150 iterations on moves too small to matter: 185 s for a second move on this annulus.
The change
metric_eval="frozen", now the default): it is a P1 field on a copy of the starting mesh, read withuw.function.evaluate, orglobal_evaluatein parallel. It is continuous, a function of space, and the same at any rank count. A constant metric, asMesh.relaxgives, skips the field.stol=3e-4): Louis agreed this default.Measured
Annulus, cell size 1/8, sharp layer, slip walls,
R=5:Before the per-step read and the stagnation exit, the frozen field alone took 73 s and 185 s for the two moves. The np 1 and np 4 energies agree to 0.04 % (frozen field, measured before the per-step read was added).
Tests
tests/test_0765_mmpde_descent_does_not_stall.py(level 2, tier B): from the first step's energy, the drop is 13 % on this PR against 0.5 % stalled on the A mesh move stays in its frame in a units model, and the monotone limiter compares like with like #1003 build. It fails there.Notes
evaluate. Reusing cell location between steps is the next lever.dmfield_evaluatewas tried and hit locate failures.Checklist (UW3 Style Charter)
level_*andtier_*markers.array/mesh.X.coordsUnderworld development team with AI support from Claude Code