#include #include #include /* mpicc -Wall -O2 -o hdf5_contiguous_dset hdf5_contiguous_dset.c -lhdf5 */ int main(int argc, char **argv) { int step, rank, i; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); 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 dset = H5Dcreate(file, "step", H5T_NATIVE_INT64, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); 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(); }