diff options
Diffstat (limited to 'src/H5ACmpio.c')
-rw-r--r-- | src/H5ACmpio.c | 102 |
1 files changed, 54 insertions, 48 deletions
diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 945aaba..7671abc 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- @@ -39,6 +37,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACpkg.h" /* Metadata cache */ #include "H5Cprivate.h" /* Cache */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5MMprivate.h" /* Memory management */ @@ -96,20 +95,19 @@ static herr_t H5AC__construct_candidate_list(H5AC_t *cache_ptr, H5AC_aux_t *aux_ptr, int sync_point_op); static herr_t H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); -static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, - hid_t dxpl_id); +static herr_t H5AC__propagate_and_apply_candidate_list(H5F_t *f); +static herr_t H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f); static herr_t H5AC__receive_haddr_list(MPI_Comm mpi_comm, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); static herr_t H5AC__receive_candidate_list(const H5AC_t *cache_ptr, unsigned *num_entries_ptr, haddr_t **haddr_buf_ptr_ptr); -static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id); +static herr_t H5AC__receive_and_apply_clean_list(H5F_t *f); static herr_t H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, haddr_t *candidates_list_ptr); -static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id); -static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id); +static herr_t H5AC__rsp__dist_md_write__flush(H5F_t *f); +static herr_t H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f); +static herr_t H5AC__rsp__p0_only__flush(H5F_t *f); +static herr_t H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f); /*********************/ @@ -1228,7 +1226,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) +H5AC__propagate_and_apply_candidate_list(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1277,7 +1275,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, dxpl_id, cache_ptr, num_candidates, + result = H5C_apply_candidate_list(f, cache_ptr, num_candidates, candidates_list_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); /* Disable writes again */ @@ -1395,7 +1393,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) +H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1417,10 +1415,9 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't broadcast clean slist.") HDassert(H5SL_count(aux_ptr->c_slist_ptr) == 0); } /* end if */ - else { - if(H5AC__receive_and_apply_clean_list(f, dxpl_id) < 0) + else + if(H5AC__receive_and_apply_clean_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't receive and/or process clean slist broadcast.") - } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1429,7 +1426,7 @@ done: /*------------------------------------------------------------------------- * - * Function: H5AC_receive_haddr_list() + * Function: H5AC__receive_haddr_list() * * Purpose: Receive the list of entry addresses from process 0, * and return it in a buffer pointed to by *haddr_buf_ptr_ptr. @@ -1496,7 +1493,7 @@ done: haddr_buf_ptr = (haddr_t *)H5MM_xfree((void *)haddr_buf_ptr); FUNC_LEAVE_NOAPI(ret_value) -} /* H5AC_receive_haddr_list() */ +} /* H5AC__receive_haddr_list() */ /*------------------------------------------------------------------------- @@ -1518,7 +1515,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) +H5AC__receive_and_apply_clean_list(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1543,7 +1540,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) if(num_entries > 0) /* mark the indicated entries as clean */ - if(H5C_mark_entries_as_clean(f, dxpl_id, num_entries, haddr_buf_ptr) < 0) + if(H5C_mark_entries_as_clean(f, num_entries, haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't mark entries clean.") /* if it is defined, call the sync point done callback. Note @@ -1661,7 +1658,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) +H5AC__rsp__dist_md_write__flush(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1696,15 +1693,20 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) if(H5AC__copy_candidate_list_to_buffer(cache_ptr, &num_entries, &haddr_buf_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate buffer.") - /* initial sync point barrier */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) + /* Initial sync point barrier + * + * When flushing from within the close operation from a file, + * it's possible to skip this barrier (on the second flush of the cache). + */ + if(!H5CX_get_mpi_file_flushing()) + if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) /* Enable writes during this operation */ aux_ptr->write_permitted = TRUE; /* Apply the candidate list */ - result = H5C_apply_candidate_list(f, dxpl_id, cache_ptr, num_entries, + result = H5C_apply_candidate_list(f, cache_ptr, num_entries, haddr_buf_ptr, aux_ptr->mpi_rank, aux_ptr->mpi_size); /* Disable writes again */ @@ -1803,7 +1805,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) +H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1832,7 +1834,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't construct candidate list.") /* propagate and apply candidate list -- all processes */ - if(H5AC__propagate_and_apply_candidate_list(f, dxpl_id) < 0) + if(H5AC__propagate_and_apply_candidate_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate and apply candidate list.") } /* evictions enabled */ @@ -1878,7 +1880,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) +H5AC__rsp__p0_only__flush(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -1896,12 +1898,16 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); - /* to prevent "messages from the future" we must + /* To prevent "messages from the future" we must * synchronize all processes before we start the flush. * Hence the following barrier. + * + * However, when flushing from within the close operation from a file, + * it's possible to skip this barrier (on the second flush of the cache). */ - if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) - HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) + if(!H5CX_get_mpi_file_flushing()) + if(MPI_SUCCESS != (mpi_result = MPI_Barrier(aux_ptr->mpi_comm))) + HMPI_GOTO_ERROR(FAIL, "MPI_Barrier failed", mpi_result) /* Flush data to disk, from rank 0 process */ if(aux_ptr->mpi_rank == 0) { @@ -1911,7 +1917,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Flush the cache */ - result = H5C_flush_cache(f, dxpl_id, H5AC__NO_FLAGS_SET); + result = H5C_flush_cache(f, H5AC__NO_FLAGS_SET); /* Disable writes again */ aux_ptr->write_permitted = FALSE; @@ -1921,7 +1927,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") /* this code exists primarily for the test bed -- it allows us to - * enforce posix semantics on the server that pretends to be a + * enforce POSIX semantics on the server that pretends to be a * file system in our parallel tests. */ if(aux_ptr->write_done) @@ -1929,7 +1935,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) } /* end if */ /* Propagate cleaned entries to other ranks. */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f, dxpl_id) < 0) + if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: @@ -1980,7 +1986,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) +H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -2032,7 +2038,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) aux_ptr->write_permitted = TRUE; /* Flush the cache */ - result = H5C_flush_to_min_clean(f, dxpl_id); + result = H5C_flush_to_min_clean(f); /* Disable writes again */ aux_ptr->write_permitted = FALSE; @@ -2049,7 +2055,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) (aux_ptr->write_done)(); } /* end if */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f, dxpl_id) < 0) + if(H5AC__propagate_flushed_and_still_clean_entries_list(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") } /* end if */ @@ -2090,7 +2096,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op) +H5AC__run_sync_point(H5F_t *f, int sync_point_op) { H5AC_t * cache_ptr; H5AC_aux_t * aux_ptr; @@ -2132,12 +2138,12 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: switch(sync_point_op) { case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: - if(H5AC__rsp__p0_only__flush_to_min_clean(f, dxpl_id) < 0) + if(H5AC__rsp__p0_only__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush_to_min_clean() failed.") break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: - if(H5AC__rsp__p0_only__flush(f, dxpl_id) < 0) + if(H5AC__rsp__p0_only__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__p0_only__flush() failed.") break; @@ -2150,12 +2156,12 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: switch(sync_point_op) { case H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN: - if(H5AC__rsp__dist_md_write__flush_to_min_clean(f, dxpl_id) < 0) + if(H5AC__rsp__dist_md_write__flush_to_min_clean(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush_to_min_clean() failed.") break; case H5AC_SYNC_POINT_OP__FLUSH_CACHE: - if(H5AC__rsp__dist_md_write__flush(f, dxpl_id) < 0) + if(H5AC__rsp__dist_md_write__flush(f) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5AC__rsp__dist_md_write__flush() failed.") break; @@ -2286,7 +2292,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, unsigned num_candidates, *------------------------------------------------------------------------- */ herr_t -H5AC__flush_entries(H5F_t *f, hid_t dxpl_id) +H5AC__flush_entries(H5F_t *f) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2298,7 +2304,7 @@ H5AC__flush_entries(H5F_t *f, hid_t dxpl_id) /* Check if we have >1 ranks */ if(H5C_get_aux_ptr(f->shared->cache)) - if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) + if(H5AC__run_sync_point(f, H5AC_SYNC_POINT_OP__FLUSH_CACHE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") done: |