summaryrefslogtreecommitdiffstats
path: root/testpar/t_coll_chunk.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2014-03-07 19:12:20 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2014-03-07 19:12:20 (GMT)
commitac0ef34a4132dcf8c27eb6731cb2686acc593205 (patch)
tree2efe1bf4d516206f806ae74016e921a3a42ee58a /testpar/t_coll_chunk.c
parente367f64e24b95876d7c2673c7181aa12533d3f31 (diff)
downloadhdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.zip
hdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.tar.gz
hdf5-ac0ef34a4132dcf8c27eb6731cb2686acc593205.tar.bz2
[svn-r24769] Description:
Check in Mohamad's changes to support collective I/O on point selections, along with some other minor cleanups. Tested on: Mac OSX/64 10.9.2 (amazon) w/parallel & serial (h5committest forthcoming)
Diffstat (limited to 'testpar/t_coll_chunk.c')
-rw-r--r--testpar/t_coll_chunk.c401
1 files changed, 317 insertions, 84 deletions
diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c
index 5dac36f..61b25f8 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 *)HDmalloc(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, &current_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, &current_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,15 +1019,21 @@ 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 (coords) free(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");