Skip to content

Commit

Permalink
Skip MPI work on non-native VOL
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjala committed Oct 25, 2023
1 parent 081d971 commit 84b59d6
Showing 1 changed file with 37 additions and 35 deletions.
72 changes: 37 additions & 35 deletions src/H5Z.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,18 +603,19 @@ H5Z__check_unregister_dset_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *
*-------------------------------------------------------------------------
*/
static int
H5Z__flush_file_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARALLEL_USED *key)
H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void H5_ATTR_PARALLEL_USED *key)
{

#ifdef H5_HAVE_PARALLEL
H5Z_object_t *object = (H5Z_object_t *)key;
#endif /* H5_HAVE_PARALLEL */
int ret_value = false; /* Return value */
H5VL_file_specific_args_t vol_cb_args_specific; /* Arguments to VOL callback */
H5VL_object_t *vol_obj; /* File for file_id */
H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */

unsigned int intent = 0;
#endif /* H5_HAVE_PARALLEL */
int ret_value = false; /* Return value */
H5VL_file_specific_args_t vol_cb_args_specific; /* Arguments to VOL callback */
H5VL_object_t *vol_obj; /* File for file_id */
H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
H5F_t *f = NULL; /* File object for native VOL operation */
bool is_native_vol_obj = true;
unsigned int intent = 0;

FUNC_ENTER_PACKAGE

Expand All @@ -633,42 +634,43 @@ H5Z__flush_file_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, v
if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags");

if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID,
"can't determine if VOL object is native connector object");

/* Do a global flush if the file is opened for write */
if (H5F_ACC_RDWR & intent) {

#ifdef H5_HAVE_PARALLEL
H5G_loc_t loc;
H5F_t *f = NULL;

/* Check if MPIO driver is used */
if (H5G_loc(obj_id, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location");
f = loc.oloc->file;
assert(f);
/* Checking MPI flag requires native VOL */
if (is_native_vol_obj) {
f = (H5F_t *)obj_ptr;

if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
/* Check if MPIO driver is used */
if (H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {

/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
* different files). -QAK, 2018/02/14)
*/
if (H5_coll_api_sanity_check_g && !object->sanity_checked) {
MPI_Comm mpi_comm; /* File's communicator */
/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
* different files). -QAK, 2018/02/14)
*/
if (H5_coll_api_sanity_check_g && !object->sanity_checked) {
MPI_Comm mpi_comm; /* File's communicator */

/* Retrieve the file communicator */
if (H5F_mpi_retrieve_comm(obj_id, H5P_DEFAULT, &mpi_comm) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get MPI communicator");
/* Retrieve the file communicator */
if (H5F_mpi_retrieve_comm(obj_id, H5P_DEFAULT, &mpi_comm) < 0)
HGOTO_ERROR(H5E_PLINE, H5E_CANTGET, FAIL, "can't get MPI communicator");

/* Issue the barrier */
if (mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);
/* Issue the barrier */
if (mpi_comm != MPI_COMM_NULL)
MPI_Barrier(mpi_comm);

/* Set the "sanity checked" flag */
object->sanity_checked = true;
} /* end if */
} /* end if */
#endif /* H5_HAVE_PARALLEL */
/* Set the "sanity checked" flag */
object->sanity_checked = true;
} /* end if */
} /* end if */
}
#endif /* H5_HAVE_PARALLEL */

/* Call the flush routine for mounted file hierarchies */
vol_cb_args_specific.op_type = H5VL_FILE_FLUSH;
Expand Down

0 comments on commit 84b59d6

Please sign in to comment.