allocate_hdf5_dataset#

caput.util.mpitools.allocate_hdf5_dataset(fname: str, dsetname: str, shape: tuple[int, Ellipsis], dtype: numpy.typing.DTypeLike, comm: mpi4py.MPI.Comm | None = _comm) tuple[int, int][source]#

Create a hdf5 dataset and return its offset and size.

The dataset will be created contiguously and immediately allocated, however it will not be filled.

Parameters:
fnamestr

Name of the file to write.

dsetnamestr

Name of the dataset to write (must be at root level).

shapetuple[int, …]

Shape of the dataset.

dtypedtype

Type of the dataset.

commMPI.Comm | None

Communicator over which to broadcast results.

Returns:
dset_statetuple

Two integers:

  • Offset into the file at which the dataset starts (in bytes).

  • Size of the dataset in bytes.