diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-27 21:56:20 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-27 21:56:20 (GMT) |
commit | a6df73c723b4ef604e2a0aab06efc72e30b0478a (patch) | |
tree | 0951b6c9e44fb707ad8f83a36daa55c6f5b8048b /testpar | |
parent | 09d13b3c13dfc3fa79a7d616d80a06183fb05cc9 (diff) | |
parent | fb8296371cf45654a9252ed01b635519205da3de (diff) | |
download | hdf5-a6df73c723b4ef604e2a0aab06efc72e30b0478a.zip hdf5-a6df73c723b4ef604e2a0aab06efc72e30b0478a.tar.gz hdf5-a6df73c723b4ef604e2a0aab06efc72e30b0478a.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'fb8296371cf45654a9252ed01b635519205da3de':
Minor tweaks to new H5P MPI code based on code review feedback.
Fixed a bug in the cache image code that was introduced by the HD changes.
Added H5Pset/get_mpi_params calls and unified them with the MPI-I/O VFD info in H5FDmpio.c.
Diffstat (limited to 'testpar')
-rw-r--r-- | testpar/t_cache_image.c | 2 | ||||
-rw-r--r-- | testpar/t_file.c | 103 | ||||
-rw-r--r-- | testpar/t_ph5basic.c | 135 | ||||
-rw-r--r-- | testpar/testpar.h | 15 |
4 files changed, 165 insertions, 90 deletions
diff --git a/testpar/t_cache_image.c b/testpar/t_cache_image.c index e0c8211..14e3d10 100644 --- a/testpar/t_cache_image.c +++ b/testpar/t_cache_image.c @@ -1187,7 +1187,7 @@ open_hdf5_file(const hbool_t create_file, } else { - file_ptr = (struct H5F_t *)H5I_object_verify(file_id, H5I_FILE); + file_ptr = (struct H5F_t *)H5VL_object_verify(file_id, H5I_FILE); if ( file_ptr == NULL ) { diff --git a/testpar/t_file.c b/testpar/t_file.c index e3ce346..f1aff19 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -120,7 +120,7 @@ void test_page_buffer_access(void) { hid_t file_id = -1; /* File ID */ - hid_t fcpl, fapl, fapl_self; + hid_t fcpl, fapl; size_t page_count = 0; int i, num_elements = 200; haddr_t raw_addr, meta_addr; @@ -179,7 +179,7 @@ test_page_buffer_access(void) for(i=0 ; i<num_elements ; i++) data[i] = -1; if(MAINPROCESS) { - hid_t fapl_self; + hid_t fapl_self = H5I_INVALID_HID; fapl_self = create_faccess_plist(MPI_COMM_SELF, MPI_INFO_NULL, facc_type); @@ -739,29 +739,99 @@ open_file(const char *filename, hid_t fapl, int metadata_write_strategy, void test_file_properties(void) { - hid_t fid; /* HDF5 file ID */ - hid_t fapl_id; /* File access plist */ + hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */ + hid_t fapl_id = H5I_INVALID_HID; /* File access plist */ + hid_t fapl_copy_id = H5I_INVALID_HID; /* File access plist */ hbool_t is_coll; + htri_t are_equal; const char *filename; MPI_Comm comm = MPI_COMM_WORLD; MPI_Info info = MPI_INFO_NULL; + MPI_Comm comm_out = MPI_COMM_NULL; + MPI_Info info_out = MPI_INFO_NULL; herr_t ret; /* Generic return value */ + int mpi_ret; /* MPI return value */ + int cmp; /* Compare value */ filename = (const char *)GetTestParameters(); /* set up MPI parameters */ - MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); - MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + mpi_ret = MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + VRFY((mpi_ret >= 0), "MPI_Comm_size succeeded"); + mpi_ret = MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + VRFY((mpi_ret >= 0), "MPI_Comm_rank succeeded"); + mpi_ret = MPI_Info_create(&info); + VRFY((mpi_ret >= 0), "MPI_Info_create succeeded"); + mpi_ret = MPI_Info_set(info, "hdf_info_prop1", "xyz"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); /* setup file access plist */ fapl_id = H5Pcreate(H5P_FILE_ACCESS); - VRFY((fapl_id >= 0), "H5Pcreate"); + VRFY((fapl_id != H5I_INVALID_HID), "H5Pcreate"); ret = H5Pset_fapl_mpio(fapl_id, comm, info); VRFY((ret >= 0), "H5Pset_fapl_mpio"); + /* Check getting and setting MPI properties + * (for use in VOL connectors, not the MPI-I/O VFD) + */ + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + ret = H5Pget_mpi_params(fapl_id, &comm_out, &info_out); + VRFY((ret >= 0), "H5Pget_mpi_params succeeded"); + + /* Check the communicator */ + VRFY((comm != comm_out), "Communicators should not be bitwise identical"); + cmp = MPI_UNEQUAL; + mpi_ret = MPI_Comm_compare(comm, comm_out, &cmp); + VRFY((ret >= 0), "MPI_Comm_compare succeeded"); + VRFY((cmp == MPI_CONGRUENT), "Communicators should be congruent via MPI_Comm_compare"); + + /* Check the info object */ + VRFY((info != info_out), "Info objects should not be bitwise identical"); + + /* Free the obtained comm and info object */ + mpi_ret = MPI_Comm_free(&comm_out); + VRFY((mpi_ret >= 0), "MPI_Comm_free succeeded"); + mpi_ret = MPI_Info_free(&info_out); + VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); + + /* Copy the fapl and ensure it's equal to the original */ + fapl_copy_id = H5Pcopy(fapl_id); + VRFY((fapl_copy_id != H5I_INVALID_HID), "H5Pcopy"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((TRUE == are_equal), "H5Pequal"); + + /* Add a property to the copy and ensure it's different now */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "abc"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_copy_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((FALSE == are_equal), "H5Pequal"); + + /* Add a property with the same key but a different value to the original + * and ensure they are still different. + */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "ijk"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((FALSE == are_equal), "H5Pequal"); + + /* Set the second property in the original to the same + * value as the copy and ensure they are the same now. + */ + mpi_ret = MPI_Info_set(info, "hdf_info_prop2", "abc"); + VRFY((mpi_ret == MPI_SUCCESS), "MPI_Info_set"); + ret = H5Pset_mpi_params(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_mpi_params succeeded"); + are_equal = H5Pequal(fapl_id, fapl_copy_id); + VRFY((TRUE == are_equal), "H5Pequal"); + /* create the file */ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); - VRFY((fid >= 0), "H5Fcreate succeeded"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -782,7 +852,7 @@ test_file_properties(void) 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"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -799,7 +869,7 @@ test_file_properties(void) ret = H5Fclose(fid); VRFY((ret >= 0), "H5Fclose succeeded"); - /* Open the file with the MPI-IO driver w collective settings */ + /* 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 */ @@ -809,7 +879,7 @@ test_file_properties(void) 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"); + VRFY((fid != H5I_INVALID_HID), "H5Fcreate succeeded"); /* verify settings for file access properties */ @@ -826,10 +896,10 @@ test_file_properties(void) /* close fapl and retrieve it from file */ ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); - fapl_id = -1; + fapl_id = H5I_INVALID_HID; fapl_id = H5Fget_access_plist(fid); - VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + VRFY((fapl_id != H5I_INVALID_HID), "H5P_FILE_ACCESS"); /* verify settings for file access properties */ @@ -850,5 +920,12 @@ test_file_properties(void) /* Release file-access plist */ ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); + ret = H5Pclose(fapl_copy_id); + VRFY((ret >= 0), "H5Pclose succeeded"); + + /* Free the MPI info object */ + mpi_ret = MPI_Info_free(&info); + VRFY((mpi_ret >= 0), "MPI_Info_free succeeded"); + } /* end test_file_properties() */ diff --git a/testpar/t_ph5basic.c b/testpar/t_ph5basic.c index 8e554ee..73d262e 100644 --- a/testpar/t_ph5basic.c +++ b/testpar/t_ph5basic.c @@ -22,17 +22,15 @@ * Function: test_fapl_mpio_dup * * Purpose: Test if fapl_mpio property list keeps a duplicate of the - * communicator and INFO objects given when set; and returns - * duplicates of its components when H5Pget_fapl_mpio is called. + * communicator and INFO objects given when set; and returns + * duplicates of its components when H5Pget_fapl_mpio is called. * - * Return: Success: None - * - * Failure: Abort + * Return: Success: None + * Failure: Abort * * Programmer: Albert Cheng * January 9, 2003 * - * Modifications: *------------------------------------------------------------------------- */ void @@ -44,43 +42,43 @@ test_fapl_mpio_dup(void) int mpi_size_tmp, mpi_rank_tmp; MPI_Info info = MPI_INFO_NULL; MPI_Info info_tmp = MPI_INFO_NULL; - int mrc; /* MPI return value */ - hid_t acc_pl; /* File access properties */ - herr_t ret; /* hdf5 return value */ + int mrc; /* MPI return value */ + hid_t acc_pl; /* File access properties */ + herr_t ret; /* HDF5 return value */ int nkeys, nkeys_tmp; if (VERBOSE_MED) - HDprintf("Verify fapl_mpio duplicates communicator and INFO objects\n"); + HDprintf("Verify fapl_mpio duplicates communicator and INFO objects\n"); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD,&mpi_size); MPI_Comm_rank(MPI_COMM_WORLD,&mpi_rank); if (VERBOSE_MED) - HDprintf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); + HDprintf("rank/size of MPI_COMM_WORLD are %d/%d\n", mpi_rank, mpi_size); /* Create a new communicator that has the same processes as MPI_COMM_WORLD. * Use MPI_Comm_split because it is simplier than MPI_Comm_create */ mrc = MPI_Comm_split(MPI_COMM_WORLD, 0, 0, &comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_split"); - MPI_Comm_size(comm,&mpi_size_old); - MPI_Comm_rank(comm,&mpi_rank_old); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_split"); + MPI_Comm_size(comm, &mpi_size_old); + MPI_Comm_rank(comm, &mpi_rank_old); if (VERBOSE_MED) - HDprintf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); + HDprintf("rank/size of comm are %d/%d\n", mpi_rank_old, mpi_size_old); /* create a new INFO object with some trivial information. */ mrc = MPI_Info_create(&info); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_create"); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_create"); mrc = MPI_Info_set(info, "hdf_info_name", "XYZ"); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_set"); - if (MPI_INFO_NULL != info){ - mrc=MPI_Info_get_nkeys(info, &nkeys); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_set"); + if (MPI_INFO_NULL != info) { + mrc = MPI_Info_get_nkeys(info, &nkeys); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); } if (VERBOSE_MED) - h5_dump_info_object(info); + h5_dump_info_object(info); - acc_pl = H5Pcreate (H5P_FILE_ACCESS); + acc_pl = H5Pcreate(H5P_FILE_ACCESS); VRFY((acc_pl >= 0), "H5P_FILE_ACCESS"); ret = H5Pset_fapl_mpio(acc_pl, comm, info); @@ -92,28 +90,27 @@ test_fapl_mpio_dup(void) * valid communicator and INFO object. */ mrc = MPI_Comm_free(&comm); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info){ - mrc = MPI_Info_free(&info); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info) { + mrc = MPI_Info_free(&info); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio"); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - HDprintf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); - VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); - VRFY((nkeys_tmp==nkeys), "new and old nkeys equal"); + HDprintf("After H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", mpi_rank_tmp, mpi_size_tmp); + VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size"); + VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((nkeys_tmp == nkeys), "new and old nkeys equal"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* Case 2: * Free the retrieved communicator and INFO object. @@ -122,23 +119,23 @@ test_fapl_mpio_dup(void) * Also verify the NULL argument option. */ mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } /* check NULL argument options. */ ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, NULL); VRFY((ret >= 0), "H5Pget_fapl_mpio Comm only"); mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); ret = H5Pget_fapl_mpio(acc_pl, NULL, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio Info only"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } ret = H5Pget_fapl_mpio(acc_pl, NULL, NULL); @@ -148,44 +145,44 @@ test_fapl_mpio_dup(void) /* Donot free the returned objects which are used in the next case. */ ret = H5Pget_fapl_mpio(acc_pl, &comm_tmp, &info_tmp); VRFY((ret >= 0), "H5Pget_fapl_mpio"); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - HDprintf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - VRFY((mpi_size_tmp==mpi_size), "MPI_Comm_size"); - VRFY((mpi_rank_tmp==mpi_rank), "MPI_Comm_rank"); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); - VRFY((nkeys_tmp==nkeys), "new and old nkeys equal"); + HDprintf("After second H5Pget_fapl_mpio: rank/size of comm are %d/%d\n", + mpi_rank_tmp, mpi_size_tmp); + VRFY((mpi_size_tmp == mpi_size), "MPI_Comm_size"); + VRFY((mpi_rank_tmp == mpi_rank), "MPI_Comm_rank"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); + VRFY((nkeys_tmp == nkeys), "new and old nkeys equal"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* Case 3: * Close the property list and verify the retrieved communicator and INFO * object are still valid. */ H5Pclose(acc_pl); - MPI_Comm_size(comm_tmp,&mpi_size_tmp); - MPI_Comm_rank(comm_tmp,&mpi_rank_tmp); + MPI_Comm_size(comm_tmp, &mpi_size_tmp); + MPI_Comm_rank(comm_tmp, &mpi_rank_tmp); if (VERBOSE_MED) - HDprintf("After Property list closed: rank/size of comm are %d/%d\n", - mpi_rank_tmp, mpi_size_tmp); - if (MPI_INFO_NULL != info_tmp){ - mrc=MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_get_nkeys"); + HDprintf("After Property list closed: rank/size of comm are %d/%d\n", + mpi_rank_tmp, mpi_size_tmp); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_get_nkeys(info_tmp, &nkeys_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_get_nkeys"); } if (VERBOSE_MED) - h5_dump_info_object(info_tmp); + h5_dump_info_object(info_tmp); /* clean up */ mrc = MPI_Comm_free(&comm_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Comm_free"); - if (MPI_INFO_NULL!=info_tmp){ - mrc = MPI_Info_free(&info_tmp); - VRFY((mrc==MPI_SUCCESS), "MPI_Info_free"); + VRFY((mrc == MPI_SUCCESS), "MPI_Comm_free"); + if (MPI_INFO_NULL != info_tmp) { + mrc = MPI_Info_free(&info_tmp); + VRFY((mrc == MPI_SUCCESS), "MPI_Info_free"); } -} +} /* end test_fapl_mpio_dup() */ diff --git a/testpar/testpar.h b/testpar/testpar.h index 4fbe8d8..86677d1 100644 --- a/testpar/testpar.h +++ b/testpar/testpar.h @@ -32,7 +32,7 @@ */ #define MESG(mesg) \ if (VERBOSE_MED && *mesg != '\0') \ - HDprintf("%s\n", mesg) + HDprintf("%s\n", mesg) /* * VRFY: Verify if the condition val is true. @@ -46,16 +46,17 @@ */ #define VRFY(val, mesg) do { \ if (val) { \ - MESG(mesg); \ - } else { \ - HDprintf("Proc %d: ", mpi_rank); \ - HDprintf("*** Parallel ERROR ***\n"); \ - HDprintf(" VRFY (%s) failed at line %4d in %s\n", \ + MESG(mesg); \ + } \ + else { \ + HDprintf("Proc %d: ", mpi_rank); \ + HDprintf("*** Parallel ERROR ***\n"); \ + HDprintf(" VRFY (%s) failed at line %4d in %s\n", \ mesg, (int)__LINE__, __FILE__); \ ++nerrors; \ fflush(stdout); \ if (!VERBOSE_MED) { \ - HDprintf("aborting MPI processes\n"); \ + HDprintf("aborting MPI processes\n"); \ MPI_Abort(MPI_COMM_WORLD, 1); \ } \ } \ |