diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-12 17:22:29 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2014-03-12 17:22:29 (GMT) |
commit | e2c3ecd82527f17b08a2b2b5b11404fecfb3645e (patch) | |
tree | a1a76b0f600d7b1267a03de15fc30915d262ab45 /testpar | |
parent | a8a8652ebd5de474abc1b4afd4f7ea0834636ec7 (diff) | |
download | hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.zip hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.tar.gz hdf5-e2c3ecd82527f17b08a2b2b5b11404fecfb3645e.tar.bz2 |
[svn-r24785] Description:
Bring r24769 & r24772 from trunk to 1.8 branch:
Check in Mohamad's changes to support collective I/O on point selections,
along with some other minor cleanups.
Correct some dynamically sized arrays that fail on Windows.
Tested on:
Mac OSX/64 10.9.2 (amazon) w/parallel
(And has been through the daily test regime on the trunk)
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_coll_chunk.c | 405 | ||||
-rw-r--r-- | testpar/t_dset.c | 424 | ||||
-rw-r--r-- | testpar/testphdf5.h | 19 |
3 files changed, 725 insertions, 123 deletions
diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index 73e7f09..85ea931 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -16,6 +16,9 @@ #include "testphdf5.h" #include "H5Dprivate.h" +#define HYPER 1 +#define POINT 2 +#define ALL 3 /* some commonly used routines for collective chunk IO tests*/ @@ -23,14 +26,17 @@ static void ccslab_set(int mpi_rank,int mpi_size,hsize_t start[],hsize_t count[] hsize_t stride[],hsize_t block[],int mode); static void ccdataset_fill(hsize_t start[],hsize_t count[], - hsize_t stride[],hsize_t block[],DATATYPE*dataset); + hsize_t stride[],hsize_t block[],DATATYPE*dataset, + int mem_selection); static void ccdataset_print(hsize_t start[],hsize_t block[],DATATYPE*dataset); static int ccdataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], - hsize_t block[], DATATYPE *dataset, DATATYPE *original); + hsize_t block[], DATATYPE *dataset, DATATYPE *original, + int mem_selection); -static void coll_chunktest(const char* filename,int chunk_factor,int select_factor,int api_option); +static void coll_chunktest(const char* filename, int chunk_factor, int select_factor, + int api_option, int file_selection, int mem_selection, int mode); /*------------------------------------------------------------------------- @@ -73,7 +79,15 @@ coll_chunk1(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 1, BYROW_CONT, API_NONE); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 1, BYROW_CONT, API_NONE, POINT, HYPER, IN_ORDER); } @@ -117,7 +131,15 @@ coll_chunk2(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 1, BYROW_DISCONT, API_NONE, POINT, HYPER, IN_ORDER); } @@ -164,7 +186,15 @@ coll_chunk3(void) int mpi_size; MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, mpi_size, BYROW_CONT, API_NONE, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -208,7 +238,15 @@ coll_chunk4(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 1, BYROW_SELECTNONE, API_NONE, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -252,7 +290,15 @@ coll_chunk5(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_HARD, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -298,7 +344,15 @@ coll_chunk6(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_HARD, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -342,7 +396,15 @@ coll_chunk7(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_TRUE, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -386,7 +448,15 @@ coll_chunk8(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_LINK_FALSE, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -430,7 +500,15 @@ coll_chunk9(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTUNBALANCE, API_MULTI_COLL, POINT, HYPER, IN_ORDER); } /*------------------------------------------------------------------------- @@ -474,7 +552,15 @@ coll_chunk10(void) { const char *filename = GetTestParameters(); - coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, HYPER, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, HYPER, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, OUT_OF_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, OUT_OF_ORDER); + + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, ALL, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, POINT, IN_ORDER); + coll_chunktest(filename, 4, BYROW_SELECTINCHUNK, API_MULTI_IND, POINT, HYPER, IN_ORDER); } @@ -505,14 +591,16 @@ coll_chunk10(void) *------------------------------------------------------------------------- */ - static void coll_chunktest(const char* filename, int chunk_factor, int select_factor, - int api_option) + int api_option, + int file_selection, + int mem_selection, + int mode) { - hid_t file,dataset, file_dataspace; + hid_t file, dataset, file_dataspace, mem_dataspace; hid_t acc_plist,xfer_plist,crp_plist; hsize_t dims[RANK], chunk_dims[RANK]; @@ -532,6 +620,11 @@ coll_chunktest(const char* filename, MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ + int i; + /* set up MPI parameters */ MPI_Comm_size(comm,&mpi_size); MPI_Comm_rank(comm,&mpi_rank); @@ -551,7 +644,6 @@ coll_chunktest(const char* filename, dims[0] = SPACE_DIM1*mpi_size; dims[1] = SPACE_DIM2; - /* allocate memory for data buffer */ data_array1 = (int *)malloc(dims[0] * dims[1] * sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); @@ -559,9 +651,25 @@ coll_chunktest(const char* filename, /* set up dimensions of the slab this process accesses */ ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor); + /* set up the coords array selection */ + num_points = block[0] * block[1] * count[0] * count[1]; + coords = (hsize_t *)HDmalloc(num_points * RANK * sizeof(hsize_t)); + VRFY((coords != NULL), "coords malloc succeeded"); + point_set(start, count, stride, block, num_points, coords, mode); + file_dataspace = H5Screate_simple(2, dims, NULL); VRFY((file_dataspace >= 0), "file dataspace created succeeded"); + if(ALL != mem_selection) { + mem_dataspace = H5Screate_simple(2, dims, NULL); + VRFY((mem_dataspace >= 0), "mem dataspace created succeeded"); + } + else { + current_dims = num_points; + mem_dataspace = H5Screate_simple (1, ¤t_dims, NULL); + VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded"); + } + crp_plist = H5Pcreate(H5P_DATASET_CREATE); VRFY((crp_plist >= 0),""); @@ -569,25 +677,67 @@ coll_chunktest(const char* filename, chunk_dims[0] = dims[0]/chunk_factor; /* to decrease the testing time, maintain bigger chunk size */ - (chunk_factor == 1) ? (chunk_dims[1] = SPACE_DIM2) : (chunk_dims[1] = SPACE_DIM2/2); status = H5Pset_chunk(crp_plist, 2, chunk_dims); VRFY((status >= 0),"chunk creation property list succeeded"); dataset = H5Dcreate2(file, DSET_COLLECTIVE_CHUNK_NAME, H5T_NATIVE_INT, - file_dataspace, H5P_DEFAULT, crp_plist, H5P_DEFAULT); + file_dataspace, H5P_DEFAULT, crp_plist, H5P_DEFAULT); VRFY((dataset >= 0),"dataset created succeeded"); status = H5Pclose(crp_plist); VRFY((status >= 0), ""); /*put some trivial data in the data array */ - ccdataset_fill(start, stride, count,block, data_array1); + ccdataset_fill(start, stride, count,block, data_array1, mem_selection); + MESG("data_array initialized"); - status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, - count, block); - VRFY((status >= 0),"hyperslab selection succeeded"); + switch (file_selection) { + case HYPER: + status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((status >= 0),"hyperslab selection succeeded"); + break; + + case POINT: + if (num_points) { + status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((status >= 0),"Element selection succeeded"); + } + else { + status = H5Sselect_none(file_dataspace); + VRFY((status >= 0),"none selection succeeded"); + } + break; + + case ALL: + status = H5Sselect_all(file_dataspace); + VRFY((status >= 0), "H5Sselect_all succeeded"); + break; + } + + switch (mem_selection) { + case HYPER: + status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((status >= 0),"hyperslab selection succeeded"); + break; + + case POINT: + if (num_points) { + status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((status >= 0),"Element selection succeeded"); + } + else { + status = H5Sselect_none(mem_dataspace); + VRFY((status >= 0),"none selection succeeded"); + } + break; + + case ALL: + status = H5Sselect_all(mem_dataspace); + VRFY((status >= 0), "H5Sselect_all succeeded"); + break; + } /* set up the collective transfer property list */ xfer_plist = H5Pcreate(H5P_DATASET_XFER); @@ -604,33 +754,39 @@ coll_chunktest(const char* filename, case API_LINK_HARD: status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_ONE_IO); VRFY((status>= 0),"collective chunk optimization succeeded"); - break; + break; + case API_MULTI_HARD: status = H5Pset_dxpl_mpio_chunk_opt(xfer_plist,H5FD_MPIO_CHUNK_MULTI_IO); VRFY((status>= 0),"collective chunk optimization succeeded "); - break; + break; + case API_LINK_TRUE: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,2); VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); - break; + break; + case API_LINK_FALSE: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,6); VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); - break; + break; + case API_MULTI_COLL: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */ VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,50); VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded"); - break; + break; + case API_MULTI_IND: status = H5Pset_dxpl_mpio_chunk_opt_num(xfer_plist,8);/* make sure it is using multi-chunk IO */ VRFY((status>= 0),"collective chunk optimization set chunk number succeeded"); status = H5Pset_dxpl_mpio_chunk_opt_ratio(xfer_plist,100); VRFY((status>= 0),"collective chunk optimization set chunk ratio succeeded"); - break; + break; + default: - ; + ; } #ifdef H5_HAVE_INSTRUMENTED_LIBRARY @@ -641,44 +797,42 @@ coll_chunktest(const char* filename, status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - - break; + break; case API_MULTI_HARD: prop_value = H5D_XFER_COLL_CHUNK_DEF; status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + break; case API_LINK_TRUE: prop_value = H5D_XFER_COLL_CHUNK_DEF; status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - - break; + break; case API_LINK_FALSE: prop_value = H5D_XFER_COLL_CHUNK_DEF; status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + break; case API_MULTI_COLL: prop_value = H5D_XFER_COLL_CHUNK_DEF; status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + break; case API_MULTI_IND: prop_value = H5D_XFER_COLL_CHUNK_DEF; status = H5Pinsert2(xfer_plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, H5D_XFER_COLL_CHUNK_SIZE, &prop_value, NULL, NULL, NULL, NULL, NULL, NULL); VRFY((status >= 0),"testing property list inserted succeeded"); - break; + break; default: ; @@ -687,7 +841,7 @@ coll_chunktest(const char* filename, #endif /* write data collectively */ - status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, file_dataspace, + status = H5Dwrite(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); VRFY((status >= 0),"dataset write succeeded"); @@ -698,32 +852,38 @@ coll_chunktest(const char* filename, status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_HARD_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO directly succeeded"); - break; + break; + case API_MULTI_HARD: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_HARD_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO optimization succeeded"); - break; + break; + case API_LINK_TRUE: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_TRUE_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set LINK COLLECTIVE IO succeeded"); - break; + break; + case API_LINK_FALSE: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set LINK IO transferring to multi-chunk IO succeeded"); - break; + break; + case API_MULTI_COLL: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set MULTI-CHUNK COLLECTIVE IO with optimization succeeded"); - break; + break; + case API_MULTI_IND: status = H5Pget(xfer_plist,H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME,&prop_value); VRFY((status >= 0),"testing property list get succeeded"); VRFY((prop_value == 0),"API to set MULTI-CHUNK IO transferring to independent IO succeeded"); - break; + break; + default: ; } @@ -739,12 +899,15 @@ coll_chunktest(const char* filename, status = H5Sclose(file_dataspace); VRFY((status >= 0),""); + status = H5Sclose(mem_dataspace); + VRFY((status >= 0),""); + + status = H5Fclose(file); VRFY((status >= 0),""); if (data_array1) HDfree(data_array1); - /* Use collective read to verify the correctness of collective write. */ /* allocate memory for data buffer */ @@ -771,15 +934,68 @@ coll_chunktest(const char* filename, /* set up dimensions of the slab this process accesses */ ccslab_set(mpi_rank, mpi_size, start, count, stride, block, select_factor); - /* obtain the file dataspace*/ + /* obtain the file and mem dataspace*/ file_dataspace = H5Dget_space (dataset); VRFY((file_dataspace >= 0), ""); - status=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); - VRFY((status >= 0), ""); + if (ALL != mem_selection) { + mem_dataspace = H5Dget_space (dataset); + VRFY((mem_dataspace >= 0), ""); + } + else { + current_dims = num_points; + mem_dataspace = H5Screate_simple (1, ¤t_dims, NULL); + VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded"); + } + + switch (file_selection) { + case HYPER: + status = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((status >= 0),"hyperslab selection succeeded"); + break; + + case POINT: + if (num_points) { + status = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((status >= 0),"Element selection succeeded"); + } + else { + status = H5Sselect_none(file_dataspace); + VRFY((status >= 0),"none selection succeeded"); + } + break; + + case ALL: + status = H5Sselect_all(file_dataspace); + VRFY((status >= 0), "H5Sselect_all succeeded"); + break; + } + + switch (mem_selection) { + case HYPER: + status = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((status >= 0),"hyperslab selection succeeded"); + break; + + case POINT: + if (num_points) { + status = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((status >= 0),"Element selection succeeded"); + } + else { + status = H5Sselect_none(mem_dataspace); + VRFY((status >= 0),"none selection succeeded"); + } + break; + + case ALL: + status = H5Sselect_all(mem_dataspace); + VRFY((status >= 0), "H5Sselect_all succeeded"); + break; + } /* fill dataset with test data */ - ccdataset_fill(start, stride,count,block, data_origin1); + ccdataset_fill(start, stride,count,block, data_origin1, mem_selection); xfer_plist = H5Pcreate (H5P_DATASET_XFER); VRFY((xfer_plist >= 0),""); @@ -790,13 +1006,12 @@ coll_chunktest(const char* filename, VRFY((status>= 0),"set independent IO collectively succeeded"); } - - status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, file_dataspace, + status = H5Dread(dataset, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); VRFY((status >=0),"dataset read succeeded"); /* verify the read data with original expected data */ - status = ccdataset_vrfy(start, count, stride, block, data_array1, data_origin1); + status = ccdataset_vrfy(start, count, stride, block, data_array1, data_origin1, mem_selection); if (status) nerrors++; status = H5Pclose(xfer_plist); @@ -804,17 +1019,23 @@ coll_chunktest(const char* filename, /* close dataset collectively */ status=H5Dclose(dataset); - VRFY((status >= 0), ""); + VRFY((status >= 0), "H5Dclose"); /* release all IDs created */ - H5Sclose(file_dataspace); + status = H5Sclose(file_dataspace); + VRFY((status >= 0),"H5Sclose"); + + status = H5Sclose(mem_dataspace); + VRFY((status >= 0),"H5Sclose"); /* close the file collectively */ - H5Fclose(file); + status = H5Fclose(file); + VRFY((status >= 0),"H5Fclose"); /* release data buffers */ - if (data_array1) free(data_array1); - if (data_origin1) free(data_origin1); + if(coords) HDfree(coords); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } @@ -933,12 +1154,12 @@ ccdataset_fill(hsize_t start[], hsize_t stride[], hsize_t count[], hsize_t block[], - DATATYPE * dataset) + DATATYPE * dataset, + int mem_selection) { DATATYPE *dataptr = dataset; DATATYPE *tmptr; - hsize_t i,j,k1,k2; - + hsize_t i,j,k1,k2,k=0; /* put some trivial data in the data_array */ tmptr = dataptr; @@ -950,10 +1171,16 @@ ccdataset_fill(hsize_t start[], for(k2 = 0; k2 < count[1]; k2++) { for(j = 0;j < block[1]; j++) { - dataptr = tmptr + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ - start[1]+k2*stride[1]+j); + if (ALL != mem_selection) { + dataptr = tmptr + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ + start[1]+k2*stride[1]+j); + } + else { + dataptr = tmptr + k; + k++; + } - *dataptr = (DATATYPE)(k1+k2+i+j); + *dataptr = (DATATYPE)(k1+k2+i+j); } } } @@ -1000,9 +1227,10 @@ ccdataset_vrfy(hsize_t start[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, - DATATYPE *original) + DATATYPE *original, + int mem_selection) { - hsize_t i, j,k1,k2; + hsize_t i, j,k1,k2,k=0; int vrfyerrs; DATATYPE *dataptr,*oriptr; @@ -1020,26 +1248,31 @@ ccdataset_vrfy(hsize_t start[], vrfyerrs = 0; - for (k1 = 0; k1 < count[0];k1++) { - for(i = 0;i < block[0];i++) { - for(k2 = 0; k2<count[1];k2++) { - for(j=0;j<block[1];j++) { - - dataptr = dataset + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ - start[1]+k2*stride[1]+j); - oriptr = original + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ - start[1]+k2*stride[1]+j); - - if (*dataptr != *oriptr){ - if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ - printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", - (unsigned long)i, (unsigned long)j, - *(original), *(dataset)); - } - } - } - } - } + for (k1=0;k1<count[0];k1++) { + for(i=0;i<block[0];i++) { + for(k2=0; k2<count[1];k2++) { + for(j=0;j<block[1];j++) { + if (ALL != mem_selection) { + dataptr = dataset + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ + start[1]+k2*stride[1]+j); + oriptr = original + ((start[0]+k1*stride[0]+i)*SPACE_DIM2+ + start[1]+k2*stride[1]+j); + } + else { + dataptr = dataset + k; + oriptr = original + k; + k++; + } + if (*dataptr != *oriptr){ + if (vrfyerrs++ < MAX_ERR_REPORT || VERBOSE_MED){ + printf("Dataset Verify failed at [%lu][%lu]: expect %d, got %d\n", + (unsigned long)i, (unsigned long)j, + *(original), *(dataset)); + } + } + } + } + } } if (vrfyerrs > MAX_ERR_REPORT && !VERBOSE_MED) printf("[more errors ...]\n"); diff --git a/testpar/t_dset.c b/testpar/t_dset.c index fca87f6..4870eb6 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -118,6 +118,54 @@ if(VERBOSE_MED){ } } +/* + * Setup the coordinates for point selection. + */ +void point_set(hsize_t start[], + hsize_t count[], + hsize_t stride[], + hsize_t block[], + size_t num_points, + hsize_t coords[], + int order) +{ + hsize_t i,j, k = 0, m ,n, s1 ,s2; + + HDcompile_assert(RANK == 2); + + if(OUT_OF_ORDER == order) + k = (num_points * RANK) - 1; + else if(IN_ORDER == order) + k = 0; + + s1 = start[0]; + s2 = start[1]; + + for(i = 0 ; i < count[0]; i++) + for(j = 0 ; j < count[1]; j++) + for(m = 0 ; m < block[0]; m++) + for(n = 0 ; n < block[1]; n++) + if(OUT_OF_ORDER == order) { + coords[k--] = s2 + (stride[1] * j) + n; + coords[k--] = s1 + (stride[0] * i) + m; + } + else if(IN_ORDER == order) { + coords[k++] = s1 + stride[0] * i + m; + coords[k++] = s2 + stride[1] * j + n; + } + + if(VERBOSE_MED) { + printf("start[]=(%lu, %lu), count[]=(%lu, %lu), stride[]=(%lu, %lu), block[]=(%lu, %lu), total datapoints=%lu\n", + (unsigned long)start[0], (unsigned long)start[1], (unsigned long)count[0], (unsigned long)count[1], + (unsigned long)stride[0], (unsigned long)stride[1], (unsigned long)block[0], (unsigned long)block[1], + (unsigned long)(block[0] * block[1] * count[0] * count[1])); + k = 0; + for(i = 0; i < num_points ; i++) { + printf("(%d, %d)\n", (int)coords[k], (int)coords[k + 1]); + k += 2; + } + } +} /* * Fill the dataset with trivial data for testing. @@ -501,7 +549,8 @@ dataset_writeAll(void) hid_t sid; /* Dataspace ID */ hid_t file_dataspace; /* File dataspace ID */ hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */ + hid_t dataset1, dataset2, dataset3, dataset4; /* Dataset ID */ + hid_t dataset5, dataset6, dataset7; /* Dataset ID */ hid_t datatype; /* Datatype ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hsize_t dims[RANK]; /* dataset dim sizes */ @@ -512,6 +561,11 @@ dataset_writeAll(void) hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ + int i; + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; @@ -526,6 +580,11 @@ dataset_writeAll(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + /* set up the coords array selection */ + num_points = dim1; + coords = (hsize_t *)HDmalloc(dim1 * RANK * sizeof(hsize_t)); + VRFY((coords != NULL), "coords malloc succeeded"); + /* allocate memory for data buffer */ data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); @@ -573,6 +632,13 @@ dataset_writeAll(void) dataset3 = H5Dcreate2(fid, DATASETNAME3, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); VRFY((dataset3 >= 0), "H5Dcreate2 succeeded"); + dataset5 = H5Dcreate2(fid, DATASETNAME7, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + VRFY((dataset5 >= 0), "H5Dcreate2 succeeded"); + dataset6 = H5Dcreate2(fid, DATASETNAME8, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + VRFY((dataset6 >= 0), "H5Dcreate2 succeeded"); + dataset7 = H5Dcreate2(fid, DATASETNAME9, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + VRFY((dataset7 >= 0), "H5Dcreate2 succeeded"); + /* release 2-D space ID created */ H5Sclose(sid); @@ -827,8 +893,6 @@ dataset_writeAll(void) VRFY((ret>= 0),"set independent IO collectively succeeded"); } - - /* write data collectively */ MESG("writeAll with scalar dataspace"); ret = H5Dwrite(dataset4, H5T_NATIVE_INT, mem_dataspace, file_dataspace, @@ -846,6 +910,137 @@ dataset_writeAll(void) H5Sclose(mem_dataspace); H5Pclose(xfer_plist); + + if(data_array1) free(data_array1); + data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + + block[0] = 1; + block[1] = dim1; + stride[0] = 1; + stride[1] = dim1; + count[0] = 1; + count[1] = 1; + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + + dataset_fill(start, block, data_array1); + MESG("data_array initialized"); + if(VERBOSE_MED){ + MESG("data_array created"); + dataset_print(start, block, data_array1); + } + + /* Dataset5: point selection in File - Hyperslab selection in Memory*/ + /* create a file dataspace independently */ + point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); + file_dataspace = H5Dget_space (dataset5); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + start[0] = 0; + start[1] = 0; + mem_dataspace = H5Dget_space (dataset5); + VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* write data collectively */ + ret = H5Dwrite(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset5 succeeded"); + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + + /* Dataset6: point selection in File - Point selection in Memory*/ + /* create a file dataspace independently */ + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); + file_dataspace = H5Dget_space (dataset6); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + start[0] = 0; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, IN_ORDER); + mem_dataspace = H5Dget_space (dataset6); + VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* write data collectively */ + ret = H5Dwrite(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset6 succeeded"); + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + + /* Dataset7: point selection in File - All selection in Memory*/ + /* create a file dataspace independently */ + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, IN_ORDER); + file_dataspace = H5Dget_space (dataset7); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + current_dims = num_points; + mem_dataspace = H5Screate_simple (1, ¤t_dims, NULL); + VRFY((mem_dataspace >= 0), "mem_dataspace create succeeded"); + + ret = H5Sselect_all(mem_dataspace); + VRFY((ret >= 0), "H5Sselect_all succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* write data collectively */ + ret = H5Dwrite(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset7 succeeded"); + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + /* * All writes completed. Close datasets collectively */ @@ -856,13 +1051,20 @@ dataset_writeAll(void) ret = H5Dclose(dataset3); VRFY((ret >= 0), "H5Dclose3 succeeded"); ret = H5Dclose(dataset4); - VRFY((ret >= 0), "H5Dclose3 succeeded"); + VRFY((ret >= 0), "H5Dclose4 succeeded"); + ret = H5Dclose(dataset5); + VRFY((ret >= 0), "H5Dclose5 succeeded"); + ret = H5Dclose(dataset6); + VRFY((ret >= 0), "H5Dclose6 succeeded"); + ret = H5Dclose(dataset7); + VRFY((ret >= 0), "H5Dclose7 succeeded"); /* close the file collectively */ H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); + if(coords) HDfree(coords); + if(data_array1) HDfree(data_array1); } /* @@ -882,7 +1084,7 @@ dataset_readAll(void) hid_t xfer_plist; /* Dataset transfer properties list */ hid_t file_dataspace; /* File dataspace ID */ hid_t mem_dataspace; /* memory dataspace ID */ - hid_t dataset1, dataset2; /* Dataset ID */ + hid_t dataset1, dataset2, dataset5, dataset6, dataset7; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ @@ -892,6 +1094,11 @@ dataset_readAll(void) hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ hsize_t block[RANK]; /* for hyperslab setting */ + size_t num_points; /* for point selection */ + hsize_t *coords = NULL; /* for point selection */ + hsize_t current_dims; /* for point selection */ + int i,j,k; + herr_t ret; /* Generic return value */ int mpi_size, mpi_rank; @@ -906,6 +1113,11 @@ dataset_readAll(void) MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); + /* set up the coords array selection */ + num_points = dim1; + coords = (hsize_t *)HDmalloc(dim0 * dim1 * RANK * sizeof(hsize_t)); + VRFY((coords != NULL), "coords malloc succeeded"); + /* allocate memory for data buffer */ data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); @@ -939,6 +1151,14 @@ dataset_readAll(void) dataset2 = H5Dopen2(fid, DATASETNAME2, H5P_DEFAULT); VRFY((dataset2 >= 0), "H5Dopen2 2 succeeded"); + /* open another dataset collectively */ + dataset5 = H5Dopen2(fid, DATASETNAME7, H5P_DEFAULT); + VRFY((dataset5 >= 0), "H5Dopen2 5 succeeded"); + dataset6 = H5Dopen2(fid, DATASETNAME8, H5P_DEFAULT); + VRFY((dataset6 >= 0), "H5Dopen2 6 succeeded"); + dataset7 = H5Dopen2(fid, DATASETNAME9, H5P_DEFAULT); + VRFY((dataset7 >= 0), "H5Dopen2 7 succeeded"); + /* * Set up dimensions of the slab this process accesses. */ @@ -1077,6 +1297,162 @@ dataset_readAll(void) H5Sclose(mem_dataspace); H5Pclose(xfer_plist); + if(data_array1) free(data_array1); + if(data_origin1) free(data_origin1); + data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); + + block[0] = 1; + block[1] = dim1; + stride[0] = 1; + stride[1] = dim1; + count[0] = 1; + count[1] = 1; + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + + dataset_fill(start, block, data_origin1); + MESG("data_array initialized"); + if(VERBOSE_MED){ + MESG("data_array created"); + dataset_print(start, block, data_origin1); + } + + /* Dataset5: point selection in memory - Hyperslab selection in file*/ + /* create a file dataspace independently */ + file_dataspace = H5Dget_space (dataset5); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); + + start[0] = 0; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); + mem_dataspace = H5Dget_space (dataset5); + VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* read data collectively */ + ret = H5Dread(dataset5, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dread dataset5 succeeded"); + + + ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); + if(ret) nerrors++; + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + + + if(data_array1) free(data_array1); + data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + + /* Dataset6: point selection in File - Point selection in Memory*/ + /* create a file dataspace independently */ + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, IN_ORDER); + file_dataspace = H5Dget_space (dataset6); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(file_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + start[0] = 0; + start[1] = 0; + point_set (start, count, stride, block, num_points, coords, OUT_OF_ORDER); + mem_dataspace = H5Dget_space (dataset6); + VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* read data collectively */ + ret = H5Dread(dataset6, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dread dataset6 succeeded"); + + ret = dataset_vrfy(start, count, stride, block, data_array1, data_origin1); + if(ret) nerrors++; + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); + + if(data_array1) free(data_array1); + data_array1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); + VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); + + /* Dataset7: point selection in memory - All selection in file*/ + /* create a file dataspace independently */ + file_dataspace = H5Dget_space (dataset7); + VRFY((file_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_all(file_dataspace); + VRFY((ret >= 0), "H5Sselect_all succeeded"); + + num_points = dim0 * dim1; + k=0; + for (i=0 ; i<dim0; i++) { + for (j=0 ; j<dim1; j++) { + coords[k++] = i; + coords[k++] = j; + } + } + mem_dataspace = H5Dget_space (dataset7); + VRFY((mem_dataspace >= 0), "H5Dget_space succeeded"); + ret = H5Sselect_elements(mem_dataspace, H5S_SELECT_SET, num_points, coords); + VRFY((ret >= 0), "H5Sselect_elements succeeded"); + + /* set up the collective transfer properties list */ + xfer_plist = H5Pcreate (H5P_DATASET_XFER); + VRFY((xfer_plist >= 0), ""); + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pcreate xfer succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } + + /* read data collectively */ + ret = H5Dread(dataset7, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dread dataset7 succeeded"); + + start[0] = dim0/mpi_size * mpi_rank; + start[1] = 0; + ret = dataset_vrfy(start, count, stride, block, data_array1+(dim0/mpi_size * dim1 * mpi_rank), data_origin1); + if(ret) nerrors++; + + /* release all temporary handles. */ + H5Sclose(file_dataspace); + H5Sclose(mem_dataspace); + H5Pclose(xfer_plist); /* * All reads completed. Close datasets collectively @@ -1085,13 +1461,20 @@ dataset_readAll(void) VRFY((ret >= 0), "H5Dclose1 succeeded"); ret = H5Dclose(dataset2); VRFY((ret >= 0), "H5Dclose2 succeeded"); + ret = H5Dclose(dataset5); + VRFY((ret >= 0), "H5Dclose5 succeeded"); + ret = H5Dclose(dataset6); + VRFY((ret >= 0), "H5Dclose6 succeeded"); + ret = H5Dclose(dataset7); + VRFY((ret >= 0), "H5Dclose7 succeeded"); /* close the file collectively */ H5Fclose(fid); /* release data buffers */ - if(data_array1) free(data_array1); - if(data_origin1) free(data_origin1); + if(coords) HDfree(coords); + if(data_array1) HDfree(data_array1); + if(data_origin1) HDfree(data_origin1); } @@ -3073,9 +3456,6 @@ actual_io_mode_tests(void) { * TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES: * Test for NULL dataspace as the cause of breaking collective I/O. * - * TEST_POINT_SELECTIONS: - * Test for selecting elements of dataspce as the cause of breaking collective I/O. - * * TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT: * Test for Compact layout as the cause of breaking collective I/O. * @@ -3247,12 +3627,6 @@ test_no_collective_cause_mode(int selection_mode) no_collective_cause_global_expected |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES; } - if (selection_mode & TEST_POINT_SELECTIONS ) { - test_name = "Broken Collective I/O - Point Selection"; - no_collective_cause_local_expected |= H5D_MPIO_POINT_SELECTIONS; - no_collective_cause_global_expected |= H5D_MPIO_POINT_SELECTIONS; - } - if (selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT || selection_mode & TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL) { test_name = "Broken Collective I/O - No CONTI or CHUNKED Dataset"; @@ -3311,17 +3685,6 @@ test_no_collective_cause_mode(int selection_mode) VRFY((mem_space >= 0), "mem_space created"); } - if (selection_mode & TEST_POINT_SELECTIONS) { - coord[0][0] = 0; coord[0][1] = 0; - coord[1][0] = 1; coord[1][1] = 1; - ret = H5Sselect_elements (file_space, H5S_SELECT_SET, NELM, (const hsize_t *)coord); - VRFY((ret >= 0), "H5Sselect_elements succeeded"); - - ret = H5Sselect_elements (mem_space, H5S_SELECT_SET, NELM, (const hsize_t *)coord); - VRFY((ret >= 0), "H5Sselect_elements succeeded"); - } - - /* Get the number of elements in the selection */ length = dim0 * dim1; @@ -3437,7 +3800,7 @@ test_no_collective_cause_mode(int selection_mode) * have the correct values. * * NOTE: - * This is a temprary function. + * This is a temporary function. * test_no_collective_cause_mode(TEST_FILTERS) will replace this when * H5Dcreate and H5write support for mpio and filter feature. * @@ -3688,7 +4051,6 @@ no_collective_cause_tests(void) test_no_collective_cause_mode (TEST_DATA_TRANSFORMS); test_no_collective_cause_mode (TEST_SET_MPIPOSIX); test_no_collective_cause_mode (TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES); - test_no_collective_cause_mode (TEST_POINT_SELECTIONS); test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT); test_no_collective_cause_mode (TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL); #ifdef H5_HAVE_FILTER_FLETCHER32 @@ -3704,7 +4066,7 @@ no_collective_cause_tests(void) */ test_no_collective_cause_mode (TEST_SET_MPIPOSIX | TEST_DATATYPE_CONVERSION); test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); - test_no_collective_cause_mode (TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS | TEST_POINT_SELECTIONS); + test_no_collective_cause_mode (TEST_SET_MPIPOSIX | TEST_DATATYPE_CONVERSION | TEST_DATA_TRANSFORMS); return; } diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 1dd4bfa..08bbf12 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -45,6 +45,13 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, #define DATASETNAME4 "Data4" #define DATASETNAME5 "Data5" #define DATASETNAME6 "Data6" +#define DATASETNAME7 "Data7" +#define DATASETNAME8 "Data8" +#define DATASETNAME9 "Data9" + +/* point selection order */ +#define IN_ORDER 1 +#define OUT_OF_ORDER 2 /* Hyperslab layout styles */ #define BYROW 1 /* divide into slabs of rows */ @@ -181,13 +188,12 @@ enum H5TEST_COLL_CHUNK_API {API_NONE=0,API_LINK_HARD, #define TEST_DATA_TRANSFORMS 0x008 #define TEST_SET_MPIPOSIX 0x010 #define TEST_NOT_SIMPLE_OR_SCALAR_DATASPACES 0x020 -#define TEST_POINT_SELECTIONS 0x040 -#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x080 -#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x100 -#define TEST_FILTERS 0x200 +#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_COMPACT 0x040 +#define TEST_NOT_CONTIGUOUS_OR_CHUNKED_DATASET_EXTERNAL 0x080 +#define TEST_FILTERS 0x100 /* TEST_FILTERS will take place of this after supporting mpio + filter for * H5Dcreate and H5Dwrite */ -#define TEST_FILTERS_READ 0x400 +#define TEST_FILTERS_READ 0x200 /* Don't erase these lines, they are put here for debugging purposes */ /* @@ -295,5 +301,6 @@ hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, hbool_ MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); int dataset_vrfy(hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); - +void point_set (hsize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], + size_t num_points, hsize_t coords[], int order); #endif /* PHDF5TEST_H */ |