diff options
author | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-12-31 21:06:16 (GMT) |
---|---|---|
committer | M. Scot Breitenfeld <brtnfld@hdfgroup.org> | 2018-12-31 21:06:16 (GMT) |
commit | f772ef9f2e12f2407bd6d3f72ddd996ea721f9b8 (patch) | |
tree | 67ce0b8b0239aa362f4e046428ca1a0d50ea6acc | |
parent | ef21966d177bea03af65c5a431d613c923c83dd4 (diff) | |
download | hdf5-f772ef9f2e12f2407bd6d3f72ddd996ea721f9b8.zip hdf5-f772ef9f2e12f2407bd6d3f72ddd996ea721f9b8.tar.gz hdf5-f772ef9f2e12f2407bd6d3f72ddd996ea721f9b8.tar.bz2 |
switched to using CX instead of a global var.
-rw-r--r-- | src/H5CX.c | 56 | ||||
-rw-r--r-- | src/H5CXprivate.h | 2 | ||||
-rw-r--r-- | src/H5Dmpio.c | 10 | ||||
-rw-r--r-- | src/H5FDmpio.c | 2 | ||||
-rw-r--r-- | src/H5private.h | 1 |
5 files changed, 65 insertions, 6 deletions
@@ -198,6 +198,7 @@ typedef struct H5CX_t { MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */ MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */ hbool_t mpi_file_flushing; /* Whether an MPI-opened file is being flushed */ + hbool_t mpio_Proc0_BCast; /* Whether a dataset meets read-proc0-and-bcast requirements */ #endif /* H5_HAVE_PARALLEL */ /* Cached DXPL properties */ @@ -1537,6 +1538,33 @@ done: /*------------------------------------------------------------------------- + * Function: H5CX_get_mpio_Proc0_BCast + * + * Purpose: Retrieves if the dataset meets read-proc0-and-bcast requirements for the current API call context. + * + * Return: Non-negative on success / Negative on failure + * + * Programmer: M. Breitenfeld + * December 31, 2018 + * + *------------------------------------------------------------------------- + */ +hbool_t +H5CX_get_mpio_Proc0_BCast(void) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(head && *head); + + FUNC_LEAVE_NOAPI((*head)->ctx.mpio_Proc0_BCast) + +} /* end H5CX_get_mpio_Proc0_BCast() */ + + +/*------------------------------------------------------------------------- * Function: H5CX_get_mpio_chunk_opt_mode * * Purpose: Retrieves the collective chunk optimization mode for the current API call context. @@ -2320,6 +2348,34 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause) FUNC_LEAVE_NOAPI_VOID } /* end H5CX_set_mpio_global_no_coll_cause() */ + +/*------------------------------------------------------------------------- + * Function: H5CX_set_mpio_Proc0_BCast + * + * Purpose: Sets if the dataset meets read-proc0-and-bcast requirements for the current API call context. + * + * Return: <none> + * + * Programmer: M. Breitenfeld + * December 31, 2018 + * + *------------------------------------------------------------------------- + */ +void +H5CX_set_mpio_Proc0_BCast(hbool_t mpio_Proc0_BCast) +{ + H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity checks */ + HDassert(head && *head); + + (*head)->ctx.mpio_Proc0_BCast = mpio_Proc0_BCast; + + FUNC_LEAVE_NOAPI_VOID +} /* end H5CX_set_mpio_Proc0_BCast */ + #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /*------------------------------------------------------------------------- diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 57ca5cd..f93121c 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -75,6 +75,7 @@ H5_DLL H5AC_ring_t H5CX_get_ring(void); H5_DLL hbool_t H5CX_get_coll_metadata_read(void); H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype); H5_DLL hbool_t H5CX_get_mpi_file_flushing(void); +H5_DLL hbool_t H5CX_get_mpio_Proc0_BCast(void); #endif /* H5_HAVE_PARALLEL */ /* "Getter" routines for DXPL properties cached in API context */ @@ -128,6 +129,7 @@ H5_DLL void H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t chun H5_DLL void H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t actual_io_mode); H5_DLL void H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause); H5_DLL void H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause); +H5_DLL void H5CX_set_mpio_Proc0_BCast(hbool_t mpio_Proc0_BCast); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard); H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard); diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 3c4eab2..df2cc9e 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -47,8 +47,6 @@ #ifdef H5_HAVE_PARALLEL -hbool_t H5FD_MPIO_Proc0_BCast_g; /* Flag if dataset is both: H5S_ALL and < 2GB */ - /****************/ /* Local Macros */ /****************/ @@ -287,6 +285,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, /* [1] Flag if dataset is both: H5S_ALL and small */ unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */ htri_t ret_value = SUCCEED; /* Return value */ + hbool_t H5FD_MPIO_Proc0_BCast; /* Flag if dataset is both: H5S_ALL and < 2GB */ FUNC_ENTER_PACKAGE @@ -349,7 +348,7 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED; #endif - H5FD_MPIO_Proc0_BCast_g = FALSE; + H5FD_MPIO_Proc0_BCast = FALSE; /* Check to see if all the processes are reading the same data */ if((H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL)) { /* Flag to do a MPI_Bcast of the data from one proc instead of @@ -395,7 +394,10 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, /* read-proc0-and-bcast if collective and H5S_ALL */ if(global_cause[0] == 0 && global_cause[1] == 0) - H5FD_MPIO_Proc0_BCast_g = TRUE; + H5FD_MPIO_Proc0_BCast = TRUE; + + /* Set Flag if dataset is both: H5S_ALL and < 2GB in the API context */ + H5CX_set_mpio_Proc0_BCast(H5FD_MPIO_Proc0_BCast); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 28bffc6..a4b9ef3 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1515,7 +1515,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: doing MPI collective IO\n"); #endif - if(H5FD_MPIO_Proc0_BCast_g) { + if(H5CX_get_mpio_Proc0_BCast()) { #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_read: doing Proc0-read-and-MPI_Bcast\n"); diff --git a/src/H5private.h b/src/H5private.h index 3fc1d7a..05bfc63 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1738,7 +1738,6 @@ typedef struct H5_debug_t { #ifdef H5_HAVE_PARALLEL extern hbool_t H5_coll_api_sanity_check_g; -extern hbool_t H5FD_MPIO_Proc0_BCast_g; /* Meets read-proc0-and-bcast requirements*/ #endif /* H5_HAVE_PARALLEL */ extern H5_debug_t H5_debug_g; |