Skip to content

Ranks without blocks ​

IDGroupMilestoneTypeBackendsFigureRegression
DV-1Infrastructure#82 (follow-up)CCPU, FNLyes—

Case and scope ​

Under runtime AMR the tree never splits a family of sibling blocks across ranks: derefinement averages the children of a parent on one rank. tree%mpi_redistribute cuts the Morton-ordered blocks into one contiguous run per rank, a complete family being a unit no cut splits; the runs minimise the block count of the busiest rank (#123; the earlier greedy walk accumulated its overshoots and could leave the last rank empty). A grid with fewer families than ranks still leaves ranks with no block: four blocks at level 1 are one family, all on rank 0 at np 2. Every code path that sizes an array by the local blocks_number meets a zero there. (A static grid is balanced by block count since #123, [amr] balance_static; the cases below that test the empty rank set it .false. to keep this layout, and the split case tests the balanced one.)

On FNL that is a zero-byte device allocation: acc_malloc(0) returns a null pointer (measured), and FUNDAL reports a null pointer as a failed allocation. Every MHD run therefore died at initialisation (#82): the div(B) history copied its seam-face flags, divb_seam(blocks_number, 6), to the device. The array is now sized by the block capacity nb, as every other block-indexed device array is. Small multi-rank tests rarely leave a rank empty, so this leg makes the empty rank the test.

What the leg catches: any block-indexed allocation, copy or reduction that fails, or changes the result, on a rank that owns no block, in every model and option that allocates block-indexed state; a regrid that does not repopulate an empty rank; and (split) a time loop that changes the result when the children of one parent sit on different ranks, the layout the static balancing of #123 creates. The partition leg runs the library unit test of the split itself (tests/amr/test_tree_balance).

Models and numerics ​

ItemChoiceCode
ModelsEuler; ideal MHD under none, glm and eglm; external gravity g=(0,−10)models
SpaceWENO5 flux splitting on characteristic variables; weno-riemann HLLD (6th-order correction, weno sensor) in one casecompute_residuals_weno, compute_residuals_riemann, adam_flume_cpu_object.F90
TimeSSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL 0.4adam_stepper_object.F90 (SELAH)
Distributionsibling families kept on one rank (balance_static = .false., and the runtime AMR case); split: by block count, families cutmpi_redistribute, adam_tree_object.F90; rebalance, adam_adam_object.F90
div(B) historyseam-face flags sized by the block capacity nbset_divb_seam, adam_flume_common_object.F90; compute_divb_history, adam_flume_fnl_object.F90
Optionspositivity limiter, equilibrium = atmosphere, runtime AMR with a Löhner markerlimit_positivity, regrid_forest, adam_flume_cpu_object.F90; mark_by_lohner, adam_flume_common_object.F90

Initial and boundary conditions ​

ItemValue
Domain[0,1]2, z null
Gridquadtree, four blocks of 162 cells at level 1 (one sibling family), ngc = 4
Ranks1 and N=2
Steps20 at CFL 0.4
Boundariesx periodic; y hydrostatic (the atmospheres), wall-inviscid (repro)
CaseInput (gravity/make_atmosphere.py)
reprothe issue's input: iso2d-mhd turned into a uniform EGLM state with B=(0.5,0.7,0.2), y walls, no gravity
Eulerstrat2d: the isothermal atmosphere under g=(0,−10) with a 10% pressure pulse at the centre
MHD, none / glm / eglmstrat2d-mhdx: strat2d with a field across gravity, B=(0.05,0,0), under each divergence control
EGLM, positivity limiterstrat2d-mhdx with positivity_limiter = cell
EGLM, equilibrium = atmospherestrat2d-mhdx --balanced
EGLM, weno-riemann + HLLDstrat2d-mhdx --riemann hlld
EGLM, runtime AMRstrat2d-mhdx with runtime regrids every 5 steps to level 2: a Löhner marker on the density (refine_tol = 0.1, derefine_tol = 0.02, buffer = 2), acting at the regrids only, so rank 1 starts empty and the first regrid repopulates it
EGLM, splitstrat2d-mhdx with the static balancing on (balance_static at its default): the family is cut by block count, 2 / 2 at np 2, and the run keeps that layout
partitionno run: tests/amr/test_tree_balance (np 1, a host program) checks contiguous_min_max_split, the split of the units (families of ratio blocks, single blocks) the runtime regrids use: the 36 units of S4c's tree (#121) give a busiest rank of 30, 18 and 10 blocks on 4, 8 and 16 ranks, the optimum keeping the families whole, no rank empty; a uniform tree 8 per rank; every split contiguous; on 2000 random unit sequences the busiest rank equals the exact minimum of a dynamic program over all contiguous splits

Asserted (ranks_oracle.py):

  • ownership: in the np 2 run every rank but 0 owns no block at step 0, so the leg cannot become vacuous if the distribution changes; in the AMR case, every rank owns blocks at the end; in the split case every rank owns blocks at step 0;
  • identity: np 2 = np 1 bitwise, every field and every cell at the last checkpoint. With every block on rank 0 the arithmetic is the same, and the reductions add exact zeros.

Input files ​

FileRole
src/tests/flume/verification/gravity/make_atmosphere.pywrites the inputs
src/tests/flume/verification/ranks/check.shrewrites them to one family, runs each case on 1 and N ranks (--np N, --legs LIST: repro, euler, mhd-none, mhd-glm, mhd-eglm, limiter, balanced, hlld, amr, split, partition, default all; --keep, --it-save N); the restart-repartition legs repart-uniform, repart-refined, repart-forest (not in the default selection; --dump-np N, --to-np "M ...")
src/tests/flume/verification/ranks/ranks_oracle.pyownership (--empty-at-start, --filled-at-end, --split-at-start) and same (bitwise)
src/tests/amr/test_tree_balance.F90 (fobis build --mode test-tree-balance-gnu)the unit test of the partition leg
src/tests/flume/verification/make_doc_runs.sh (group ranks)the AMR case on 1 and 2 ranks, a checkpoint every step
src/tests/flume/verification/make_doc_figures.py (fig_ranks)the figure
bash
cd src/tests/flume/verification/ranks && ./check.sh                    # CPU, np 1 and 2
FLUME_EXE=$PWD/../../../../../exe/adam_flume_fnl ./check.sh            # FNL
cd .. && ./make_doc_runs.sh <dir> ranks && python3 make_doc_figures.py --out ../../../../docs/public/flume --runs <dir> --only ranks

Results ​

DV-1: blocks per rank before and after the first regrid, and the np 2 - np 1 difference

Left: the speed at step 4, before the first regrid, the block outlines coloured by owner: the four blocks are all rank 0's. Centre: step 20; the first regrid (step 5) refined the family into four, and the distribution gave each rank two families, 8 blocks. Right: the blocks of each rank against the step. Over all 21 checkpoints the largest difference between the np 2 and np 1 states, over every field and every cell, is 0.

Case (FNL, 2 A30 GPUs)blocks per rank, step 0 → 20before the fix, np 2after: np 2 vs np 1
repro4 / 0 → 4 / 0aborts at initialisationbitwise
Euler4 / 0 → 4 / 0runsbitwise
MHD, none4 / 0 → 4 / 0abortsbitwise
MHD, glm4 / 0 → 4 / 0abortsbitwise
MHD, eglm4 / 0 → 4 / 0abortsbitwise
EGLM, positivity limiter4 / 0 → 4 / 0abortsbitwise
EGLM, equilibrium = atmosphere4 / 0 → 4 / 0abortsbitwise
EGLM, weno-riemann + HLLD4 / 0 → 4 / 0abortsbitwise
EGLM, runtime AMR4 / 0 → 8 / 8abortsbitwise (4096 cells)
EGLM, split (#123)2 / 2 → 2 / 2— (added with #123)bitwise (1024 cells); at np 3, 2 / 1 / 1, bitwise
BackendBoundResult
FNL, after the fix9/9 bitwise, ownership as assertedpass, 3.6 min
FNL, the pre-fix executable (negative control)must fail8 of 9 cases abort; Euler, which never computes the div(B) history, runs
CPU9/9 bitwisepass, 2.8 min
FNL and CPU with the static balancing (#123, medooza: A30, gfortran 16.2)10/10 bitwise, ownership as asserted; split also at np 3 (CPU)FNL pass, 3.3 min; CPU pass, 3.4 min; np 3 split 19 s
FNL and CPU with the runtime split of the families (#123, medooza: A30, gfortran 16.2)10/10 bitwise, ownership as asserted; partition (CPU, a host program); amr and split also at np 3 (CPU)FNL pass, 21 min; CPU pass, 15 min; np 3 2.6 min (wall times on a loaded /ifs, during large copies to it: not comparable with the row above)

Related cases: Scaling covariance (the other identity leg of this group); the atmospheres are the external-gravity inputs.

Findings ​

  • The issue reported the CPU backend unaffected, since a zero-size host array is legal; it passes the leg as well.
  • divergence_control = none failed too, because the div(B) history is skipped only for Euler.
  • The failure was specific to FNL and invisible to every small multi-rank test that happened to give each rank a block.

Restart repartition ​

A restart is read by the rank count that wrote it: each rank reads its own -proc<rank>.fbd, and the .tnd names the owner rank and the block index of every block. src/tests/flume/speedup/repartition.py (issue #133 phase 1; usage in the I/O cookbook) rewrites a dump written on N ranks for M ranks: the .fbd and .wmf files split block by block (bytes copied as they are), the .tnd rewritten, the .time, .reference, .sinks, .dff copied, one pass per realm of a forest. Its split rules are FLUME's: units keeps sibling sets whole (every runtime regrid), siblings is the static cold-start layout.

The legs repart-uniform (the V2 vortex, 16 static blocks, both rules), repart-refined (the runtime-regrid vortex, levels 1–3, continued through a regrid that coarsens a sibling set on the new layout) and repart-forest (the 2-realm forest with realm 2 refined) save a restart on --dump-np ranks at step 10 (40 for the refined case), continue it on its own rank count (the reference) and, repartitioned, on every rank count of --to-np.

LegBackendDump → continuationsResult
repart-uniformCPUnp 2 → np 1, 3, 4, rules units and siblingsbitwise, every field and cell, step 30
repart-refinedCPUnp 2 → np 1, 3, 4, rule unitsbitwise at step 60
repart-forestCPUnp 2 → np 1, 3, 4, rule siblings, both realmsbitwise
repart-uniform, repart-refinedFNLnp 1 → np 2bitwise

Repartitioning a dump to its own rank count rewrites its .fbd and .tnd byte for byte. Not exercised yet: the .wmf split (wall-model runs) and the .sinks/.dff copies.

Measured: WSL, gfortran 16.2.0 + Open MPI 5.0.11 (CPU) and nvfortran 26.9 on two RTX 4070 (FNL), develop 0bcdf870 sources, 2026-11-22 (correctness only).