diff options
-rw-r--r-- | testpar/t_coll_chunk.c | 53 | ||||
-rw-r--r-- | testpar/t_span_tree.c | 118 | ||||
-rw-r--r-- | testpar/testphdf5.h | 2 |
3 files changed, 104 insertions, 69 deletions
diff --git a/testpar/t_coll_chunk.c b/testpar/t_coll_chunk.c index fbc3505..1591764 100644 --- a/testpar/t_coll_chunk.c +++ b/testpar/t_coll_chunk.c @@ -54,15 +54,15 @@ static void coll_chunktest(const char* filename,int chunk_factor,int select_fact * Descriptions for the selection: One big singluar selection inside one chunk * Two dimensions, * - * dim1 = SPACE_DIM1(5760) + * dim1 = SPACE_DIM1(5760)*mpi_size * dim2 = SPACE_DIM2(3) * chunk_dim1 = dim1 * chunk_dim2 = dim2 * block = 1 for all dimensions * stride = 1 for all dimensions - * count0 = SPACE_DIM1/mpi_size(5760/mpi_size) + * count0 = SPACE_DIM1(5760) * count1 = SPACE_DIM2(3) - * start0 = mpi_rank*SPACE_DIM1/mpi_size + * start0 = mpi_rank*SPACE_DIM1 * start1 = 0 * ------------------------------------------------------------------------ */ @@ -101,15 +101,15 @@ coll_chunk1(void) * Descriptions for the selection: many disjoint selections inside one chunk * Two dimensions, * - * dim1 = SPACE_DIM1(5760) + * dim1 = SPACE_DIM1*mpi_size(5760) * dim2 = SPACE_DIM2(3) * chunk_dim1 = dim1 * chunk_dim2 = dim2 * block = 1 for all dimensions * stride = 3 for all dimensions - * count0 = SPACE_DIM1/mpi_size/stride0(5760/mpi_size/3) + * count0 = SPACE_DIM1/stride0(5760/3) * count1 = SPACE_DIM2/stride(3/3 = 1) - * start0 = mpi_rank*SPACE_DIM1/mpi_size + * start0 = mpi_rank*SPACE_DIM1 * start1 = 0 * * ------------------------------------------------------------------------ @@ -148,15 +148,15 @@ coll_chunk2(void) * Descriptions for the selection: one singular selection accross many chunks * Two dimensions, Num of chunks = 2* mpi_size * - * dim1 = SPACE_DIM1(5760) + * dim1 = SPACE_DIM1*mpi_size * dim2 = SPACE_DIM2(3) - * chunk_dim1 = dim1/mpi_size + * chunk_dim1 = SPACE_DIM1 * chunk_dim2 = dim2/2 * block = 1 for all dimensions * stride = 1 for all dimensions - * count0 = SPACE_DIM1/mpi_size(5760/mpi_size) + * count0 = SPACE_DIM1 * count1 = SPACE_DIM2(3) - * start0 = mpi_rank*SPACE_DIM1/mpi_size + * start0 = mpi_rank*SPACE_DIM1 * start1 = 0 * * ------------------------------------------------------------------------ @@ -199,15 +199,15 @@ coll_chunk3(void) * Descriptions for the selection: one singular selection accross many chunks * Two dimensions, Num of chunks = 2* mpi_size * - * dim1 = SPACE_DIM1(5760) - * dim2 = SPACE_DIM2(3) - * chunk_dim1 = dim1/mpi_size - * chunk_dim2 = dim2/2 + * dim1 = SPACE_DIM1*mpi_size + * dim2 = SPACE_DIM2 + * chunk_dim1 = dim1 + * chunk_dim2 = dim2 * block = 1 for all dimensions * stride = 1 for all dimensions - * count0 = SPACE_DIM1/mpi_size(5760/mpi_size) + * count0 = SPACE_DIM1 * count1 = SPACE_DIM2(3) - * start0 = mpi_rank*SPACE_DIM1/mpi_size + * start0 = mpi_rank*SPACE_DIM1 * start1 = 0 * * ------------------------------------------------------------------------ @@ -221,7 +221,6 @@ coll_chunk4(void) int mpi_size; MPI_Comm comm = MPI_COMM_WORLD; - MPI_Comm_size(comm,&mpi_size); filename = GetTestParameters(); coll_chunktest(filename,1,BYROW_SELECTNONE); @@ -288,12 +287,12 @@ coll_chunktest(const char* filename, VRFY((status >= 0),""); /* setup dimensionality object */ - dims[0] = SPACE_DIM1; + dims[0] = SPACE_DIM1*mpi_size; dims[1] = SPACE_DIM2; /* allocate memory for data buffer */ - data_array1 = (int *)malloc(SPACE_DIM1*SPACE_DIM2*sizeof(int)); + data_array1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* set up dimensions of the slab this process accesses */ @@ -306,7 +305,7 @@ coll_chunktest(const char* filename, VRFY((crp_plist >= 0),""); /* Set up chunk information. */ - chunk_dims[0] = SPACE_DIM1/chunk_factor; + chunk_dims[0] = dims[0]/chunk_factor; /* to decrease the testing time, maintain bigger chunk size */ @@ -359,11 +358,11 @@ coll_chunktest(const char* filename, /* Use collective read to verify the correctness of collective write. */ /* allocate memory for data buffer */ - data_array1 = (int *)malloc(SPACE_DIM1*SPACE_DIM2*sizeof(int)); + data_array1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_array1 != NULL), "data_array1 malloc succeeded"); /* allocate memory for data buffer */ - data_origin1 = (int *)malloc(SPACE_DIM1*SPACE_DIM2*sizeof(int)); + data_origin1 = (int *)malloc(dims[0]*dims[1]*sizeof(int)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); acc_plist = create_faccess_plist(comm, info, facc_type, use_gpfs); @@ -443,7 +442,7 @@ ccslab_set(int mpi_rank, block[1] = 1; stride[0] = 1; stride[1] = 1; - count[0] = SPACE_DIM1/mpi_size; + count[0] = SPACE_DIM1; count[1] = SPACE_DIM2; start[0] = mpi_rank*count[0]; start[1] = 0; @@ -456,9 +455,9 @@ ccslab_set(int mpi_rank, block[1] = 1; stride[0] = 3; stride[1] = 3; - count[0] = (SPACE_DIM1/mpi_size)/(stride[0]*block[0]); + count[0] = SPACE_DIM1/(stride[0]*block[0]); count[1] = (SPACE_DIM2)/(stride[1]*block[1]); - start[0] = SPACE_DIM1/mpi_size*mpi_rank; + start[0] = SPACE_DIM1*mpi_rank; start[1] = 0; break; @@ -470,7 +469,7 @@ ccslab_set(int mpi_rank, block[1] = 1; stride[0] = 1; stride[1] = 1; - count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:SPACE_DIM1/mpi_size); + count[0] = ((mpi_rank >= MAX(1,(mpi_size-2)))?0:SPACE_DIM1); count[1] = SPACE_DIM2; start[0] = mpi_rank*count[0]; start[1] = 0; @@ -479,7 +478,7 @@ ccslab_set(int mpi_rank, default: /* Unknown mode. Set it to cover the whole dataset. */ - block[0] = SPACE_DIM1; + block[0] = SPACE_DIM1*mpi_size; block[1] = SPACE_DIM2; stride[0] = block[0]; stride[1] = block[1]; diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c index ca48c17..3ead9d8 100644 --- a/testpar/t_span_tree.c +++ b/testpar/t_span_tree.c @@ -225,6 +225,10 @@ void coll_write_test(int chunk_factor) hid_t facc_plist,dxfer_plist,dcrt_plist; hid_t file, datasetc,dataseti; /* File and dataset identifiers */ hid_t mspaceid1, mspaceid, fspaceid,fspaceid1; /* Dataspace identifiers */ + + hsize_t mdim1[1],fsdim[2],mdim[2]; + +#if 0 hsize_t mdim1[] = {MSPACE1_DIM}; /* Dimension size of the first dataset (in memory) */ hsize_t fsdim[] = {FSPACE_DIM1, FSPACE_DIM2}; /* Dimension sizes of the dataset @@ -234,21 +238,27 @@ void coll_write_test(int chunk_factor) dataset in memory when we read selection from the dataset on the disk */ +#endif hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ hsize_t block[2]; /* Block sizes */ - hsize_t chunk_dims[RANK]; + hsize_t chunk_dims[2]; herr_t ret; unsigned i,j; int fillvalue = 0; /* Fill value for the dataset */ +#if 0 int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the dataset */ int vector[MSPACE1_DIM]; +#endif + + + int *matrix_out, *matrix_out1, *vector; hbool_t use_gpfs = FALSE; int mpi_size,mpi_rank; @@ -266,8 +276,20 @@ void coll_write_test(int chunk_factor) /* * Buffers' initialization. */ - vector[0] = vector[MSPACE1_DIM - 1] = -1; - for (i = 1; i < MSPACE1_DIM - 1; i++) vector[i] = i; + + mdim1[0] = MSPACE1_DIM *mpi_size; + mdim[0] = MSPACE_DIM1; + mdim[1] = MSPACE_DIM2*mpi_size; + fsdim[0] = FSPACE_DIM1; + fsdim[1] = FSPACE_DIM2*mpi_size; + + vector = (int*)HDmalloc(sizeof(int)*mdim1[0]*mpi_size); + matrix_out = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size); + matrix_out1 = (int*)HDmalloc(sizeof(int)*mdim[0]*mdim[1]*mpi_size); + + HDmemset(vector,0,sizeof(int)*mdim1[0]*mpi_size); + vector[0] = vector[MSPACE1_DIM*mpi_size - 1] = -1; + for (i = 1; i < MSPACE1_DIM*mpi_size - 1; i++) vector[i] = i; /* Grab file access property list */ facc_plist = create_faccess_plist(comm, info, facc_type, use_gpfs); @@ -289,8 +311,8 @@ void coll_write_test(int chunk_factor) VRFY((ret >= 0),"Fill value creation property list succeeded"); if(chunk_factor != 0) { - chunk_dims[0] = FSPACE_DIM1/chunk_factor; - chunk_dims[1] = FSPACE_DIM2/chunk_factor; + chunk_dims[0] = fsdim[0]/chunk_factor; + chunk_dims[1] = fsdim[1]/chunk_factor; ret = H5Pset_chunk(dcrt_plist, 2, chunk_dims); VRFY((ret >= 0),"chunk creation property list succeeded"); } @@ -319,18 +341,18 @@ void coll_write_test(int chunk_factor) /* The First selection for FILE * * block (3,2) - * stride(4.3) + * stride(4,3) * count (1,768/mpi_size) * start (0,1+768*3*mpi_rank/mpi_size) * */ start[0] = FHSTART0; - start[1] = FHSTART1+mpi_rank*FHSTRIDE1*FHCOUNT1/mpi_size; + start[1] = FHSTART1+mpi_rank*FHSTRIDE1*FHCOUNT1; stride[0] = FHSTRIDE0; stride[1] = FHSTRIDE1; count[0] = FHCOUNT0; - count[1] = FHCOUNT1/mpi_size; + count[1] = FHCOUNT1; block[0] = FHBLOCK0; block[1] = FHBLOCK1; @@ -347,13 +369,13 @@ void coll_write_test(int chunk_factor) */ start[0] = SHSTART0; - start[1] = SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank/mpi_size; + start[1] = SHSTART1+SHCOUNT1*SHBLOCK1*mpi_rank; stride[0] = SHSTRIDE0; stride[1] = SHSTRIDE1; count[0] = SHCOUNT0; count[1] = SHCOUNT1; block[0] = SHBLOCK0; - block[1] = SHBLOCK1/mpi_size; + block[1] = SHBLOCK1; ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -377,7 +399,7 @@ void coll_write_test(int chunk_factor) */ start[0] = MHSTART0; stride[0] = MHSTRIDE0; - count[0] = MHCOUNT0/mpi_size; + count[0] = MHCOUNT0; block[0] = MHBLOCK0; ret = H5Sselect_hyperslab(mspaceid1, H5S_SELECT_SET, start, stride, count, block); @@ -480,13 +502,13 @@ void coll_write_test(int chunk_factor) * */ start[0] = RFFHSTART0; - start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1/mpi_size; + start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1; block[0] = RFFHBLOCK0; block[1] = RFFHBLOCK1; stride[0] = RFFHSTRIDE0; stride[1] = RFFHSTRIDE1; count[0] = RFFHCOUNT0; - count[1] = RFFHCOUNT1/mpi_size; + count[1] = RFFHCOUNT1; /* The first selection of the dataset generated by collective write */ @@ -507,13 +529,13 @@ void coll_write_test(int chunk_factor) */ start[0] = RFSHSTART0; - start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank/mpi_size; + start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank; block[0] = RFSHBLOCK0; block[1] = RFSHBLOCK1; stride[0] = RFSHSTRIDE0; stride[1] = RFSHSTRIDE0; count[0] = RFSHCOUNT0; - count[1] = RFSHCOUNT1/mpi_size; + count[1] = RFSHCOUNT1; /* The second selection of the dataset generated by collective write */ ret = H5Sselect_hyperslab(fspaceid, H5S_SELECT_OR, start, stride, count, block); @@ -546,13 +568,13 @@ void coll_write_test(int chunk_factor) start[0] = RMFHSTART0; - start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1/mpi_size; + start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1; block[0] = RMFHBLOCK0; block[1] = RMFHBLOCK1; stride[0] = RMFHSTRIDE0; stride[1] = RMFHSTRIDE1; count[0] = RMFHCOUNT0; - count[1] = RMFHCOUNT1/mpi_size; + count[1] = RMFHCOUNT1; ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -569,13 +591,13 @@ void coll_write_test(int chunk_factor) * */ start[0] = RMSHSTART0; - start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1/mpi_size; + start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1; block[0] = RMSHBLOCK0; block[1] = RMSHBLOCK1; stride[0] = RMSHSTRIDE0; stride[1] = RMSHSTRIDE1; count[0] = RMSHCOUNT0; - count[1] = RMSHCOUNT1/mpi_size; + count[1] = RMSHCOUNT1; ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -584,8 +606,8 @@ void coll_write_test(int chunk_factor) * Initialize data buffer. */ - HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2); - HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2); + HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); /* * Read data back to the buffer matrix_out. */ @@ -601,12 +623,11 @@ void coll_write_test(int chunk_factor) ret = 0; - for (i = 0; i < MSPACE_DIM1; i++){ - for (j = 0; j < MSPACE_DIM2; j++){ - if(matrix_out[i][j]!=matrix_out1[i][j]) ret = -1; + for (i = 0; i < MSPACE_DIM1*MSPACE_DIM2*mpi_size; i++){ + if(matrix_out[i]!=matrix_out1[i]) ret = -1; if(ret < 0) break; } - } + VRFY((ret >= 0),"H5D irregular collective write succeed"); /* @@ -670,13 +691,16 @@ void coll_read_test(int chunk_factor) hid_t file, dataseti; /* File and dataset identifiers */ hid_t mspaceid, fspaceid1; /* Dataspace identifiers */ + /* Dimension sizes of the dataset (on disk) */ +#if 0 hsize_t mdim[] = {MSPACE_DIM1, MSPACE_DIM2}; /* Dimension sizes of the dataset in memory when we read selection from the dataset on the disk */ - +#endif + hsize_t mdim[2]; hsize_t start[2]; /* Start of hyperslab */ hsize_t stride[2]; /* Stride of hyperslab */ hsize_t count[2]; /* Block count */ @@ -684,9 +708,15 @@ void coll_read_test(int chunk_factor) herr_t ret; unsigned i,j; + + int *matrix_out; + int *matrix_out1; +#if 0 int matrix_out[MSPACE_DIM1][MSPACE_DIM2]; int matrix_out1[MSPACE_DIM1][MSPACE_DIM2]; /* Buffer to read from the dataset */ + +#endif hbool_t use_gpfs = FALSE; int mpi_size,mpi_rank; @@ -700,7 +730,15 @@ void coll_read_test(int chunk_factor) /* Obtain file name */ filename = GetTestParameters(); - + + + /* Initialize the buffer */ + + mdim[0] = MSPACE_DIM1; + mdim[1] = MSPACE_DIM2*mpi_size; + matrix_out =(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + matrix_out1=(int*)HDmalloc(sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + /*** For testing collective hyperslab selection read ***/ /* Obtain file access property list */ @@ -734,13 +772,13 @@ void coll_read_test(int chunk_factor) * */ start[0] = RFFHSTART0; - start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1/mpi_size; + start[1] = RFFHSTART1+mpi_rank*RFFHCOUNT1; block[0] = RFFHBLOCK0; block[1] = RFFHBLOCK1; stride[0] = RFFHSTRIDE0; stride[1] = RFFHSTRIDE1; count[0] = RFFHCOUNT0; - count[1] = RFFHCOUNT1/mpi_size; + count[1] = RFFHCOUNT1; ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -754,13 +792,13 @@ void coll_read_test(int chunk_factor) * */ start[0] = RFSHSTART0; - start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank/mpi_size; + start[1] = RFSHSTART1+RFSHCOUNT1*mpi_rank; block[0] = RFSHBLOCK0; block[1] = RFSHBLOCK1; stride[0] = RFSHSTRIDE0; stride[1] = RFSHSTRIDE0; count[0] = RFSHCOUNT0; - count[1] = RFSHCOUNT1/mpi_size; + count[1] = RFSHCOUNT1; ret = H5Sselect_hyperslab(fspaceid1, H5S_SELECT_OR, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -784,13 +822,13 @@ void coll_read_test(int chunk_factor) */ start[0] = RMFHSTART0; - start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1/mpi_size; + start[1] = RMFHSTART1+mpi_rank*RMFHCOUNT1; block[0] = RMFHBLOCK0; block[1] = RMFHBLOCK1; stride[0] = RMFHSTRIDE0; stride[1] = RMFHSTRIDE1; count[0] = RMFHCOUNT0; - count[1] = RMFHCOUNT1/mpi_size; + count[1] = RMFHCOUNT1; ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_SET, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -806,13 +844,13 @@ void coll_read_test(int chunk_factor) * */ start[0] = RMSHSTART0; - start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1/mpi_size; + start[1] = RMSHSTART1+mpi_rank*RMSHCOUNT1; block[0] = RMSHBLOCK0; block[1] = RMSHBLOCK1; stride[0] = RMSHSTRIDE0; stride[1] = RMSHSTRIDE1; count[0] = RMSHCOUNT0; - count[1] = RMSHCOUNT1/mpi_size; + count[1] = RMSHCOUNT1; ret = H5Sselect_hyperslab(mspaceid, H5S_SELECT_OR, start, stride, count, block); VRFY((ret >= 0),"hyperslab selection succeeded"); @@ -821,8 +859,8 @@ void coll_read_test(int chunk_factor) * Initialize data buffer. */ - HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2); - HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2); + HDmemset(matrix_out,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); + HDmemset(matrix_out1,0,sizeof(int)*MSPACE_DIM1*MSPACE_DIM2*mpi_size); /* * Read data back to the buffer matrix_out. @@ -848,11 +886,9 @@ void coll_read_test(int chunk_factor) VRFY((ret >= 0),"H5D independent read succeed"); ret = 0; - for (i = 0; i < MSPACE_DIM1; i++){ - for (j = 0; j < MSPACE_DIM2; j++){ - if(matrix_out[i][j]!=matrix_out1[i][j])ret = -1; + for (i = 0; i < MSPACE_DIM1*MSPACE_DIM2*mpi_size; i++){ + if(matrix_out[i]!=matrix_out1[i])ret = -1; if(ret < 0) break; - } } VRFY((ret >= 0),"H5D contiguous irregular collective read succeed"); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 416c3d3..0e35fcf 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -51,7 +51,7 @@ #define FACC_MPIPOSIX 0x8 /* MPIPOSIX */ /*Constants for collective chunk definitions */ -#define SPACE_DIM1 5760 +#define SPACE_DIM1 24 #define SPACE_DIM2 3 #define BYROW_CONT 1 #define BYROW_DISCONT 2 |