summaryrefslogtreecommitdiffstats
path: root/testpar/t_ph5basic.c
diff options
context:
space:
mode:
Diffstat (limited to 'testpar/t_ph5basic.c')
-rw-r--r--testpar/t_ph5basic.c135
1 files changed, 66 insertions, 69 deletions
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() */