Thank you very much Scot, it works ) Quoting Scot Breitenfeld <[email protected]>:
If you want one process to create the file’s groups then you need to close the file before all the processors access the file again, this is what you would do:#include "hdf5.h" #define H5FILE_NAME "File.h5" #define DATASETNAME "My_Array" int main(int argc, char **argv){ //declare variables hid_t file_id, group_id, plist_id; int world_rank, world_size; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, & world_rank); MPI_Comm_size(MPI_COMM_WORLD, &world_size); //All process have to access to file plist_id = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fapl_mpio(plist_id, MPI_COMM_WORLD, MPI_INFO_NULL); //Create my file if(world_rank == 0){file_id = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);//Only process of rank 0 can create my groups, here we have one groupgroup_id = H5Gcreate(file_id, "/MyGroup", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);H5Gclose(group_id); H5Fclose(file_id); } //I want to synchronize my process MPI_Barrier(MPI_COMM_WORLD); file_id = H5Fopen(H5FILE_NAME, H5F_ACC_RDWR, plist_id); hid_t grp; //All process can access on my groups grp = H5Gopen2(file_id, "/MyGroup", H5P_DEFAULT); //release ressources H5Gclose(grp); H5Fclose(file_id); H5Pclose(plist_id); MPI_Finalize(); return 0; } _______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
_______________________________________________ Hdf-forum is for HDF software users discussion. [email protected] http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org Twitter: https://twitter.com/hdf5
