Repository navigation
A free surface builds on a rank that holds no cells - #1215
Conversation
FreeSurface._build_interior_diffuser chose between a direct nodal read of the mesh displacement and a fallback by np.max of each rank's node distances. On a rank with no nodes the array is empty and np.max raised, while the other ranks went on into the collective solve and waited (H1, np 3). The choice was also made rank by rank. The ranks now agree on it (a logical AND, a rank with no nodes counting for the direct read). The verbose report's maxima, built on every rank, are reduced over the ranks too. Test: tests/parallel/test_1074_free_surface_on_an_empty_rank_parallel.py, on a box whose cells a shell partition gives to every rank but the last; it compares the free-surface velocity's energy with the default partition's in the same run, and is added to test.sh's np 3 runs. Serially it passes, as do the free-surface tests (14); it has not run under MPI here. Underworld development team with AI support from Claude Code
…hat it produces (review of #1215) From the adversarial review of c831b08: - The test only solved, so it never reached advance(), where the agreed displacement read is used and the mesh deforms on the empty rank. It now builds the free surface verbose, solves, advances one step and solves again. - It compared the user's Stokes energy, which the free surface does not change. It now compares the integral of h_inf^2 over the surface as well. - Below np 3 it compared two runs on one partition and could not fail; it now skips there. - The bound (rel 1e-6) is named and is to be set from the measured np 3 difference. - The absolute 1e-12 coincidence test is marked TODO(BUG): the two P1 fields share a DM, so the match is topological. - The empty-safe global maximum is one function, _global_abs_max, at the eight sites that wrote it out; the test docstring no longer says who measured what. Serially the free-surface tests pass (14); the new test skips there. Underworld development team with AI support from Claude Code
Adversarial review record, and the answer in a421d1cOne round, by a fresh reviewer that read the code through git without running it. Fixed:
Checked and safe on an empty rank, by reading:
Not checked: Not run: MPI. The test skips serially; the free-surface tests pass (14). The bound Please run at np 3, on development (it should hang at the build) and on this branch, and report the measured relative differences of the two integrals. I'll set Underworld development team with AI support from Claude Code |
|
Review from the Underworld development team with AI support from Claude Code (H1: review and parallel test runs on a 96-thread Linux workstation (Intel Xeon Gold 6240R, AVX-512; MPICH)) Verdict at a421d1c: changes requested. The fix is right: development hangs on an empty rank and the branch does not. But the new test fails on the branch as written. Its placeholder Development and the branch at np 3 with an empty rankThe scenario is the new test's model: the same box and shell partition, so the cells per rank are [161, 161, 0].
The new test on the branch
The failure is on ∫h_inf², with the empty layout against the default one in the same run: a relative difference of 1.13e-5, against a bound of 1e-6. The energy assertion is not reached. Its difference is 4.3e-7, so it would also be close to 1e-6. Relative differences against serialThese are the test's two quantities after solve, one step and a second solve. The serial reference is np 1. Each layout was run twice, in separate jobs.
Run-to-run noise: at np 2 and 3, every repeat is bit-identical to its first run. Serial repeats differ at about 1e-15. The spread in the table is therefore partition dependence, not noise. Before the step, after the first solve only, all layouts agree with serial to 6.8e-11 or better in energy and 1.6e-10 or better in ∫h_inf². That matches the Stokes tolerance of 1e-8. The step opens the spread to about 1e-6 to 1e-5. The deformed geometry comes from two solves that are much looser than the Stokes solve:
The empty-rank layout sits within a factor of about 4 of the ordinary np 2 spread, which is the largest of the ordinary layouts in energy. Suggested bound: If you want a tight check to remain, also assert the two quantities after the first More steps: 5 steps, the same quantities and the surface itselfThese are the maxima over steps 1 to 5, relative to serial. The surface height and u_n are the gathered surface ring, given as the maximum nodal difference over the maximum magnitude.
CollectivesThe diff:
Other rank-local decisions in the build and the step. I read them looking for a branch an empty rank could take alone, and found none:
Nits, not blocking:
FreeSurface testsThe files were
What was run, and what was notRun:
Not run:
Underworld development team with AI support from Claude Code |
…efore the step checked too H1 measured the free surface at np 2 and 3 against serial (repeatable, so partition dependence): before the step everything agrees to 1.6e-10; after it the surface integral differs by up to 1.3e-5 (np 3, an empty rank), widened by the carrier Poisson solve at its 1e-3 tolerance and the P1 velocity projection. The test now checks the state before the step at 1e-8, which shows the empty rank changes nothing there, and after it at 1e-4, with a comment giving the measurements. Underworld development team with AI support from Claude Code
# Conflicts: # src/underworld3/systems/free_surface.py
A free surface could not be built on a rank that holds no cells. No issue was filed: this PR is the report. H1 found it while reviewing #1209, at np 3 on a 96-thread Linux workstation (Intel Xeon Gold 6240R, MPICH).
The defect
FreeSurface._build_interior_diffuserchooses how the mesh displacement is read: directly, node for node, when the carrier field's nodes coincide with the mesh's, or by a fallback otherwise. It tested that withnp.maxof each rank's node distances.np.maxraised.The verbose report had the same
np.maxof a possibly empty array inside an f-string that every rank builds.Fix
Tolerances and coordinate matches
dist < 1e-12, the nodal read's own) is unchanged; it is now agreed over the ranks.Test
tests/parallel/test_1074_free_surface_on_an_empty_rank_parallel.py.test.sh's np 3 runs, since at np 2 the partition would leave one rank holding every cell.H1's parallel run (comment 6911617873): development hangs at np 3 with an empty rank. The branch completes 1 and 5 steps, and without an empty rank it is bit-identical to development.
Run here, serially only on macOS (12-core Apple M4): the new test passes (no rank is empty), and so do the free-surface tests (14). It has not been run under MPI here. Please run it at np 3, on development (where it should hang) and on this branch.
Underworld development team with AI support from Claude Code