From 3756af13c77b27656f1213870f9ecc146bd85e61 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 1 Apr 2004 18:00:13 -0500 Subject: [svn-r8294] Purpose: feature Description: Change testphdf5 to use the common test program syntax. Needed to change the protocols of all test programs to fit the requirement of the common test syntax. Platforms tested: "h5committested". Also tested in sol with PP mode. --- testpar/t_dset.c | 32 ++++++++++++++----- testpar/t_file.c | 4 ++- testpar/t_mdset.c | 57 ++++++++++++++++++++++++++++----- testpar/testphdf5.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++ testpar/testphdf5.h | 49 +++++++++++++++++------------ 5 files changed, 195 insertions(+), 37 deletions(-) diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 881ce0a..858f3e3 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -223,7 +223,7 @@ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t bl */ void -dataset_writeInd(char *filename) +dataset_writeInd(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -234,6 +234,7 @@ dataset_writeInd(char *filename) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ + char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -245,6 +246,7 @@ dataset_writeInd(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Independent write test on file %s\n", filename); @@ -368,7 +370,7 @@ MPI_Barrier(MPI_COMM_WORLD); /* Example of using the parallel HDF5 library to read a dataset */ void -dataset_readInd(char *filename) +dataset_readInd(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -378,6 +380,7 @@ dataset_readInd(char *filename) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ + char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -389,6 +392,7 @@ dataset_readInd(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Independent read test on file %s\n", filename); @@ -489,7 +493,7 @@ dataset_readInd(char *filename) */ void -dataset_writeAll(char *filename) +dataset_writeAll(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -502,6 +506,7 @@ dataset_writeAll(char *filename) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ + char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -513,6 +518,7 @@ dataset_writeAll(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Collective write test on file %s\n", filename); @@ -848,7 +854,7 @@ dataset_writeAll(char *filename) */ void -dataset_readAll(char *filename) +dataset_readAll(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -859,6 +865,7 @@ dataset_readAll(char *filename) hbool_t use_gpfs = FALSE; /* Use GPFS hints */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ + char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -870,6 +877,7 @@ dataset_readAll(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Collective read test on file %s\n", filename); @@ -1069,7 +1077,7 @@ dataset_readAll(char *filename) */ void -extend_writeInd(char *filename) +extend_writeInd(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1078,6 +1086,7 @@ extend_writeInd(char *filename) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ @@ -1096,6 +1105,7 @@ extend_writeInd(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1293,7 +1303,7 @@ extend_writeInd(char *filename) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readInd(char *filename) +extend_readInd(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1305,6 +1315,7 @@ extend_readInd(char *filename) DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_array2 = NULL; /* data buffer */ DATATYPE *data_origin1 = NULL; /* expected data buffer */ + char *filename; hssize_t start[RANK]; /* for hyperslab setting */ hsize_t count[RANK], stride[RANK]; /* for hyperslab setting */ @@ -1316,6 +1327,7 @@ extend_readInd(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); @@ -1470,7 +1482,7 @@ extend_readInd(char *filename) */ void -extend_writeAll(char *filename) +extend_writeAll(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1480,6 +1492,7 @@ extend_writeAll(char *filename) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* dataset maximum dim sizes */ @@ -1498,6 +1511,7 @@ extend_writeAll(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Extend independent write test on file %s\n", filename); @@ -1710,7 +1724,7 @@ extend_writeAll(char *filename) /* Example of using the parallel HDF5 library to read an extendible dataset */ void -extend_readAll(char *filename) +extend_readAll(void) { hid_t fid; /* HDF5 file ID */ hid_t acc_tpl; /* File access templates */ @@ -1719,6 +1733,7 @@ extend_readAll(char *filename) hid_t mem_dataspace; /* memory dataspace ID */ hid_t dataset1, dataset2; /* Dataset ID */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ + char *filename; hsize_t dims[RANK]; /* dataset dim sizes */ DATATYPE *data_array1 = NULL; /* data buffer */ DATATYPE *data_array2 = NULL; /* data buffer */ @@ -1734,6 +1749,7 @@ extend_readAll(char *filename) MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Extend independent read test on file %s\n", filename); diff --git a/testpar/t_file.c b/testpar/t_file.c index 59ca232..c83a1af 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -32,7 +32,7 @@ * sooner or later due to barrier mixed up. */ void -test_split_comm_access(char *filename) +test_split_comm_access(void) { int mpi_size, mpi_rank; MPI_Comm comm; @@ -43,7 +43,9 @@ test_split_comm_access(char *filename) hid_t acc_tpl; /* File access properties */ hbool_t use_gpfs = FALSE; /* Use GPFS hints */ herr_t ret; /* generic return value */ + char *filename; + filename = (char *) GetTestParameters(); if (VERBOSE_MED) printf("Split Communicator access test on file %s\n", filename); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index e4ded5c..953dab1 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -36,7 +36,7 @@ void get_slab(hssize_t[], hsize_t[], hsize_t[], hsize_t[]); * Example of using PHDF5 to create ndatasets datasets. Each process write * a slab of array to the file. */ -void multiple_dset_write(char *filename, int ndatasets) +void multiple_dset_write(void) { int i, j, n, mpi_size, mpi_rank; hid_t iof, plist, dataset, memspace, filespace; @@ -49,6 +49,13 @@ void multiple_dset_write(char *filename, int ndatasets) double fill=1.0; /* Fill value */ char dname [100]; herr_t ret; + H5Ptest_param_t *pt; + char *filename; + int ndatasets; + + pt = (H5Ptest_param_t *) GetTestParameters(); + filename = pt->name; + ndatasets = pt->count; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); @@ -106,7 +113,7 @@ void multiple_dset_write(char *filename, int ndatasets) /* Example of using PHDF5 to create, write, and read compact dataset. */ -void compact_dataset(char *filename) +void compact_dataset(void) { int i, j, mpi_size, mpi_rank, err_num=0; hbool_t use_gpfs = FALSE; @@ -115,10 +122,12 @@ void compact_dataset(char *filename) double outme [SIZE][SIZE], inme[SIZE][SIZE]; char dname[]="dataset"; herr_t ret; + char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); + filename = (char *) GetTestParameters(); VRFY((mpi_size <= SIZE), "mpi_size <= SIZE"); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs); @@ -193,7 +202,7 @@ void compact_dataset(char *filename) * sizes (2GB, 4GB, etc.), but the metadata for the file pushes the file over * the boundary of interest. */ -void big_dataset(const char *filename) +void big_dataset(void) { int mpi_size, mpi_rank; /* MPI info */ hbool_t use_gpfs = FALSE; /* Don't use GPFS stuff for this test */ @@ -205,10 +214,12 @@ void big_dataset(const char *filename) char dname[]="dataset"; /* Name of dataset */ MPI_Offset file_size; /* Size of file on disk */ herr_t ret; /* Generic return value */ + char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); + filename = (char *) GetTestParameters(); VRFY((mpi_size <= SIZE), "mpi_size <= SIZE"); fapl = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type, use_gpfs); @@ -310,7 +321,7 @@ void big_dataset(const char *filename) * not have actual data written to the entire raw data area and relies on the * default fill value of zeros to work correctly. */ -void dataset_fillvalue(const char *filename) +void dataset_fillvalue(void) { int mpi_size, mpi_rank; /* MPI info */ hbool_t use_gpfs = FALSE; /* Don't use GPFS stuff for this test */ @@ -330,10 +341,12 @@ void dataset_fillvalue(const char *filename) int *twdata, *trdata; /* Temporary pointer into buffer */ int acc, i, j, k, l; /* Local index variables */ herr_t ret; /* Generic return value */ + char *filename; MPI_Comm_rank (MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size (MPI_COMM_WORLD, &mpi_size); + filename = (char *) GetTestParameters(); VRFY((mpi_size <= SIZE), "mpi_size <= SIZE"); /* Set the dataset dimension to be one row more than number of processes */ @@ -484,7 +497,7 @@ void dataset_fillvalue(const char *filename) /* Write multiple groups with a chunked dataset in each group collectively. * These groups and datasets are for testing independent read later. */ -void collective_group_write(char *filename, int ngroups) +void collective_group_write(void) { int mpi_rank, mpi_size; int i, j, m; @@ -496,6 +509,13 @@ void collective_group_write(char *filename, int ngroups) hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; const hsize_t chunk_size[2] = {SIZE/2, SIZE/2}; /* Chunk dimensions */ herr_t ret1, ret2; + H5Ptest_param_t *pt; + char *filename; + int ngroups; + + pt = (H5Ptest_param_t *) GetTestParameters(); + filename = pt->name; + ngroups = pt->count; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -563,11 +583,18 @@ void collective_group_write(char *filename, int ngroups) /* Let two sets of processes open and read different groups and chunked * datasets independently. */ -void independent_group_read(char *filename, int ngroups) +void independent_group_read(void) { int mpi_rank, m; hid_t plist, fid; hbool_t use_gpfs = FALSE; + H5Ptest_param_t *pt; + char *filename; + int ngroups; + + pt = (H5Ptest_param_t *) GetTestParameters(); + filename = pt->name; + ngroups = pt->count; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); @@ -654,7 +681,7 @@ void group_dataset_read(hid_t fid, int mpi_rank, int m) * + means the group has attribute(s). * ' means the datasets in the groups have attribute(s). */ -void multiple_group_write(char *filename, int ngroups) +void multiple_group_write(void) { int mpi_rank, mpi_size; int m; @@ -664,6 +691,13 @@ void multiple_group_write(char *filename, int ngroups) hssize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; herr_t ret; + H5Ptest_param_t *pt; + char *filename; + int ngroups; + + pt = (H5Ptest_param_t *) GetTestParameters(); + filename = pt->name; + ngroups = pt->count; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); @@ -799,7 +833,7 @@ void create_group_recursive(hid_t memspace, hid_t filespace, hid_t gid, * This function is to verify the data from multiple group testing. It opens * every dataset in every group and check their correctness. */ -void multiple_group_read(char *filename, int ngroups) +void multiple_group_read(void) { int mpi_rank, mpi_size, error_num; int m; @@ -808,6 +842,13 @@ void multiple_group_read(char *filename, int ngroups) hid_t plist, fid, gid, memspace, filespace; hssize_t chunk_origin[DIM]; hsize_t chunk_dims[DIM], file_dims[DIM], count[DIM]; + H5Ptest_param_t *pt; + char *filename; + int ngroups; + + pt = (H5Ptest_param_t *) GetTestParameters(); + filename = pt->name; + ngroups = pt->count; MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 13b391f..45b1ca7 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -359,6 +359,8 @@ done: int main(int argc, char **argv) { int mpi_size, mpi_rank; /* mpi variables */ + H5Ptest_param_t ndsets_params, ngroups_params; + H5Ptest_param_t collngroups_params; /* Un-buffer the stdout and stderr */ setbuf(stderr, NULL); @@ -391,6 +393,93 @@ int main(int argc, char **argv) "===================================\n"); } + { + int Summary = 0; + int CleanUp = 1; + + + + + /* Initialize testing framework */ + TestInit(); + + /* Tests are generally arranged from least to most complexity... */ + AddTest("mpio_dup", test_fapl_mpio_dup, NULL, + "fapl_mpio_dup", NULL); + AddTest("mpiposix_dup", test_fapl_mpiposix_dup, NULL, + "fapl_mpiposix_dup", NULL); + + ndsets_params.name = filenames[3]; + ndsets_params.count = ndatasets; + AddTest("ndatasets", multiple_dset_write, NULL, + "multiple datasets write", &ndsets_params); + + ngroups_params.name = filenames[4]; + ngroups_params.count = ngroups; + AddTest("ngroups", multiple_group_write, NULL, + "multiple groups write", &ngroups_params); + AddTest("ngroups_read", multiple_group_read, NULL, + "multiple groups read", &ngroups_params); + + AddTest("split", test_split_comm_access, NULL, + "dataset using split communicators", filenames[0]); + AddTest("indwrite", dataset_writeInd, NULL, + "dataset independent write", filenames[0]); + AddTest("collwrite", dataset_writeAll, NULL, + "dataset collective write", filenames[1]); + AddTest("indwriteext", extend_writeInd, NULL, + "extendible dataset independent write", filenames[2]); + AddTest("collwriteext", extend_writeAll, NULL, + "extendible dataset collective write", filenames[2]); + + AddTest("indread", dataset_readInd, NULL, + "dataset independent read", filenames[0]); + AddTest("collread", dataset_readAll, NULL, + "dataset collective read", filenames[1]); + AddTest("indreadext", extend_readInd, NULL, + "extendible dataset independent read", filenames[2]); + AddTest("collreadext", extend_readAll, NULL, + "extendible dataset collective read", filenames[2]); + + AddTest("compact", compact_dataset, NULL, + "compact dataset test", filenames[5]); + + collngroups_params.name = filenames[6]; + collngroups_params.count = ngroups; + AddTest("coll_ngroups", collective_group_write, NULL, + "collective group and dataset write", &collngroups_params); + AddTest("indngroupsread", independent_group_read, NULL, + "independent group and dataset read", &collngroups_params); + + if (dobig && sizeof(MPI_Offset)>4){ + AddTest("bigdataset", big_dataset, NULL, + "big dataset test", filenames[7]); + } + AddTest("fillvalue", dataset_fillvalue, NULL, + "dataset fill value", filenames[8]); + + /* Display testing information */ + TestInfo(argv[0]); + + /* Parse command line arguments */ +/* TestParseCmdLine(argc,argv,&Summary,&CleanUp); */ + + /* Perform requested testing */ + PerformTests(); + + /* Display test summary, if requested */ + if (Summary) + TestSummary(); + + /* Clean up test files, if allowed */ + if (CleanUp && !getenv("HDF5_NOCLEANUP")) + TestCleanup(); + + nerrors = GetTestNumErrs(); + + } + +#if 0 MPI_BANNER("test_fapl_mpio_dup..."); test_fapl_mpio_dup(); @@ -484,6 +573,7 @@ int main(int argc, char **argv) MPI_BANNER("dataset fill value test..."); dataset_fillvalue(filenames[8]); +#endif if (!(dowrite || doread || ndatasets || ngroups || docompact || doindependent || dobig )){ usage(); diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index e5e437a..f757e7c 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -123,6 +123,13 @@ #define FACC_MULTI 0x4 /* Multi File */ #define FACC_MPIPOSIX 0x8 /* MPIPOSIX */ +/* type definitions */ +typedef struct H5Ptest_param_t /* holds extra test parameters */ +{ + char *name; + int count; +} H5Ptest_param_t; + /* Dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; @@ -134,28 +141,30 @@ extern H5E_auto_t old_func; /* previous error handler */ extern void *old_client_data; /*previous error handler arg.*/ extern int facc_type; /*Test file access type */ -/* Prototypes */ -hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, hbool_t use_gpfs); -MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); -void multiple_dset_write(char *filename, int ndatasets); -void multiple_group_write(char *filename, int ngroups); -void multiple_group_read(char *filename, int ngroups); -void collective_group_write(char *filename, int ngroups); -void independent_group_read(char *filename, int ngroups); +/* Test program prototypes */ +void multiple_dset_write(void); +void multiple_group_write(void); +void multiple_group_read(void); +void collective_group_write(void); +void independent_group_read(void); void test_fapl_mpio_dup(void); void test_fapl_mpiposix_dup(void); -void test_split_comm_access(char *filename); -void dataset_writeInd(char *filename); -void dataset_writeAll(char *filename); -void extend_writeInd(char *filename); -void extend_writeAll(char *filename); -void dataset_readInd(char *filename); -void dataset_readAll(char *filename); -void extend_readInd(char *filename); -void extend_readAll(char *filename); -void compact_dataset(char *filename); -void big_dataset(const char *filename); -void dataset_fillvalue(const char *filename); +void test_split_comm_access(void); +void dataset_writeInd(void); +void dataset_writeAll(void); +void extend_writeInd(void); +void extend_writeAll(void); +void dataset_readInd(void); +void dataset_readAll(void); +void extend_readInd(void); +void extend_readAll(void); +void compact_dataset(void); +void big_dataset(void); +void dataset_fillvalue(void); + +/* commonly used prototypes */ +hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type, hbool_t use_gpfs); +MPI_Offset h5_mpi_get_file_size(const char *filename, MPI_Comm comm, MPI_Info info); int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original); -- cgit v0.12