You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
IBM: ib_mass_relax return depends on the rank count when a contact sits exactly on a rank seam #2433
Two circles in contact along the diagonal, with the contact point exactly on a rank seam (2D, friction 0.1, moving bodies, default ib_mass_relax): 1 rank and 2 or 4 ranks differ by 1.5e-2 in the fields and 6.2e-3 in force after 100 steps. With ib_mass_relax = 0 the rank counts agree (fields 2e-12, force history bitwise). The ghost-point halo fix for #2388 does not cover it, and moving the same contact 0.05 off the seam makes the rank counts agree.
A per-stage cell dump (found while working on #2388) shows the first difference at the first stage of a step boundary: density and pressure in fluid cells in the two pockets beside the contact are offset by a near-uniform 1.1e-3 while the velocity agrees to 1e-16, consistent with the mass return of ib_mass_relax being distributed differently when the relaxation region of a contact straddles the seam.
Next
Find where the returned mass is distributed (the relaxation region / weights per cell) and why it depends on the decomposition when the region crosses a seam (a rank-local normalisation, a halo cell counted on both sides, or a per-rank sum before the cross-rank reduction). Must stay O(local bodies) per step (no global gathers).
Audit: the seam gap is real for generic geometry; the halo fix removes it for the diagonal pair; one relax-only remainder
Setup.
Code: Phoenix GNU 12.3 + OpenMPI 4.1.5 (p-cpu), --no-debug --no-reldebug --no-single. "master" is cad6a7d; "fix" is the same commit with the fork branch ibm-corrected-gps-halo applied (fills the halos of the corrected ghosts before the buried-image-point average).
Metric: max relative field difference at step 100, max over variables of max|dq| / max|q|.
Baseline: each case's own round-off sensitivity, from body 1 nudged by 1e-12 on 1 rank.
Variants.
"Generic" = pair centre shifted by (0.1371, 0.2913) cells, body 2 radius x1.0437 and speed x0.913.
"near" = the same, but static-ish (v = 0.02) with a gap of 0.137 cell, so the bodies never touch.
Diagonal pair
master 1 vs 2 / 1 vs 4
fix 1 vs 2 / 1 vs 4
1e-12 nudge
contact exactly on the corner (as reported)
6.2e-3 / 1.5e-2 (first at step 26-30, cell (39, 39))
1.6e-11 / 2.0e-11
2.4e-11
same, ib_mass_relax = 0
6.2e-3 / -
1.5e-11 / -
generic
0.30 / 0.28 (first at step 10, cell (39, 39))
4.0e-12 / 6.3e-12
3.4e-11
generic, ib_mass_relax = 0
0.27 / 0.45
2.6e-10 / 2.2e-11
shift (0.37, 0.37) cells
6.5e-2 / 0.19
-
shift (1.43, -0.61) cells
0.25 / 0.25 (relax 0: 0.24)
2.0e-11 / -
near, never touching
0.73 / 0.87 (4 ranks: from step 1)
2.5e-12 / -
On 1 rank, master and fix are bitwise identical in every case.
Verdict for the diagonal pair: (b), a real defect, and not a degenerate test.
The generic placements differ by more than the on-seam one (up to 0.87 against 1e-11 round-off), and so does a pair that never touches.
On master the relax is not what makes it rank dependent: with ib_mass_relax = 0 the diagonal pair still differs by 6.2e-3 to 0.45.
The mechanism is the buried-image-point average in s_ibm_correct_state. It reads corrected_gps and the corrected ghost states of the neighbouring rank, and those halos are stale on master.
With the halo fix, every diagonal case agrees to round-off on 2 and 4 ranks, with and without ib_mass_relax. That includes the on-seam case, so for this configuration I do not reproduce "the halo fix does not cover it".
A relax-only remainder (head-on pair along x, contact near the 2-rank seam at x = 10, generic placement).
A pair (head-on along x), generic
master 1 vs 2
fix 1 vs 2
1e-12 nudge (fix)
default ib_mass_relax (30)
0.12 (first at step 15)
1.6e-2 (first at step 25, cell (42, 62))
4.4e-11
ib_mass_relax = 0
-
1.2e-11
contact exactly on the seam (degenerate)
1.2e-2
bitwise
So once the halo defect is fixed, a generic contact across a seam still depends on the rank count through ib_mass_relax alone. This is the mechanism this issue describes: the body bank's release is distributed over a shell that crosses the seam.
I did not narrow it further. ib_heat_wrt, which would expose mdot_face per step, needs chemistry. The next step is a per-rank dump of ib_heat(3), ib_heat(5) and ib_heat(7) per body at steps 20-25. That separates the bank input (face mass and swept cells counted per rank) from the shell distribution (s_ib_shell_mass assigns a cell within reach of two bodies to the first marker in scan order).
Proposed fix.
Code: land the halo fix. It is needed for generic contacts and near-contacts on seams, not only for the on-seam test.
Then fix the relax remainder in s_ib_shell_mass / s_ib_exchange_heat.
Test change: the on-seam contact (corner or seam exactly at the contact point) is the least sensitive placement here. A rank-independence test should use the generic placement above, on 1, 2 and 4 ranks, at round-off tolerance.
Root cause of the remaining rank dependence: the marker of a cell inside two bodies follows the rank's slot order
Setup. origin/master bb9cfe5, wingtip GNU 13.3 + OpenMPI 4.1.6, CPU, double. The contact-pair deck of the Contact pair along x test (box 20, dx = 0.25, friction 0.1, moving_ibm = 2, 100 steps), shifted by (sx, sy) cells; "generic" also scales body 2's radius by 1.0437 and its speed by 0.913. 2 ranks split at x = 10; 4 ranks put the corner at (10, 10). Metric: max over variables of max|dq| / max|q| at step 100.
The force history of the (0.37, 0.37) case is identical to all printed digits until step 37, then both bodies' forces jump (y force -0.016 on 1 rank, +0.077 on 2). The collision itself is owned by exactly one rank at every stage (checked by printing f_local_rank_owns_location per rank).
At step 37 the right edge of body 1 passes the centre of cell 40 (x = 10.125), the first cell of rank 1, which body 2 already covers. In s_apply_ib_patches_grid_cell_parallelism the last body in the rank's local slot order wins a cell that lies inside two bodies. The slot order depends on the decomposition (on one rank it is the global order), so after that step the two runs have different markers, ghost points and image points in the contact region.
The many_ib_patch_parallelism path already takes the atomic max of the encoded id for this reason.
Fix (in the batched fixes PR). The grid-cell path also stores max(ib_markers%sf, encoded_patch_id), so the cell goes to the largest encoded id whatever the slot order. With no periodic image involved, that is the last body in global order, which is what one rank did before. One-rank runs are bitwise unchanged in all five placements I compared. The change is local per cell and adds no communication.
Still open: no 3D contact case was run; the 3D branch gets the same one-line change.
Follow-up, now in #2514. Taking the larger encoded id for every overlap also changed 2D -> IBM -> Plane Poiseuille -> ib_wall_order=2 by 3.7e-4. Its slabs are longer than the periodic box, so two images of the same body overlap. The final rule is therefore narrower:
Two different bodies: the larger encoded id wins, as before.
Images of one body: the later image wins, as it did on master. The image loops run in the same order on every rank.
With this rule that test's golden is unchanged, and the 1 vs 2 vs 4 rank results above still hold. The new 2-rank test IBM -> Collision -> Overlap cell on a rank seam (493989F3) passes on Phoenix GNU 12.3 and on an H200 with NVHPC 25.11.
Activity
sbryngelson commentedon Nov 24, 2026
Audit: the seam gap is real for generic geometry; the halo fix removes it for the diagonal pair; one relax-only remainder
Setup.
p-cpu),--no-debug --no-reldebug --no-single. "master" is cad6a7d; "fix" is the same commit with the fork branchibm-corrected-gps-haloapplied (fills the halos of the corrected ghosts before the buried-image-point average).moving_ibm = 2, 100 steps). 2 ranks split at x = 10; 4 ranks put the corner at (10, 10).Variants.
ib_mass_relax = 0ib_mass_relax = 0On 1 rank, master and fix are bitwise identical in every case.
Verdict for the diagonal pair: (b), a real defect, and not a degenerate test.
ib_mass_relax = 0the diagonal pair still differs by 6.2e-3 to 0.45.s_ibm_correct_state. It readscorrected_gpsand the corrected ghost states of the neighbouring rank, and those halos are stale on master.ib_mass_relax. That includes the on-seam case, so for this configuration I do not reproduce "the halo fix does not cover it".A relax-only remainder (head-on pair along x, contact near the 2-rank seam at x = 10, generic placement).
ib_mass_relax(30)ib_mass_relax = 0So once the halo defect is fixed, a generic contact across a seam still depends on the rank count through
ib_mass_relaxalone. This is the mechanism this issue describes: the body bank's release is distributed over a shell that crosses the seam.I did not narrow it further.
ib_heat_wrt, which would expose mdot_face per step, needs chemistry. The next step is a per-rank dump ofib_heat(3),ib_heat(5)andib_heat(7)per body at steps 20-25. That separates the bank input (face mass and swept cells counted per rank) from the shell distribution (s_ib_shell_massassigns a cell within reach of two bodies to the first marker in scan order).Proposed fix.
s_ib_shell_mass/s_ib_exchange_heat.AI-assisted (Claude Code).
sbryngelson commentedon Nov 25, 2026
Root cause of the remaining rank dependence: the marker of a cell inside two bodies follows the rank's slot order
Setup. origin/master bb9cfe5, wingtip GNU 13.3 + OpenMPI 4.1.6, CPU, double. The contact-pair deck of the
Contact pair along xtest (box 20, dx = 0.25, friction 0.1,moving_ibm = 2, 100 steps), shifted by (sx, sy) cells; "generic" also scales body 2's radius by 1.0437 and its speed by 0.913. 2 ranks split at x = 10; 4 ranks put the corner at (10, 10). Metric: max over variables of max|dq| / max|q| at step 100.ib_mass_relax = 0ib_mass_relax = 0ib_mass_relax: they differ just as much with it off.f_local_rank_owns_locationper rank).s_apply_ib_patches_grid_cell_parallelismthe last body in the rank's local slot order wins a cell that lies inside two bodies. The slot order depends on the decomposition (on one rank it is the global order), so after that step the two runs have different markers, ghost points and image points in the contact region.many_ib_patch_parallelismpath already takes the atomic max of the encoded id for this reason.Fix (in the batched fixes PR). The grid-cell path also stores
max(ib_markers%sf, encoded_patch_id), so the cell goes to the largest encoded id whatever the slot order. With no periodic image involved, that is the last body in global order, which is what one rank did before. One-rank runs are bitwise unchanged in all five placements I compared. The change is local per cell and adds no communication.Still open: no 3D contact case was run; the 3D branch gets the same one-line change.
AI-assisted (Claude Code).
sbryngelson commentedon Nov 26, 2026
Follow-up, now in #2514. Taking the larger encoded id for every overlap also changed
2D -> IBM -> Plane Poiseuille -> ib_wall_order=2by 3.7e-4. Its slabs are longer than the periodic box, so two images of the same body overlap. The final rule is therefore narrower:With this rule that test's golden is unchanged, and the 1 vs 2 vs 4 rank results above still hold. The new 2-rank test
IBM -> Collision -> Overlap cell on a rank seam(493989F3) passes on Phoenix GNU 12.3 and on an H200 with NVHPC 25.11.AI-assisted (Claude Code).
IBM: a cell inside two bodies takes the largest encoded id, independe…
IBM: a cell inside two bodies takes the largest encoded id, independe…
IBM: a cell inside two bodies takes the largest encoded id, independe…
Batched fixes: serial old_ic restart, IB overlap-cell rank independen…