diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-09-26 08:19:13 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-10-11 02:46:06 (GMT) |
commit | 75bb8add458930420b1d0856605ecc55ff2e12de (patch) | |
tree | 28116f9fe7610969f5754501aeccdbbb1d3f8213 /src/H5Fmpi.c | |
parent | 3819640e3c7c2967c426f8bfc95d302f0ae0491a (diff) | |
download | hdf5-75bb8add458930420b1d0856605ecc55ff2e12de.zip hdf5-75bb8add458930420b1d0856605ecc55ff2e12de.tar.gz hdf5-75bb8add458930420b1d0856605ecc55ff2e12de.tar.bz2 |
Marked up H5Fget/set_mpi_atomicity() to use the VOL.
Diffstat (limited to 'src/H5Fmpi.c')
-rw-r--r-- | src/H5Fmpi.c | 106 |
1 files changed, 83 insertions, 23 deletions
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 7eb4231..1630d6b 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -38,6 +38,8 @@ #include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ +#include "H5VLnative_private.h" /* Native VOL connector */ + /****************/ /* Local Macros */ @@ -234,6 +236,38 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_set_mpi_atomicity + * + * Purpose: Private call to set the atomicity mode + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + /* Check args */ + HDassert(file); + + /* Check VFD */ + if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) + HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode"); + + /* Set atomicity value */ + if (H5FD_set_mpio_atomicity(file->shared->lf, flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5F_set_mpi_atomicity() */ + + +/*------------------------------------------------------------------------- * Function: H5Fset_mpi_atomicity * * Purpose: Sets the atomicity mode @@ -249,27 +283,57 @@ done: herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag) { - H5F_t *file; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + int va_flag = (int)flag; /* C is grumpy about passing hbool_t via va_arg */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL); H5TRACE2("e", "ib", file_id, flag); + /* Get the file object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); + + /* Set atomicity value */ + if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, va_flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity"); + +done: + FUNC_LEAVE_API(ret_value); +} /* end H5Fset_mpi_atomicity() */ + + +/*------------------------------------------------------------------------- + * Function: H5F_get_mpi_atomicity + * + * Purpose: Private call to get the atomicity mode + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") + HDassert(file); + HDassert(flag); /* Check VFD */ if (!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode"); - /* set atomicity value */ - if (H5FD_set_mpio_atomicity (file->shared->lf, flag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set atomicity flag") + /* Get atomicity value */ + if (H5FD_get_mpio_atomicity(file->shared->lf, flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag"); done: - FUNC_LEAVE_API(ret_value) -} + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5F_get_mpi_atomicity() */ /*------------------------------------------------------------------------- @@ -288,27 +352,23 @@ done: herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) { - H5F_t *file; - herr_t ret_value = SUCCEED; + H5VL_object_t *vol_obj = NULL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL); H5TRACE2("e", "i*b", file_id, flag); - /* Check args */ - if(NULL == (file = (H5F_t *)H5VL_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") - - /* Check VFD */ - if(!H5F_HAS_FEATURE(file, H5FD_FEAT_HAS_MPI)) - HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect VFL driver, does not support MPI atomicity mode") + /* Get the file object */ + if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier"); - /* get atomicity value */ - if (H5FD_get_mpio_atomicity (file->shared->lf, flag) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get atomicity flag") + /* Get atomicity value */ + if (H5VL_file_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity"); done: - FUNC_LEAVE_API(ret_value) -} + FUNC_LEAVE_API(ret_value); +} /* end H5Fget_mpi_atomicity() */ /*------------------------------------------------------------------------- |