diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2000-10-09 18:23:20 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2000-10-09 18:23:20 (GMT) |
commit | 61ab6a6b46adc58142e26c88e0196dfbb3efb9bc (patch) | |
tree | edf6be36bca36a7efab3b815cb7040517a459304 | |
parent | a40a5bfeec79f10ada9f3ecfeebac0cc4b8d545f (diff) | |
download | hdf5-61ab6a6b46adc58142e26c88e0196dfbb3efb9bc.zip hdf5-61ab6a6b46adc58142e26c88e0196dfbb3efb9bc.tar.gz hdf5-61ab6a6b46adc58142e26c88e0196dfbb3efb9bc.tar.bz2 |
[svn-r2641] Purpose:
Added features
Description:
There were no automatic tests for transfering zero elements.
Solution:
t_dset.c:
Added two new patterns of ZROW (zero rows for process 0)
and ZCOL(zero columns for process 0).
ZROW test was added but it failed because the current library
does not accept it. Not compiled in now. Need to fix the
library before turning it back on again and also to add the
ZCOL test.
t_mdset.c:
Added statement to show progress. Also the MPI_Barrier() call
get processes synchornoized. It eliminates the racing condition
but this is not a permenant solution. The library code needs to
be fixed.
testphdf5.c:
Added a bunch of MPI_Type_XXX debug code. Added the -md
option to skip the multiple datasets tests. Changed the cosmitic
appearance of the banner messages.
testphdf5.h:
When an error is detected, the old way was to call MPI_Finalize()
before exiting. This sometimes hangs because some processes
may be waiting for a message of a different tag. Changed to
call MPI_Abort() for now so that the whole MPI job would
abort rather than hanging due resource limits exceeded.
Added the definition of ZROW and ZCOL.
Platforms tested:
Modi4 -64.
-rw-r--r-- | testpar/t_dset.c | 54 | ||||
-rw-r--r-- | testpar/t_mdset.c | 6 | ||||
-rw-r--r-- | testpar/testphdf5.c | 100 | ||||
-rw-r--r-- | testpar/testphdf5.h | 6 |
4 files changed, 143 insertions, 23 deletions
diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 1bbc1a4..d2fb067 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -23,6 +23,10 @@ * Setup the dimensions of the hyperslab. * Two modes--by rows or by columns. * Assume dimension rank is 2. + * BYROW divide into slabs of rows + * BYCOL divide into blocks of columns + * ZROW same as BYROW except process 0 gets 0 rows + * ZCOL same as BYCOL except process 0 gets 0 columns */ void slab_set(int mpi_rank, int mpi_size, hssize_t start[], hsize_t count[], @@ -51,15 +55,32 @@ if (verbose) printf("slab_set BYROW\n"); count[1] = 1; start[0] = 0; start[1] = mpi_rank*block[1]; -#ifdef DISABLED - /* change the above macro to #ifndef if you want to test */ - /* zero elements access. */ - printf("set to size 0\n"); - if (!(mpi_rank % 3)) - block[1]=0; -#endif if (verbose) printf("slab_set BYCOL\n"); break; + case ZROW: + /* Similar to BYROW except process 0 gets 0 row */ + block[0] = (mpi_rank ? dim0/mpi_size : 0); + block[1] = dim1; + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = (mpi_rank? mpi_rank*block[0] : 0); + start[1] = 0; +if (verbose) printf("slab_set ZROW\n"); + break; + case ZCOL: + /* Similar to BYCOL except process 0 gets 0 column */ + block[0] = dim0; + block[1] = (mpi_rank ? dim1/mpi_size : 0); + stride[0] = block[0]; + stride[1] = block[1]; + count[0] = 1; + count[1] = 1; + start[0] = 0; + start[1] = (mpi_rank? mpi_rank*block[1] : 0); +if (verbose) printf("slab_set ZCOL\n"); + break; default: /* Unknown mode. Set it to cover the whole dataset. */ printf("unknown slab_set mode (%d)\n", mode); @@ -551,10 +572,29 @@ dataset_writeAll(char *filename) VRFY((ret >= 0), "H5Pcreate xfer succeeded"); /* write data collectively */ + MESG("writeAll by Row"); ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, xfer_plist, data_array1); VRFY((ret >= 0), "H5Dwrite dataset1 succeeded"); +#ifdef NEWSTUFF +printf("doing ZROW write\n"); + /* setup dimensions again to writeAll with zero rows for process 0 */ + slab_set(mpi_rank, mpi_size, start, count, stride, block, ZROW); + ret=H5Sselect_hyperslab(file_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab succeeded"); + /* need to make mem_dataspace to match for process 0 */ + if (MAINPROCESS){ + ret=H5Sselect_hyperslab(mem_dataspace, H5S_SELECT_SET, start, stride, count, block); + VRFY((ret >= 0), "H5Sset_hyperslab mem_dataspace succeeded"); + } + MESG("writeAll by Zero Row"); + ret = H5Dwrite(dataset1, H5T_NATIVE_INT, mem_dataspace, file_dataspace, + xfer_plist, data_array1); + VRFY((ret >= 0), "H5Dwrite dataset1 by ZROW succeeded"); +#endif + + /* release all temporary handles. */ /* Could have used them for dataset2 but it is cleaner */ /* to create them again.*/ diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index cc23e1c..3fd3bdb 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -49,7 +49,11 @@ void multiple_dset_write(char *filename) H5Dwrite (dataset, H5T_NATIVE_DOUBLE, memspace, filespace, H5P_DEFAULT, outme); H5Dclose (dataset); - } + if (! ((i+1) % 10)) { + printf("created %d datasets\n", i+1); + MPI_Barrier(MPI_COMM_WORLD); + } +} H5Sclose (filespace); H5Sclose (memspace); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 9199b69..22907f8 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -20,6 +20,7 @@ void *old_client_data; /* previous error handler arg.*/ /* other option flags */ int doread=1; /* read test */ int dowrite=1; /* write test */ +int domdset=1; /* multiple dataset test */ /* FILENAME and filenames must have the same number of names */ const char *FILENAME[5]={ "ParaEg1", @@ -81,6 +82,66 @@ int MPI_Init(int *argc, char ***argv) } #endif /* USE_PAUSE */ +#if 0 /* temp. disabled */ +int MPI_Type_commit(MPI_Datatype *mpi_type) +{ + int ret_code; + ret_code=PMPI_Type_commit(mpi_type); + printf("PMPI_Type_commit ret_code=%d, mpi_type=%d\n", ret_code, *mpi_type); + return (ret_code); +} + +int MPI_Type_free(MPI_Datatype *mpi_type) +{ + int ret_code; + printf("PMPI_Type_free mpi_type=%d, ", *mpi_type); + ret_code=PMPI_Type_free(mpi_type); + printf("ret_code=%d\n", ret_code); + return (ret_code); +} + +int MPI_Type_contiguous(int count, MPI_Datatype oldtype, MPI_Datatype *newtype) +{ + int ret_code; + ret_code=PMPI_Type_contiguous(count, oldtype, newtype); + printf("PMPI_Type_contiguous ret_code=%d, count=%d, old_type=%d, new_type=%d\n", + ret_code, count, oldtype, *newtype); + return (ret_code); +} + +int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype *newtype) +{ + int ret_code; + ret_code=PMPI_Type_vector(count, blocklength, stride, oldtype, newtype); + printf("PMPI_Type_vector ret_code=%d, count=%d, blocklength=%d, stride=%d, " + "old_type=%d, new_type=%d\n", + ret_code, count, blocklength, stride, oldtype, *newtype); + return (ret_code); +} + +int MPI_Type_struct(int count, int *array_of_blocklengths, MPI_Aint *array_of_displacements, MPI_Datatype *array_of_types, MPI_Datatype *newtype) +{ + int ret_code; + ret_code=PMPI_Type_struct(count, array_of_blocklengths, array_of_displacements, array_of_types, newtype); + printf("PMPI_Type_struct ret_code=%d, new_type=%d\n", + ret_code, *newtype); + return (ret_code); +} + +#ifdef HAVE_MPI2 +int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype) +{ + int ret_code; + ret_code=PMPI_Type_create_resized(oldtype, lb, extent, newtype); + printf("PMPI_Type_create_resized ret_code=%d, lb=%d, extent=%d, old_type=%d, new_type=%d\n", + ret_code, lb, extent, oldtype, *newtype); + return (ret_code); +} +#endif + +#endif + + /* * Show command usage @@ -89,8 +150,9 @@ void usage(void) { printf("Usage: testphdf5 [-r] [-w] [-v] [-f <prefix>] [-d <dim0> <dim1>]\n"); - printf("\t-r\t\tno read\n"); - printf("\t-w\t\tno write\n"); + printf("\t-r\t\tno read test\n"); + printf("\t-w\t\tno write test\n"); + printf("\t-m\t\tno multiple dataset test\n"); printf("\t-v\t\tverbose on\n"); printf("\t-f <prefix>\tfilename prefix\n"); printf("\t-d <dim0> <dim1>\tdataset dimensions\n"); @@ -125,6 +187,8 @@ parse_options(int argc, char **argv) break; case 'w': dowrite = 0; break; + case 'm': domdset = 0; + break; case 'v': verbose = 1; break; case 'f': if (--argc < 1) { @@ -238,36 +302,46 @@ main(int argc, char **argv) } if (dowrite){ - MPI_BANNER("testing MPIO independent overlapping writes..."); + MPI_BANNER("MPIO independent overlapping writes..."); test_mpio_overlap_writes(filenames[0]); - MPI_BANNER("testing dataset using split communicators..."); + MPI_BANNER("dataset using split communicators..."); test_split_comm_access(filenames[0]); - MPI_BANNER("testing dataset independent write..."); + MPI_BANNER("dataset independent write..."); dataset_writeInd(filenames[0]); - MPI_BANNER("testing dataset collective write..."); + MPI_BANNER("dataset collective write..."); dataset_writeAll(filenames[1]); - MPI_BANNER("testing extendible dataset independent write..."); + MPI_BANNER("extendible dataset independent write..."); extend_writeInd(filenames[2]); - MPI_BANNER("testing multiple datasets write ..."); - multiple_dset_write(filenames[3]); - + if (domdset){ + MPI_BANNER("multiple datasets write ..."); + multiple_dset_write(filenames[3]); + } + else{ + MPI_BANNER("Multiple datasets test skipped"); + } + } + else{ + MPI_BANNER("write tests skipped"); } if (doread){ - MPI_BANNER("testing dataset independent read..."); + MPI_BANNER("dataset independent read..."); dataset_readInd(filenames[0]); - MPI_BANNER("testing dataset collective read..."); + MPI_BANNER("dataset collective read..."); dataset_readAll(filenames[1]); - MPI_BANNER("testing extendible dataset independent read..."); + MPI_BANNER("extendible dataset independent read..."); extend_readInd(filenames[2]); } + else{ + MPI_BANNER("read tests skipped"); + } if (!(dowrite || doread)){ usage(); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 939cf19..9c89408 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -27,8 +27,8 @@ H5Eprint (stdout); \ fflush(stdout); \ if (!verbose){ \ - MPI_Finalize(); \ - exit(nerrors); \ + printf("aborting MPI process\n"); \ + MPI_Abort(MPI_COMM_WORLD, nerrors); \ } \ } \ H5Eclear(); \ @@ -56,6 +56,8 @@ /* hyperslab layout styles */ #define BYROW 1 /* divide into slabs of rows */ #define BYCOL 2 /* divide into blocks of columns */ +#define ZROW 3 /* same as BYCOL except process 0 gets 0 rows */ +#define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */ /* dataset data type. Int's can be easily octo dumped. */ |