#include #include /* mpicc -Wall -O2 -o hdf5_compact_dset hdf5_compact_dset.c -lhdf5 */ int main(int argc, char **argv) { int step, i; MPI_Init(&argc, &argv); hid_t fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL); hid_t file = H5Fcreate("hdf5_compact_dset.h5", H5F_ACC_TRUNC, H5P_DEFAULT, fapl); H5Pclose(fapl); hid_t space = H5Screate(H5S_SCALAR); hid_t dcpl = H5Pcreate(H5P_DATASET_CREATE); H5Pset_layout(dcpl, H5D_COMPACT); hid_t dset = H5Dcreate(file, "step", H5T_NATIVE_INT64, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); H5Pclose(dcpl); for (i = 0; i < 100; ++i) { H5Dread(dset, H5T_NATIVE_INT, space, H5S_ALL, H5P_DEFAULT, &step); } H5Sclose(space); H5Dclose(dset); H5Fclose(file); MPI_Finalize(); }