diff options
-rw-r--r-- | testpar/t_dset.c | 49 | ||||
-rw-r--r-- | testpar/t_file.c | 8 | ||||
-rw-r--r-- | testpar/t_mdset.c | 9 | ||||
-rw-r--r-- | testpar/testphdf5.c | 117 | ||||
-rw-r--r-- | testpar/testphdf5.h | 11 |
5 files changed, 86 insertions, 108 deletions
diff --git a/testpar/t_dset.c b/testpar/t_dset.c index 1917d20..3639e7a 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -155,7 +155,6 @@ void dataset_print(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t */ int dataset_vrfy(hssize_t start[], hsize_t count[], hsize_t stride[], hsize_t block[], DATATYPE *dataset, DATATYPE *original) { -#define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ DATATYPE *dataptr = dataset; DATATYPE *originptr = original; @@ -246,12 +245,9 @@ dataset_writeInd(char *filename) /* ---------------------------------------- * CREATE AN HDF5 FILE WITH PARALLEL ACCESS * ---------------------------------------*/ - /* setup file access template with parallel IO access. */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "H5Pcreate access succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); /* create the file collectively */ fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); @@ -391,14 +387,9 @@ dataset_readInd(char *filename) data_origin1 = (DATATYPE *)malloc(dim0*dim1*sizeof(DATATYPE)); VRFY((data_origin1 != NULL), "data_origin1 malloc succeeded"); - /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + acc_tpl = create_faccess_plist(comm, info, facc_type); VRFY((acc_tpl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), ""); - /* open the file collectively */ fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); @@ -520,12 +511,9 @@ dataset_writeAll(char *filename) /* ------------------- * START AN HDF5 FILE * -------------------*/ - /* setup file access template with parallel IO access. */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "H5Pcreate access succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); /* create the file collectively */ fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); @@ -747,12 +735,9 @@ dataset_readAll(char *filename) /* ------------------- * OPEN AN HDF5 FILE * -------------------*/ - /* setup file access template with parallel IO access. */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "H5Pcreate access succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); /* open the file collectively */ fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); @@ -979,12 +964,9 @@ extend_writeInd(char *filename) /* ------------------- * START AN HDF5 FILE * -------------------*/ - /* setup file access template with parallel IO access. */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); - VRFY((acc_tpl >= 0), "H5Pcreate access succeeded"); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), "H5Pset_fapl_mpio succeeded"); + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); /* create the file collectively */ fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); @@ -1187,11 +1169,8 @@ extend_readInd(char *filename) * OPEN AN HDF5 FILE * -------------------*/ /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + acc_tpl = create_faccess_plist(comm, info, facc_type); VRFY((acc_tpl >= 0), ""); - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), ""); /* open the file collectively */ fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); diff --git a/testpar/t_file.c b/testpar/t_file.c index 668ae60..e34a068 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -52,12 +52,8 @@ test_split_comm_access(char *filename) MPI_Comm_rank(comm,&sub_mpi_rank); /* setup file access template */ - acc_tpl = H5Pcreate (H5P_FILE_ACCESS); + acc_tpl = create_faccess_plist(comm, info, facc_type); VRFY((acc_tpl >= 0), ""); - - /* set Parallel access with communicator */ - ret = H5Pset_fapl_mpio(acc_tpl, comm, info); - VRFY((ret >= 0), ""); /* create the file collectively */ fid=H5Fcreate(filename,H5F_ACC_TRUNC,H5P_DEFAULT,acc_tpl); @@ -74,7 +70,7 @@ test_split_comm_access(char *filename) /* detele the test file */ if (sub_mpi_rank == 0){ mrc = MPI_File_delete(filename, info); - VRFY((mrc==MPI_SUCCESS), ""); + /*VRFY((mrc==MPI_SUCCESS), ""); */ } } mrc = MPI_Barrier(MPI_COMM_WORLD); diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index bfec845..d49ca90 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -45,8 +45,7 @@ void multiple_dset_write(char *filename, int ndatasets) for (i = 0; i < DIM; i++) file_dims [i] = SIZE; - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); iof = H5Fcreate (filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); H5Pclose (plist); @@ -118,8 +117,7 @@ void multiple_group_write(char *filename, int ngroups) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - plist = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, plist); H5Pclose(plist); @@ -253,8 +251,7 @@ void multiple_group_read(char *filename, int ngroups) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - plist = H5Pcreate(H5P_FILE_ACCESS); - H5Pset_fapl_mpio(plist, MPI_COMM_WORLD, MPI_INFO_NULL); + plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index bade9a1..aa1b349 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -20,6 +20,7 @@ int verbose = 0; /* verbose, default as no. */ int ndatasets = 300; /* number of datasets to create*/ int ngroups = 512; /* number of groups to create in root * group. */ +int facc_type = FACC_MPIO; /*Test file access type */ herr_t (*old_func)(void*); /* previous error handler */ void *old_client_data; /* previous error handler arg.*/ @@ -88,66 +89,6 @@ 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 @@ -165,6 +106,7 @@ usage(void) "\tset number of groups for the multiple group test\n"); printf("\t-v\t\tverbose on\n"); printf("\t-f <prefix>\tfilename prefix\n"); + printf("\t-s\t\tuse Split-file together with MPIO\n"); printf("\t-d <dim0> <dim1>\tdataset dimensions\n"); printf("\t-c <dim0> <dim1>\tdataset chunk dimensions\n"); printf("\tDefault: do write then read with dimensions %dx%d\n", @@ -221,6 +163,11 @@ parse_options(int argc, char **argv) } paraprefix = *argv; break; + case 's': /* Use the split-file driver with MPIO access */ + /* Can use $HDF5_METAPREFIX to define the */ + /* meta-file-prefix. */ + facc_type = FACC_MPIO | FACC_SPLIT; + break; case 'd': /* dimensizes */ if (--argc < 2){ nerrors++; @@ -293,6 +240,56 @@ parse_options(int argc, char **argv) } +/* + * Create the appropriate File access property list + */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ) +{ + hid_t ret_pl = -1; + herr_t ret; /* generic return value */ + int mpi_rank; /* mpi variables */ + + /* need the rank for error checking macros */ + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), "H5P_FILE_ACCESS"); + + if (facc_type == FACC_DEFAULT) + return (ret_pl); + + if (facc_type == FACC_MPIO){ + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(ret_pl, comm, info); + VRFY((ret >= 0), ""); + return(ret_pl); + } + + if (facc_type == (FACC_MPIO | FACC_SPLIT)){ + hid_t mpio_pl; + + mpio_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((mpio_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_mpio(mpio_pl, comm, info); + VRFY((ret >= 0), ""); + + /* setup file access template */ + ret_pl = H5Pcreate (H5P_FILE_ACCESS); + VRFY((ret_pl >= 0), ""); + /* set Parallel access with communicator */ + ret = H5Pset_fapl_split(ret_pl, ".meta", mpio_pl, ".raw", mpio_pl); + VRFY((ret >= 0), "H5Pset_fapl_split succeeded"); + H5Pclose(mpio_pl); + return(ret_pl); + } + + /* unknown file access types */ + return (ret_pl); +} + + main(int argc, char **argv) { int mpi_size, mpi_rank; /* mpi variables */ diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 7d24ea0..f990b28 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -81,7 +81,11 @@ #define ZCOL 4 /* same as BYCOL except process 0 gets 0 columns */ #define MAX_ERR_REPORT 10 /* Maximum number of errors reported */ - +/* File_Access_type bits */ +#define FACC_DEFAULT 0x0 /* default */ +#define FACC_MPIO 0x1 /* MPIO */ +#define FACC_SPLIT 0x2 /* Split File */ +#define FACC_MULTI 0x4 /* Multi File */ /* dataset data type. Int's can be easily octo dumped. */ typedef int DATATYPE; @@ -93,5 +97,10 @@ 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 facc_type; /*Test file access type */ + +/* prototypes */ +hid_t +create_faccess_plist(MPI_Comm comm, MPI_Info info, int facc_type ); #endif /* PHDF5TEST_H */ |