How do you write to a single file in parallel in which different processes write to separate datasets?
All processes have to call H5Dcreate()
to create a dataset, even if the dataset will be accessed by one process.
If you want to create a dataset for every process you could do something like this:
for(i=0 ; i < mpi_size; i++) { char dataSetName[256]; sprintf(dataSetName, "a%d", i + 1); printf("Creating dataset %s ... \n", dataSetName); dset_id = H5Dcreate2(file_id, dataSetName, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); }
This will create n datasets, where n is the number of processes in the communicator.