diff options
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_mdset.c | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index e3ef984..548a055 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -40,18 +40,13 @@ void multiple_dset_write(char *filename, int ndatasets) VRFY((mpi_size <= SIZE), "mpi_size <= SIZE"); - chunk_origin [0] = mpi_rank * (SIZE / mpi_size); - chunk_origin [1] = 0; - chunk_dims [0] = SIZE / mpi_size; - chunk_dims [1] = SIZE; - - for (i = 0; i < DIM; i++) - file_dims [i] = SIZE; - plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); iof = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); H5Pclose (plist); + /* decide the hyperslab according to process number. */ + get_slab(chunk_origin, chunk_dims, count, file_dims); + memspace = H5Screate_simple (DIM, chunk_dims, NULL); filespace = H5Screate_simple (DIM, file_dims, NULL); ret = H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims); @@ -110,17 +105,12 @@ void compact_dataset(char *filename) VRFY((mpi_size <= SIZE), "mpi_size <= SIZE"); - chunk_origin [0] = mpi_rank * (SIZE / mpi_size); - chunk_origin [1] = 0; - chunk_dims [0] = SIZE / mpi_size; - chunk_dims [1] = SIZE; - - for (i = 0; i < DIM; i++) - file_dims [i] = SIZE; - plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); iof = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); + /* decide the hyperslab according to process number. */ + get_slab(chunk_origin, chunk_dims, count, file_dims); + /* Define data space */ memspace = H5Screate_simple (DIM, chunk_dims, NULL); filespace = H5Screate_simple (DIM, file_dims, NULL); |