diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-02-11 16:03:44 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2016-02-11 16:03:44 (GMT) |
commit | d12a99498608fc23f61ec89ad56e61256428c3e6 (patch) | |
tree | 74718433b64004a430e7310b781df75a997628be | |
parent | fba3bbc7bf8e444155a7029f5ac82e1e513eadcc (diff) | |
download | hdf5-d12a99498608fc23f61ec89ad56e61256428c3e6.zip hdf5-d12a99498608fc23f61ec89ad56e61256428c3e6.tar.gz hdf5-d12a99498608fc23f61ec89ad56e61256428c3e6.tar.bz2 |
[svn-r29088] - Add a test for retrieving the property values for the new coll md functions.
- ifdef some code that don't need to be built in parallel
- more minor enhancements
tested on bb-8 with parallel and serial
-rw-r--r-- | src/H5Fint.c | 2 | ||||
-rw-r--r-- | src/H5Pfapl.c | 10 | ||||
-rw-r--r-- | src/H5Plapl.c | 7 | ||||
-rw-r--r-- | testpar/t_file.c | 113 | ||||
-rw-r--r-- | testpar/testphdf5.c | 3 | ||||
-rw-r--r-- | testpar/testphdf5.h | 1 |
6 files changed, 132 insertions, 4 deletions
diff --git a/src/H5Fint.c b/src/H5Fint.c index 2eb8ab0..1c29fee 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -175,6 +175,8 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ /* Prepare the driver property */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 43f0574..0010c15 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -178,6 +178,7 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288 #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t +#ifdef H5_HAVE_PARALLEL /* Definition of collective metadata read mode flag */ #define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) #define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE @@ -188,7 +189,7 @@ #define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE #define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t #define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t - +#endif /* H5_HAVE_PARALLEL */ /******************/ /* Local Typedefs */ @@ -291,9 +292,10 @@ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ +#ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ - +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- @@ -450,6 +452,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, @@ -461,6 +464,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_HAVE_PARALLEL */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3506,6 +3510,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_core_write_tracking() */ +#ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: H5P__encode_coll_md_read_flag_t @@ -3578,7 +3583,6 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__decode_coll_md_read_flag_t() */ -#ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: H5Pset_all_coll_metadata_ops diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 6cb2149..f725435 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -88,12 +88,13 @@ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) #define H5L_ACS_ELINK_CB_DEF {NULL,NULL} +#ifdef H5_HAVE_PARALLEL /* Definition for reading metadata collectively */ #define H5L_ACS_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) #define H5L_ACS_COLL_MD_READ_DEF H5P_USER_FALSE #define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t - +#endif /* H5_HAVE_PARALLEL */ /******************/ /* Local Typedefs */ @@ -170,7 +171,9 @@ static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ +#ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- @@ -222,11 +225,13 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_HAVE_PARALLEL */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/testpar/t_file.c b/testpar/t_file.c index 70ca60e..45d1305 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -94,4 +94,117 @@ test_split_comm_access(void) VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded"); } +void +test_file_properties(void) +{ + hid_t fid; /* HDF5 file ID */ + hid_t fapl_id; /* File access plist */ + hbool_t is_coll; + const char *filename; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + int mpi_size, mpi_rank; + herr_t ret; /* Generic return value */ + + filename = GetTestParameters(); + + /* set up MPI parameters */ + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup file access plist */ + fapl_id = H5Pcreate (H5P_FILE_ACCESS); + VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + + /* create the file with the SEC2 driver */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata API calls requirement"); + + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Open the file with the MPI-IO driver */ + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); + fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata API calls requirement"); + + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Open the file with the MPI-IO driver w collective settings */ + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); + /* Collective metadata writes */ + ret = H5Pset_coll_metadata_write(fapl_id, TRUE); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + /* Collective metadata read API calling requirement */ + ret = H5Pset_all_coll_metadata_ops(fapl_id, TRUE); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata API calls requirement"); + + /* close fapl and retrieve it from file */ + ret = H5Pclose(fapl_id); + VRFY((ret >= 0), "H5Pclose succeeded"); + fapl_id = -1; + + fapl_id = H5Fget_access_plist(fid); + VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata API calls requirement"); + + /* close file */ + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Release file-access plist */ + ret = H5Pclose(fapl_id); + VRFY((ret >= 0), "H5Pclose succeeded"); +} diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index abe074a..b7a68d9 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -351,6 +351,9 @@ int main(int argc, char **argv) AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE); + AddTest("props", test_file_properties, NULL, + "Coll Metadata file property settings", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 3597b17..7d6ff22 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -238,6 +238,7 @@ extern int dxfer_coll_type; /* Test program prototypes */ void test_plist_ed(void); void zero_dim_dset(void); +void test_file_properties(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); |