diff options
-rw-r--r-- | src/H5Fmpi.c | 116 | ||||
-rw-r--r-- | src/H5Fprivate.h | 2 | ||||
-rw-r--r-- | src/H5I.c | 50 | ||||
-rw-r--r-- | src/H5Iprivate.h | 1 | ||||
-rw-r--r-- | src/H5O.c | 210 | ||||
-rw-r--r-- | src/H5Oprivate.h | 5 | ||||
-rw-r--r-- | src/H5VLnative.h | 11 | ||||
-rw-r--r-- | src/H5VLnative_file.c | 18 | ||||
-rw-r--r-- | src/H5VLnative_object.c | 34 | ||||
-rw-r--r-- | test/cork.c | 12 | ||||
-rw-r--r-- | testpar/t_dset.c | 8 |
11 files changed, 372 insertions, 95 deletions
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index bb422ac..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,12 +236,43 @@ 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 * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -250,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) + 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") + 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() */ /*------------------------------------------------------------------------- @@ -279,7 +342,6 @@ done: * Purpose: Returns the atomicity mode * * Return: Success: Non-negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -290,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) + 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() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 8c70663..7e87f79 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -855,6 +855,8 @@ H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh); H5_DLL int H5F_mpi_get_size(const H5F_t *f); H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); H5_DLL herr_t H5F_get_mpi_info(const H5F_t *f, MPI_Info **f_info); +H5_DLL herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag); +H5_DLL herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag); #endif /* H5_HAVE_PARALLEL */ /* External file cache routines */ @@ -1086,6 +1086,56 @@ done: /*------------------------------------------------------------------------- + * Function: H5I_is_file_object + * + * Purpose: Convenience function to determine if an ID represents + * a file object. + * + * In H5O calls, you can't use object_verify to ensure + * the ID was of the correct class since there's no + * H5I_OBJECT ID class. + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + *------------------------------------------------------------------------- + */ +htri_t +H5I_is_file_object(hid_t id) +{ + H5I_type_t id_type = H5I_get_type(id); + htri_t ret_value = FAIL; + + FUNC_ENTER_NOAPI(FAIL); + + /* Fail if the ID type is out of range */ + HDassert(id_type >= 1 && id_type < H5I_NTYPES); + + /* Return TRUE if the ID is a file object (dataset, group, map, or committed + * datatype), FALSE otherwise. + */ + if (H5I_DATASET == id_type || H5I_GROUP == id_type || H5I_MAP == id_type) { + ret_value = TRUE; + } + else if (H5I_DATATYPE == id_type) { + + H5T_t *dt = NULL; + + if(NULL == (dt = (H5T_t *)H5I_object(id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get underlying datatype struct") + + ret_value = H5T_is_named(dt); + } + else { + ret_value = FALSE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5I_is_file_object() */ + + +/*------------------------------------------------------------------------- * Function: H5Iremove_verify * * Purpose: Removes the specified ID from its type, first checking that the diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h index 9068b5f..cc1ce1f 100644 --- a/src/H5Iprivate.h +++ b/src/H5Iprivate.h @@ -92,6 +92,7 @@ H5_DLL void *H5I_object(hid_t id); H5_DLL void *H5I_object_verify(hid_t id, H5I_type_t id_type); H5_DLL void *H5I_remove(hid_t id); H5_DLL void *H5I_subst(hid_t id, const void *new_object); +H5_DLL htri_t H5I_is_file_object(hid_t id); /* ID registration functions */ H5_DLL hid_t H5I_register(H5I_type_t type, const void *object, hbool_t app_ref); @@ -1116,113 +1116,215 @@ done: /*------------------------------------------------------------------------- - * Function: H5Odisable_mdc_flushes + * Function: H5O_disable_mdc_flushes * - * Purpose: To "cork" an object: - * --keep dirty entries associated with the object in the metadata cache + * Purpose: Private version of the metadata cache cork function. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_disable_mdc_flushes(H5O_loc_t *oloc) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5O_disable_mdc_flushes() */ + + +/*------------------------------------------------------------------------- + * Function: H5Odisable_mdc_flushes + * + * Purpose: "Cork" an object, keeping dirty entries associated with the + * object in the metadata cache. + * + * Return: Success: Non-negative + * Failure: Negative * - * Programmer: Vailin Choi - * January 2014 + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Odisable_mdc_flushes(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE1("e", "i", object_id); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); - if(H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork an object") + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); + + /* Cork the object */ + if(H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, &loc_params) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object"); done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API(ret_value); } /* H5Odisable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5Oenable_mdc_flushes + * Function: H5O_enable_mdc_flushes * - * Purpose: To "uncork" an object - * --release keeping dirty entries associated with the object - * in the metadata cache + * Purpose: Private version of the metadata cache uncork function. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_enable_mdc_flushes(H5O_loc_t *oloc) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); + +done: + FUNC_LEAVE_NOAPI(ret_value); +} /* H5O_enable_mdc_flushes() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oenable_mdc_flushes + * + * Purpose: "Uncork" an object, allowing dirty entries associated with + * the object to be flushed. * - * Programmer: Vailin Choi - * January 2014 + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Oenable_mdc_flushes(hid_t object_id) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE1("e", "i", object_id); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); + + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); - /* Set the value */ - if(H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork an object") + /* Uncork the object */ + if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, &loc_params) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object"); done: - FUNC_LEAVE_API(ret_value) + FUNC_LEAVE_API(ret_value); } /* H5Oenable_mdc_flushes() */ /*------------------------------------------------------------------------- - * Function: H5Oare_mdc_flushes_disabled + * Function: H5O_are_mdc_flushes_disabled * - * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled": - * TRUE if mdc flushes for the object is disabled - * FALSE if mdc flushes for the object is not disabled - * Return error if the parameter "are_disabled" is not supplied + * Purpose: Private version of cork status getter. * - * Return: Success: Non-negative - * Failure: Negative + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL); + + HDassert(are_disabled); + + if (H5AC_cork(oloc->file, oloc->addr, H5AC__GET_CORKED, are_disabled) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5O_are_mdc_flushes_disabled() */ + + +/*------------------------------------------------------------------------- + * Function: H5Oare_mdc_flushes_disabled + * + * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled": + * TRUE if mdc flushes for the object is disabled + * FALSE if mdc flushes for the object is not disabled * - * Programmer: Vailin Choi - * January 2014 + * Return error if the parameter "are_disabled" is not supplied + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi + * January 2014 * *------------------------------------------------------------------------- */ herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled) { - H5O_loc_t *oloc; /* Object location */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_t *vol_obj; /* Object token of loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API(FAIL); H5TRACE2("e", "i*b", object_id, are_disabled); - /* Check args */ + /* Sanity check */ + if (!are_disabled) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get object location from ID"); - /* Get the object's oloc */ - if(NULL == (oloc = H5O_get_loc(object_id))) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") - if(!are_disabled) - HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "unable to get object location from ID") + /* Make sure the ID is a file object */ + if (H5I_is_file_object(object_id) != TRUE) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID is not a file object"); + + /* Get the VOL object */ + if (NULL == (vol_obj = H5VL_vol_object(object_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object ID"); + + /* Fill in location struct fields */ + loc_params.type = H5VL_OBJECT_BY_SELF; + loc_params.obj_type = H5I_get_type(object_id); /* Get the cork status */ - if(H5AC_cork(oloc->file, oloc->addr, H5AC__GET_CORKED, are_disabled) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve an object's cork status") + if (H5VL_object_optional(vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, &loc_params, are_disabled) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status"); done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 354a00b..bcb8299 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -972,6 +972,11 @@ H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id); H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc); H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_driver, hbool_t start_swmr); +/* Cache corking functions */ +H5_DLL herr_t H5O_disable_mdc_flushes(H5O_loc_t *oloc); +H5_DLL herr_t H5O_enable_mdc_flushes(H5O_loc_t *oloc); +H5_DLL herr_t H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled); + /* Object copying routines */ H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, H5O_copy_t *cpy_info, hbool_t inc_depth, diff --git a/src/H5VLnative.h b/src/H5VLnative.h index a8d5720..b2dd13d 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -71,6 +71,8 @@ typedef int H5VL_native_file_optional_t; #define H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS 24 /* H5Fset_latest_format/libver_bounds */ #define H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG 25 /* H5Fget_dset_no_attrs_hint */ #define H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG 26 /* H5Fset_dset_no_attrs_hint */ +#define H5VL_NATIVE_FILE_GET_MPI_ATOMICITY 27 /* H5Fget_mpi_atomicity */ +#define H5VL_NATIVE_FILE_SET_MPI_ATOMICITY 28 /* H5Fset_mpi_atomicity */ /* Typedef and values for native VOL connector group optional VOL operations */ typedef int H5VL_native_group_optional_t; @@ -81,9 +83,12 @@ typedef int H5VL_native_group_optional_t; /* Typedef and values for native VOL connector object optional VOL operations */ typedef int H5VL_native_object_optional_t; -#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ -#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */ -#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ +#define H5VL_NATIVE_OBJECT_GET_COMMENT 0 /* H5G|H5Oget_comment, H5Oget_comment_by_name */ +#define H5VL_NATIVE_OBJECT_GET_INFO 1 /* H5Oget_info(_by_idx, _by_name)(2) */ +#define H5VL_NATIVE_OBJECT_SET_COMMENT 2 /* H5G|H5Oset_comment, H5Oset_comment_by_name */ +#define H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES 3 /* H5Odisable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES 4 /* H5Oenable_mdc_flushes */ +#define H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED 5 /* H5Oare_mdc_flushes_disabled */ #ifdef __cplusplus extern "C" { diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 0ac70e3..bb77822 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -789,6 +789,24 @@ H5VL__native_file_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR break; } + /* H5Fget_mpi_atomicity */ + case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: + { + hbool_t *flag = (hbool_t *)HDva_arg(arguments, hbool_t *); + if (H5F_get_mpi_atomicity(f, flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "cannot get MPI atomicity"); + break; + } + + /* H5Fset_mpi_atomicity */ + case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: + { + hbool_t flag = (hbool_t)HDva_arg(arguments, int); + if (H5F_set_mpi_atomicity(f, flag) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set MPI atomicity"); + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid optional operation") } /* end switch */ diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c index de2a8a5..49d4b2c 100644 --- a/src/H5VLnative_object.c +++ b/src/H5VLnative_object.c @@ -487,6 +487,40 @@ H5VL__native_object_optional(void *obj, hid_t H5_ATTR_UNUSED dxpl_id, break; } + /* H5Odisable_mdc_flushes */ + case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: + { + H5O_loc_t *oloc = loc.oloc; + + if (H5O_disable_mdc_flushes(oloc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork the metadata cache"); + + break; + } + + /* H5Oenable_mdc_flushes */ + case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: + { + H5O_loc_t *oloc = loc.oloc; + + if (H5O_enable_mdc_flushes(oloc) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork the metadata cache"); + + break; + } + + /* H5Oare_mdc_flushes_disabled */ + case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: + { + H5O_loc_t *oloc = loc.oloc; + hbool_t *are_disabled = (hbool_t *)HDva_arg(arguments, hbool_t *); + + if (H5O_are_mdc_flushes_disabled(oloc, are_disabled) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine metadata cache cork status"); + + break; + } + default: HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't perform this operation on object"); } /* end switch */ diff --git a/test/cork.c b/test/cork.c index 09076d2..06a520d 100644 --- a/test/cork.c +++ b/test/cork.c @@ -1529,11 +1529,13 @@ error: static unsigned test_objs_cork(hbool_t swmr, hbool_t new_format) { - hid_t fid; /* HDF5 File ID */ - hid_t fapl; /* File access property list */ - hid_t gid, did, tid; /* Object IDs */ - hid_t sid; /* Dataspace ID */ - hid_t aid; /* Attribute ID */ + hid_t fid = H5I_INVALID_HID; /* HDF5 File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + hid_t gid = H5I_INVALID_HID; + hid_t did = H5I_INVALID_HID; + hid_t tid = H5I_INVALID_HID; /* Object IDs */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ hsize_t dims[RANK]; /* Dataset dimension sizes */ hbool_t corked; /* Cork status of an object */ unsigned flags; /* File access flags */ diff --git a/testpar/t_dset.c b/testpar/t_dset.c index d4e556d..6c91a41 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -4162,7 +4162,7 @@ dataset_atomicity(void) } /* should fail */ - ret = H5Fset_mpi_atomicity (fid , TRUE); + ret = H5Fset_mpi_atomicity(fid , TRUE); VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); if(MAINPROCESS){ @@ -4184,7 +4184,7 @@ dataset_atomicity(void) ret = H5Pclose(acc_tpl); VRFY((ret >= 0), "H5Pclose succeeded"); - ret = H5Fset_mpi_atomicity (fid , TRUE); + ret = H5Fset_mpi_atomicity(fid , TRUE); VRFY((ret >= 0), "H5Fset_mpi_atomicity succeeded"); /* open dataset1 (contiguous case) */ @@ -4203,7 +4203,7 @@ dataset_atomicity(void) } /* check that the atomicity flag is set */ - ret = H5Fget_mpi_atomicity (fid , &atomicity); + ret = H5Fget_mpi_atomicity(fid , &atomicity); VRFY((ret >= 0), "atomcity get failed"); VRFY((atomicity == TRUE), "atomcity set failed"); @@ -4272,7 +4272,7 @@ dataset_atomicity(void) atomicity = FALSE; /* check that the atomicity flag is set */ - ret = H5Fget_mpi_atomicity (fid , &atomicity); + ret = H5Fget_mpi_atomicity(fid , &atomicity); VRFY((ret >= 0), "atomcity get failed"); VRFY((atomicity == TRUE), "atomcity set failed"); |