summaryrefslogtreecommitdiffstats
path: root/testpar/t_file.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2019-08-26 17:26:31 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2019-08-26 17:26:31 (GMT)
commit3bcbce5538eb334948311c5afeaef7c050056dca (patch)
tree6cd5acd99efe330d33fbc775ed88ea40b73ce684 /testpar/t_file.c
parent884ad149e29f7c99487af676f0bbcd88cbf2735f (diff)
downloadhdf5-3bcbce5538eb334948311c5afeaef7c050056dca.zip
hdf5-3bcbce5538eb334948311c5afeaef7c050056dca.tar.gz
hdf5-3bcbce5538eb334948311c5afeaef7c050056dca.tar.bz2
Added H5Pset/get_mpi_params calls and unified them with the MPI-I/O
VFD info in H5FDmpio.c.
Diffstat (limited to 'testpar/t_file.c')
-rw-r--r--testpar/t_file.c103
1 files changed, 90 insertions, 13 deletions
diff --git a/testpar/t_file.c b/testpar/t_file.c
index a3c007d..1811a62 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;
@@ -180,7 +180,7 @@ test_page_buffer_access(void)
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);
@@ -740,29 +740,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 */
@@ -783,7 +853,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 */
@@ -800,7 +870,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 */
@@ -810,7 +880,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 */
@@ -827,10 +897,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 */
@@ -851,5 +921,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() */