Appearance
Ranks without blocks
| ID | Group | Milestone | Type | Backends | Figure | Regression |
|---|---|---|---|---|---|---|
| DV-1 | Infrastructure | #82 (follow-up) | C | CPU, FNL | yes | — |
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
| Item | Choice | Code |
|---|---|---|
| Models | Euler; ideal MHD under none, glm and eglm; external gravity | models |
| Space | WENO5 flux splitting on characteristic variables; weno-riemann HLLD (6th-order correction, weno sensor) in one case | compute_residuals_weno, compute_residuals_riemann, adam_flume_cpu_object.F90 |
| Time | SSP Runge–Kutta, 3 stages (runge-kutta-ssp-33), CFL 0.4 | adam_stepper_object.F90 (SELAH) |
| Distribution | sibling families kept on one rank (balance_static = .false., and the runtime AMR case); split: by block count, families cut | mpi_redistribute, adam_tree_object.F90; rebalance, adam_adam_object.F90 |
| div(B) history | seam-face flags sized by the block capacity nb | set_divb_seam, adam_flume_common_object.F90; compute_divb_history, adam_flume_fnl_object.F90 |
| Options | positivity limiter, equilibrium = atmosphere, runtime AMR with a Löhner marker | limit_positivity, regrid_forest, adam_flume_cpu_object.F90; mark_by_lohner, adam_flume_common_object.F90 |
Initial and boundary conditions
| Item | Value |
|---|---|
| Domain | |
| Grid | quadtree, four blocks of ngc = 4 |
| Ranks | 1 and |
| Steps | 20 at CFL 0.4 |
| Boundaries | hydrostatic (the atmospheres), wall-inviscid (repro) |
| Case | Input (gravity/make_atmosphere.py) |
|---|---|
repro | the issue's input: iso2d-mhd turned into a uniform EGLM state with |
| Euler | strat2d: the isothermal atmosphere under |
MHD, none / glm / eglm | strat2d-mhdx: strat2d with a field across gravity, |
| EGLM, positivity limiter | strat2d-mhdx with positivity_limiter = cell |
EGLM, equilibrium = atmosphere | strat2d-mhdx --balanced |
EGLM, weno-riemann + HLLD | strat2d-mhdx --riemann hlld |
| EGLM, runtime AMR | strat2d-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, split | strat2d-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 |
partition | no 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
splitcase 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
| File | Role |
|---|---|
src/tests/flume/verification/gravity/make_atmosphere.py | writes the inputs |
src/tests/flume/verification/ranks/check.sh | rewrites them to one family, runs each case on 1 and --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.py | ownership (--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 ranksResults

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 → 20 | before the fix, np 2 | after: np 2 vs np 1 |
|---|---|---|---|
repro | 4 / 0 → 4 / 0 | aborts at initialisation | bitwise |
| Euler | 4 / 0 → 4 / 0 | runs | bitwise |
MHD, none | 4 / 0 → 4 / 0 | aborts | bitwise |
MHD, glm | 4 / 0 → 4 / 0 | aborts | bitwise |
MHD, eglm | 4 / 0 → 4 / 0 | aborts | bitwise |
| EGLM, positivity limiter | 4 / 0 → 4 / 0 | aborts | bitwise |
EGLM, equilibrium = atmosphere | 4 / 0 → 4 / 0 | aborts | bitwise |
EGLM, weno-riemann + HLLD | 4 / 0 → 4 / 0 | aborts | bitwise |
| EGLM, runtime AMR | 4 / 0 → 8 / 8 | aborts | bitwise (4096 cells) |
EGLM, split (#123) | 2 / 2 → 2 / 2 | — (added with #123) | bitwise (1024 cells); at np 3, 2 / 1 / 1, bitwise |
| Backend | Bound | Result |
|---|---|---|
| FNL, after the fix | 9/9 bitwise, ownership as asserted | pass, 3.6 min |
| FNL, the pre-fix executable (negative control) | must fail | 8 of 9 cases abort; Euler, which never computes the div(B) history, runs |
| CPU | 9/9 bitwise | pass, 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 = nonefailed 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 .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.
| Leg | Backend | Dump → continuations | Result |
|---|---|---|---|
repart-uniform | CPU | np 2 → np 1, 3, 4, rules units and siblings | bitwise, every field and cell, step 30 |
repart-refined | CPU | np 2 → np 1, 3, 4, rule units | bitwise at step 60 |
repart-forest | CPU | np 2 → np 1, 3, 4, rule siblings, both realms | bitwise |
repart-uniform, repart-refined | FNL | np 1 → np 2 | bitwise |
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).