diff options
Diffstat (limited to 'src/H5AC.c')
-rw-r--r-- | src/H5AC.c | 86 |
1 files changed, 69 insertions, 17 deletions
@@ -82,7 +82,18 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Default dataset transfer property list for metadata I/O calls */ hid_t H5AC_dxpl_id = (-1); + +/* DXPL to be used in operations that will not result in I/O calls */ +hid_t H5AC_noio_dxpl_id = (-1); + +/* Default DXPL to be used for raw data I/O operations when one is not + provided by the user (fill values in H5Dcreate) */ +hid_t H5AC_rawdata_dxpl_id = (-1); + +#ifdef H5_HAVE_PARALLEL +/* Environment variable for collective API sanity checks */ hbool_t H5_coll_api_sanity_check_g = false; +#endif /* H5_HAVE_PARALLEL */ /*******************/ /* Local Variables */ @@ -163,15 +174,15 @@ done: herr_t H5AC__init_package(void) { +#ifdef H5_DEBUG_BUILD + H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ +#endif /* H5_DEBUG_BUILD */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL - /* Get an ID for the metadata (H5AC) dxpl */ - if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - /* check whether to enable strict collective function calling sanity checks using MPI barriers */ { @@ -182,10 +193,47 @@ H5AC__init_package(void) H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); } } -#else /* H5_HAVE_PARALLEL */ - H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; #endif /* H5_HAVE_PARALLEL */ +#ifdef H5_DEBUG_BUILD + /* Get an ID for the metadata (H5AC) dxpl */ + if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_METADATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") + + /* Get an ID for the no I/O internal dxpl */ + if((H5AC_noio_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noio_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_NOIO_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") + + /* Get an ID for the metadata (H5AC) dxpl */ + if((H5AC_rawdata_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_RAWDATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") +#else /* H5_DEBUG_BUILD */ + H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_noio_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_rawdata_dxpl_id = H5P_DATASET_XFER_DEFAULT; +#endif /* H5_DEBUG_BUILD */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5AC__init_package() */ @@ -213,19 +261,22 @@ H5AC_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_PKG_INIT_VAR) { -#ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0) { + if(H5AC_dxpl_id > 0 || H5AC_noio_dxpl_id > 0 || H5AC_rawdata_dxpl_id > 0) { +#ifdef H5_DEBUG_BUILD /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0 || + H5I_dec_ref(H5AC_noio_dxpl_id) < 0 || + H5I_dec_ref(H5AC_rawdata_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ +#endif /* H5_DEBUG_BUILD */ + /* Reset static IDs */ + H5AC_dxpl_id = (-1); + H5AC_noio_dxpl_id = (-1); + H5AC_rawdata_dxpl_id = (-1); } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* Reset static IDs */ - H5AC_dxpl_id = (-1); /* Reset interface initialization flag */ if(0 == n) @@ -735,7 +786,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add /* Check if we should try to flush */ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ } @@ -830,7 +881,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr) +H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, + haddr_t new_addr, hid_t dxpl_id) { #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; @@ -874,7 +926,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") #endif /* H5_HAVE_PARALLEL */ @@ -1356,7 +1408,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") #endif /* H5_HAVE_PARALLEL */ |