Repository navigation
Project exact rotations out of the rotated velocity preconditioner; fixes the shard-4 hang (#963) - #967
Conversation
…ditioner With the analytic normal on a circle or sphere, the rotated constraint leaves a rotation an exact null vector of the rotated velocity block (|A m| / (|A| |m|) = 1.7e-18 on test_1064's annulus). The custom-FMG cycle returns a rounding-level component along it in each preconditioned direction, and the KSP's null space, acting on the right-hand side and solution only, does not remove it. The inner FGMRES floored near 1e-7 against 3.3e-11, and the outer FGMRES kept restarting it until CI's supervisor killed the job, on every CI run from eddab70. Whether rounding lands above the tolerance depends on the OpenBLAS kernel (hyperion): SkylakeX finishes; Zen and Haswell stall at np 2, Nehalem and Sandybridge at np 1, Core2 and Prescott at both. When the admitted rotations include modes A_vv annihilates to 1e-10 relative, the velocity sub-KSP's PC becomes a PCShell, z = P M (P r), around the configured multigrid. Near-null modes (a declared rotation on a faceted wall) are left to the multigrid. The solve record gains projected_null_modes, and velocity_pc_type still reports the inner PC. The GAMG and vector-problem routes are unchanged. test_1142: the analytic-normal annulus projects one mode and keeps its answer; the default normal projects none; on x86, the solve under OPENBLAS_CORETYPE=Nehalem must finish within 240 s in a child process. Underworld development team with AI support from Claude Code
…y host Without the projection the analytic-normal annulus's inner velocity solve runs to its cap of 200 on macOS arm64 too; the outer solve converges there anyway, which is why only some CI kernels hung. With it the inner solve takes 4. The in-process test now asserts at most 10 inner iterations before it checks the projected-mode count, so it fails on behaviour on every host: against development's rotated_bc it fails with "200 <= 10", on this branch it passes. The forced-kernel child stays as the x86 check of the hang itself. Underworld development team with AI support from Claude Code
The previous commit said the bound fails on any host. Hyperion measured development's inner velocity solve at 4 iterations under SkylakeX, so there only the forced-kernel child catches a regression. The bound catches it on macOS arm64 and on the x86 kernels that stall. Underworld development team with AI support from Claude Code
The rotated route's velocity sub-PC is now the projection around the multigrid when the constraint leaves an exact rotation, as test_1021's analytic-normal annulus does. The test checks the multigrid's configuration (redundant LU coarse solve with the nonzero shift), which is unchanged, so it unwraps the projection first. Underworld development team with AI support from Claude Code
Adversarial review of #967Verdict: not ready, one must-fix with a verified four-line fix. The projection removes the #963 stall and leaves answers unchanged, but at np >= 2 the wrapped multigrid is never destroyed: 19 MB per adjoint solve. Reviewed at 108f9de (library unchanged from 348f068; test_1021's later commit not reviewed), base eddab70. Host: hyperion, Xeon 6240R, loaded at about 25. Probes on hyperion in Findings
Attacks that failed
Runs from the author's request, at 108f9deKernel table: 8 kernels at np 1 and 2 all finish, inner max 4, its=[1], reason 2, L2 spread about 1e-13. Parallel set at np 2 and 4: test_1064, 1066, 1068, 1112, 1116, 1140 pass. Issues
Merge conditions
Could not testarm64; real CI runner CPUs; a truly off-centre mesh; empty-rank partitions; a complete CubedSphere solve (#946 folds it on both trees); Underworld development team with AI support from Claude Code |
…nd docs From hyperion's review of #967: - Must fix: _NullModeProjectedPC.destroy freed its modes and work vector but not the wrapped multigrid, which the sub-KSP had given up to it. At np 2, where petsc4py defers destruction, the whole hierarchy outlived every solve: 533 to 1106 MB over 31 adjoint solves against 535 to 551 MB on base (hyperion). It now destroys it. _destroy_rotated_ksp_ctx also releases the context's own reference to the fieldsplit PC, which alone kept the PC, its sub-KSPs and the projection alive after the KSP was destroyed. test_the_projection_releases_the_multigrid_it_wraps checks that the wrapped PC is destroyed with the workspace; it fails when destroy leaves the multigrid alive. - The record gains null_mode_ratios, |A m| / (|A| |m|) per admitted rotation; the test pins the exact mode below 1e-14, eight orders under the 1e-10 threshold. - The default-normal case admits no rotation on development, so its test now says that, instead of claiming a near-null mode is left alone; the near-null case arrives with #906. - The L2 pin is centred between macOS (0.0190696175990617) and Linux (0.01906961745108), whose gmsh builds a slightly different annulus. - rotated-freeslip.md describes the projection and the two record fields. Underworld development team with AI support from Claude Code
…igrid on every rank At np 2 petsc4py defers the destruction of a dropped reference, so the wrapped multigrid outlived every solve before the fix (hyperion, on 108f9de). The test checks, on every rank, one mode projected, a short inner solve, and the wrapped PC destroyed with the workspace. Its body passes serially here. Underworld development team with AI support from Claude Code
|
Response to hyperion's review, at 488c53b Must fix: the wrapped multigrid leaked. Fixed in a6d1a80.
Should fix:
#969 (an exact rotation about a point off the origin): not this PR's change, as you say. With #964, a mesh can declare the rotation about the normal's centre. Walls with a given normal then take the constraint test, which that rotation passes exactly, and this PR projects it. An undeclared mesh keeps the detection, which offers rotations about the origin only. I'll put a probe on #969 once both have merged. Serial on macOS: test_1142 plus test_1021 give 25 passed, 1 skipped. Underworld development team with AI support from Claude Code |
|
Rerun at 488c53b, on hyperion. The review's must-fix is closed.
Underworld development team with AI support from Claude Code |
…m-values Underworld development team with AI support from Claude Code
…anup-950 Underworld development team with AI support from Claude Code
Underworld development team with AI support from Claude Code
…from-mesh-906 Underworld development team with AI support from Claude Code # Conflicts: # scripts/test.sh
With development merged in (#967), the shell under the analytic normal has three exact modes, which the velocity preconditioner projects out (ratio below 1e-14). Under the facet-averaged normal its three declared modes are near-null, exempt and admitted, but left to the multigrid (ratio above 1e-8, against the 1e-10 at which a mode is projected). This is the near-null case #967's review noted would arrive with #906. Underworld development team with AI support from Claude Code
The rotated custom-FMG velocity preconditioner projects out the exact rotation modes, so the inner velocity solve no longer stalls (#963). This turns CI's shard 4 green again.
The bug
Every CI run from development eddab70 hung in
test_1064_rotated_freeslip_parallel.py::test_rotated_freeslip_annulus_fmg_partition_independentat np 2, until the MPI supervisor killed it. #947's own PR run had passed on the same tree, so the code was not the difference: whether the solve finished depended on the host's OpenBLAS kernel.The mechanism, found on hyperion:
Ruled out on hyperion: #947's coarse shift (shift off, shift forced on, an SVD coarse solve), the level smoother (Richardson, Chebyshev), the orthogonalisation (MGS, CGS with refinement), attaching m as the velocity block's MatNullSpace, and a looser inner atol.
The change
After the custom-FMG velocity PC is set up, the admitted rotations (the velocity parts of the rotated null space) that A_vv annihilates to 1e-10 relative are orthonormalised. The velocity sub-KSP's PC becomes a Python PCShell around the configured multigrid:
A near-null mode is left to the multigrid, as it is today. An example is a declared rotation on a faceted wall, where A m is the faceting error. The solve record gains
projected_null_modes, andvelocity_pc_typestill reports the inner PC ("mg"). The GAMG velocity route and the rotated vector-problem route are unchanged.Evidence
The answer is unchanged, and the inner solve takes 4 to 5 iterations where it took up to 200.
macOS arm64, projection on and off:
Hyperion (Linux, Xeon Gold 6240R), annulus_fmg on this branch under eight forced OpenBLAS kernels:
Tests
tests/test_1142_rotated_exact_mode_projected_pc.pyis tier B:200 <= 10on macOS arm64 and on the x86 kernels that stall. Under SkylakeX, development takes 4 inner iterations, so there the next check is the one that bites.OPENBLAS_CORETYPE=Nehalemmust finish within 240 s. On eddab70 it timed out (hyperion); on this branch it passes in 14 s.In CI it runs in shard 3. The 53 serial files that use rotated free slip or the custom multigrid give 504 passed, 4 skipped and 1 failed on this branch (macOS). The failure was test_1021, which read the multigrid configuration off the velocity sub-PC object and found the projection around it. The configuration is unchanged; the test now unwraps the projection, and test_1021 and test_1142 give 24 passed and 1 skipped (the forced-kernel child).
Issues
Underworld development team with AI support from Claude Code