summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/H5FDmpio.c19
-rw-r--r--src/H5mpi.c21
2 files changed, 17 insertions, 23 deletions
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 13efcff..71e9fe1 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -792,20 +792,11 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id,
if(NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list")
- /* Set MPI communicator and info object */
- if(H5P_FILE_ACCESS_DEFAULT == fapl_id || H5FD_MPIO != H5P_peek_driver(plist)) {
- /* Non-parallel defaults */
- if(FAIL == H5_mpi_comm_dup(MPI_COMM_SELF, &comm))
- HGOTO_ERROR(H5E_INTERNAL, H5E_CANTCOPY, NULL, "communicator duplicate failed")
- info = MPI_INFO_NULL;
- }
- else {
- /* Get the MPI communicator and info object from the property list */
- if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator")
- if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object")
- }
+ /* Get the MPI communicator and info object from the property list */
+ if(H5P_get(plist, H5F_ACS_MPI_PARAMS_COMM_NAME, &comm) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI communicator")
+ if(H5P_get(plist, H5F_ACS_MPI_PARAMS_INFO_NAME, &info) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get MPI info object")
/* Convert HDF5 flags to MPI-IO flags */
/* Some combinations are illegal; let MPI-IO figure it out */
diff --git a/src/H5mpi.c b/src/H5mpi.c
index aec1e03..d48790b 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -239,6 +239,9 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result)
/* Can't pass MPI_COMM_NULL to MPI_Comm_compare() so we have to handle
* it in special cases.
+ *
+ * MPI_Comm can either be an integer type or a pointer. We cast them
+ * to intptr_t so we can compare them with < and > when needed.
*/
if (MPI_COMM_NULL == comm1 && MPI_COMM_NULL == comm2) {
/* Special case of both communicators being MPI_COMM_NULL */
@@ -247,7 +250,7 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result)
else if (MPI_COMM_NULL == comm1 || MPI_COMM_NULL == comm2) {
/* Special case of one communicator being MPI_COMM_NULL */
- *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1;
+ *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1;
}
else {
@@ -257,15 +260,11 @@ H5_mpi_comm_cmp(MPI_Comm comm1, MPI_Comm comm2, int *result)
if (MPI_SUCCESS != (mpi_code = MPI_Comm_compare(comm1, comm2, &mpi_result)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_compare failed", mpi_code)
- /* Set the result
- *
- * The else clause should work regardless of whether MPI_Datatype is
- * fundamentally an integer or a pointer.
- */
+ /* Set the result */
if (MPI_IDENT == mpi_result || MPI_CONGRUENT == mpi_result)
*result = 0;
else
- *result = (MPI_Datatype)comm1 < (MPI_Datatype)comm2 ? -1 : 1;
+ *result = (intptr_t)comm1 < (intptr_t)comm2 ? -1 : 1;
}
done:
@@ -372,11 +371,15 @@ H5_mpi_info_cmp(MPI_Info info1, MPI_Info info2, int *result)
} /* end else */
} /* end else */
- /* Set the output value */
+ /* Set the output value
+ *
+ * MPI_Info can either be an integer type or a pointer. We cast them
+ * to intptr_t so we can compare them with < and > when needed.
+ */
if (same)
*result = 0;
else
- *result = (MPI_Datatype)info1 < (MPI_Datatype)info2 ? -1 : 1;
+ *result = (intptr_t)info1 < (intptr_t)info2 ? -1 : 1;
done:
if (key)