public pure function gpu_io_staging_bytes(local_dims, checkpoint_cfg, device_write) result(bytes)
Device memory the GPU-aware ADIOS2 write path (src/io/adios2/io.f90,
write_device_field_adios2) holds on top of the solver's own peak: a
single reused staging buffer (file_handle%device_staging), sized to
one unpadded LOCAL field in whichever precision that write uses.
The buffer is grown, never shrunk (see write_device_field_adios2),
so its steady-state size is the LARGEST single write it is asked to
hold: the build precision whenever a checkpoint is enabled (always
native, and always at least as large as a single-precision
snapshot), otherwise whatever precision the snapshot uses.
Zero when the device path cannot be taken: device_write false
(build without X3D2_ADIOS2_CUDA, or X3D2_ADIOS2_GPU_WRITE_MODE=
host), or neither a unit-stride snapshot nor a checkpoint is
enabled (striding falls back to the host path in
snapshot_manager.f90; checkpoints never stride).
The DIR_X->DIR_C reorder borrows a block from the allocator free
list and is not counted here (measurements 2026-09-15 showed
exactly one field of growth).
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Where possible, edges connecting nodes are
given different colours to make them easier to distinguish in
large graphs.