Avoid replicated 3D boundary-flux recovery - #593
Conversation
Gather coordinate-keyed 3D reactions and trace elements on rank zero, assemble and solve the global P1/P2 boundary-mass system once, and scatter only each rank's requested recovered values. Preserve existing recovery semantics while preallocating sparse COO arrays and propagating root-side failures collectively. This reduces the Zhong 1/64 geoid postprocessing peak from more than 576 GB to 301.77 GB on 192 ranks without changing the 1/32 coefficients.
Adversarial review — spherical-shell cluster (#591, #592, #593, #594)Reviewed as a group because they overlap: #594 contains #591, and all four land ClusterC1. #594 is stacked on #591 — merging #594 merges #591. C2. C3. Not a defect, recorded because the diff view says otherwise. GitHub #594 — Zhong 20081. #593 — boundary-flux recovery2. The memory bound moves, it does not fall. Replacing 3. Every rank must reach the gather. The recovery is collective by #592 — internal spherical shell4. It edits 5. What we did not doNone of the four was run. The findings above come from reading the diffs and Underworld development team with AI support from Claude Code |
|
Merging. Two findings from the cluster review are carried forward rather than resolved here:
|
Summary
Fix the MPI memory scaling of 3D boundary-flux recovery without changing its reaction, trace-mass, gauge-removal, or local-return mathematics.
Problem
The existing 3D path uses
MPI.allgatherfor nodal reactions and P1/P2 trace elements. Every rank therefore retains the complete global boundary mesh, assembles the same sparse surface-mass matrix, and runs the same consistent-mass solve. Memory grows with both global boundary size and rank count.This became the limiting post-processing stage for high-resolution spherical rotated-free-slip models: the Stokes solve completed, but consistent P2 normal-traction recovery exhausted aggregate job memory.
Change
xsorder;The behavior of
mass={"auto","lumped","consistent","p1"}, partial-reaction sum/overwrite semantics, mean removal, and P2 midpoint interpolation is unchanged.Validation
tests/test_1019_boundary_flux.py -k 3d: 3 passed.tests/parallel/test_1065_boundary_flux_parallel.py -k 3d: 2 passed on every rank.cellsize=1/64, 192-rank post-processing path in 7:29 with 301.77 GB peak memory; the replicated path had exhausted 576 GB.Scope
This PR contains only the general
boundary_fluxgather/solve/scatter correction and itsrotated_bcdocumentation update. Zhong geoid mathematics and benchmark-facing APIs remain isolated in #591.