Skip to content

AMR: let amr_place_owner shed blocks heavier than its load cap - #2411

Open
sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:amr-place-owner-cap
Open

sbryngelson wants to merge 1 commit into
MFlowCode:masterfrom
sbryngelson:amr-place-owner-cap

Conversation

@sbryngelson

Copy link
Copy Markdown
Member

AI-assisted (Claude Code). Part of #2247.

What

amr_place_owner puts each block on the rank that owns most of its coarse cells, then moves blocks off any rank above 1.05 x the mean load. A move was refused when it would put the receiver above that cap. With about one block per rank or fewer, a single block already weighs more than the cap, so no rank, not even an empty one, could take it: nothing moved and blocks piled up on the ranks under the refined region.

A block may now go to a rank it alone fills (receiver load up to the block's own weight), and only when the move lowers the larger of the two loads, so a rank holding a single heavy block does not shed it back and forth.

Why

Found while chasing the 512-GPU timing of the tiling follow-up to #2381. On Frontier with benchmarks/amr-style blast (--gbpp 16, 40 steps) on #2381's tiling, amr_place_owner = T put 64 blocks on one rank: max/mean load 67.7, 335 of 512 ranks without a block, step loop 27.9-35.6 s against 4.6 s without it. amr.md promises the 5% cap.

How it was checked

Frontier MI250X, OpenMP offload (amdflang), --case-optimization, 512 GPUs (64 nodes), amr_device_pack = T, one run each, step-loop wall:

Tree amr_place_owner = F amr_place_owner = T before amr_place_owner = T with this fix
#2381 (343-512 level-1 blocks) 4.60 s 35.6 s (max/mean load 41-68) 4.67 s (max/mean 1.58, as with F)
master (64 level-1 blocks) 5.70 s 5.46 s

./mfc.sh precheck passes.

Not checked

  • The two amr_place_owner regression tests (2-rank, results must not depend on owners) were not run locally; CI runs them. The change only affects which rank owns a block.
  • NVHPC: host-side integer code.

Made with Claude Code.

With about one block per rank or fewer, each block outweighs the cap of 1.05 x the
mean load, so no rank could accept one and every block stayed on the rank owning its
coarse cells (68x the mean load on 512 GPUs). A block may now go to a rank it alone
fills, and only when the move lowers the larger of the two loads.
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Claude Code Review

Head SHA: 01f29d1

Files changed:

  • 1
  • src/simulation/m_amr_distribution.fpp

Findings:
No issues found. Checked in step 4: src/simulation/m_amr_distribution.fpp (s_amr_place_owner). The new guard load(m)+wt(a) > max(cap,wt(a)) .or. load(m)+wt(a) >= load(r) matches the updated header comment. It guarantees each move strictly lowers the sender's load below its old value. If m == r, the move is rejected. The shed loop is deterministic on replicated inputs.

@sbryngelson
sbryngelson marked this pull request as ready for review November 23, 2026 06:00
@sbryngelson
sbryngelson requested a review from a team as a code owner November 23, 2026 06:00
@sbryngelson
sbryngelson requested review from danieljvickers and removed request for a team November 23, 2026 06:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant