diff options
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_file.c | 2 | ||||
-rw-r--r-- | testpar/t_mdset.c | 11 | ||||
-rw-r--r-- | testpar/testphdf5.c | 26 | ||||
-rw-r--r-- | testpar/testphdf5.h | 12 |
4 files changed, 31 insertions, 20 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c index d2b3d86..50cef96 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -77,6 +77,8 @@ test_split_comm_access(char *filename) VRFY((mrc==MPI_SUCCESS), ""); } } + mrc = MPI_Barrier(MPI_COMM_WORLD); + VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded"); } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 8b9d505..2ee7c30 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -2,9 +2,8 @@ #define DIM 2 #define SIZE 32 -#define NUMITEMS 300 -void multiple_dset_write(char *filename) +void multiple_dset_write(char *filename, int ndatasets) { int i, j, n, mpi_size, mpi_rank; hid_t iof, plist, dataset, memspace, filespace; @@ -37,10 +36,10 @@ void multiple_dset_write(char *filename) filespace = H5Screate_simple (DIM, file_dims, NULL); H5Sselect_hyperslab (filespace, H5S_SELECT_SET, chunk_origin, chunk_dims, count, chunk_dims); - for (n = 0; n < NUMITEMS; n++) { + for (n = 0; n < ndatasets; n++) { sprintf (dname, "dataset %d", n); - dataset = H5Dcreate (iof, dname, H5T_NATIVE_FLOAT, filespace, H5P_DEFAULT); - VRFY((dataset > 0), "dataset create succeeded"); + dataset = H5Dcreate (iof, dname, H5T_NATIVE_DOUBLE, filespace, H5P_DEFAULT); + VRFY((dataset > 0), dname); /* calculate data to write */ for (i = 0; i < SIZE; i++) @@ -52,8 +51,8 @@ void multiple_dset_write(char *filename) H5Dclose (dataset); if (! ((n+1) % 10)) { printf("created %d datasets\n", n+1); - } MPI_Barrier(MPI_COMM_WORLD); + } } H5Sclose (filespace); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index d4d79b9..f78a0be 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -6,6 +6,10 @@ #include <testphdf5.h> +#ifndef FILENAME_MAX +#define FILENAME_MAX 512 +#endif + /* global variables */ int dim0 = DIM0; int dim1 = DIM1; @@ -13,6 +17,7 @@ int chunkdim0; int chunkdim1; int nerrors = 0; /* errors count */ int verbose = 0; /* verbose, default as no. */ +int ndatasets = 300; /*number of datasets to create*/ herr_t (*old_func)(void*); /* previous error handler */ void *old_client_data; /* previous error handler arg.*/ @@ -20,7 +25,6 @@ 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", @@ -28,7 +32,7 @@ const char *FILENAME[5]={ "ParaEg3", "ParaMdset", NULL}; -char filenames[5][200]; +char filenames[5][FILENAME_MAX]; hid_t fapl; /* file access property list */ @@ -150,10 +154,12 @@ int MPI_Type_create_resized(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent, void usage(void) { - printf("Usage: testphdf5 [-r] [-w] [-v] [-f <prefix>] [-d <dim0> <dim1>]\n"); + printf("Usage: testphdf5 [-r] [-w] [-v] [-m<n_datasets>] " + "[-f <prefix>] [-d <dim0> <dim1>]\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-m<n_datasets>" + "\tset number of datasets for the 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"); @@ -188,7 +194,11 @@ parse_options(int argc, char **argv) break; case 'w': dowrite = 0; break; - case 'm': domdset = 0; + case 'm': ndatasets = atoi((*argv+1)+1); + if (ndatasets < 0){ + nerrors++; + return(1); + } break; case 'v': verbose = 1; break; @@ -296,9 +306,9 @@ main(int argc, char **argv) goto finish; } - if (domdset){ + if (ndatasets){ MPI_BANNER("multiple datasets write ..."); - multiple_dset_write(filenames[3]); + multiple_dset_write(filenames[3], ndatasets); } else{ MPI_BANNER("Multiple datasets test skipped"); @@ -335,7 +345,7 @@ main(int argc, char **argv) MPI_BANNER("read tests skipped"); } - if (!(dowrite || doread || domdset)){ + if (!(dowrite || doread || ndatasets)){ usage(); nerrors++; } diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 371e07f..4cf27c0 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -64,11 +64,11 @@ typedef int DATATYPE; /* shared global variables */ -extern int dim0, dim1; /* Dataset dimensions */ -extern int chunkdim0, chunkdim1; /* Chunk dimensions */ -extern int nerrors; /* errors count */ -extern int verbose; /* verbose, default as no. */ -extern herr_t (*old_func)(void*); /* previous error handler */ -extern void *old_client_data; /* previous error handler arg.*/ +extern int dim0, dim1; /*Dataset dimensions */ +extern int chunkdim0, chunkdim1; /*Chunk dimensions */ +extern int nerrors; /*errors count */ +extern int verbose; /*verbose, default as no. */ +extern herr_t (*old_func)(void*); /*previous error handler */ +extern void *old_client_data; /*previous error handler arg.*/ #endif /* PHDF5TEST_H */ |