diff --git a/src/h5core/h5_model.c b/src/h5core/h5_model.c index 4cdb71e..cc6fc15 100644 --- a/src/h5core/h5_model.c +++ b/src/h5core/h5_model.c @@ -158,37 +158,24 @@ h5priv_normalize_dataset_name ( } #ifdef PARALLEL_IO -h5_err_t -h5_set_throttle ( - const h5_file_t f_, - const int factor - ) { - h5_file_p f = (h5_file_p)f_; - H5_CORE_API_ENTER (h5_err_t, "f=%p, factor=%d", f, factor); - if ( (f->props->flags & H5_VFD_MPIO_INDEPENDENT) -#if H5_VERSION_LE(1,8,12) - || (f->props->flags & H5_VFD_MPIO_POSIX) -#endif - ) { - f->props->throttle = factor; - h5_info ( - "Throttling enabled with factor = %lld", - (long long int)f->props->throttle ); - } else { - h5_warn ( - "Throttling is only permitted with the MPI-POSIX " - "or MPI-IO Independent VFD." ); - } - - H5_CORE_API_RETURN (H5_SUCCESS); -} - h5_err_t h5priv_start_throttle ( const h5_file_p f ) { H5_CORE_API_ENTER (h5_err_t, "f=%p", f); if (f->props->throttle > 0) { + // throttle only if VFD is MPIO independent od POSIX + h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT; +#if H5_VERSION_LE(1,8,12) + mask |= H5_VFD_MPIO_POSIX; +#endif + if (! (f->props->flags & mask)) { + h5_warn ( + "Throttling is only permitted with the MPI-POSIX " + "or MPI-IO Independent VFD." ); + H5_CORE_API_LEAVE (H5_SUCCESS); + } + int token = 1; h5_info ( "Throttling with factor = %lld", @@ -199,11 +186,11 @@ h5priv_start_throttle ( (long long int)(f->myproc - f->props->throttle)); // wait to receive token before continuing with read TRY( h5priv_mpi_recv( - &token, 1, MPI_INT, - f->myproc - f->props->throttle, // receive from previous proc - f->myproc, // use this proc id as message tag - f->props->comm - ) ); + &token, 1, MPI_INT, + f->myproc - f->props->throttle, // receive from previous proc + f->myproc, // use this proc id as message tag + f->props->comm + ) ); } h5_debug ("throttle: received token"); } diff --git a/src/h5core/h5_openclose.c b/src/h5core/h5_openclose.c index 8087465..df2624d 100644 --- a/src/h5core/h5_openclose.c +++ b/src/h5core/h5_openclose.c @@ -192,6 +192,11 @@ h5_set_prop_file_mpio_collective ( props->flags &= ~(H5_VFD_MPIO_POSIX | H5_VFD_MPIO_INDEPENDENT | H5_VFD_CORE); props->flags |= H5_VFD_MPIO_COLLECTIVE; props->comm = *comm; + if (props->throttle > 0) { + h5_warn ("Throttling is not permitted with collective VFD. Reset throttling."); + props->throttle = 0; + } + H5_CORE_API_RETURN (H5_SUCCESS); } @@ -216,6 +221,7 @@ h5_set_prop_file_mpio_independent ( H5_CORE_API_RETURN (H5_SUCCESS); } +#if H5_VERSION_LE(1,8,12) h5_err_t h5_set_prop_file_mpio_posix ( h5_prop_t _props, @@ -236,6 +242,7 @@ h5_set_prop_file_mpio_posix ( props->comm = *comm; H5_CORE_API_RETURN (H5_SUCCESS); } +#endif h5_err_t h5_set_prop_file_core_vfd ( @@ -254,6 +261,10 @@ h5_set_prop_file_core_vfd ( props->flags &= ~(H5_VFD_MPIO_COLLECTIVE | H5_VFD_MPIO_INDEPENDENT | H5_VFD_MPIO_POSIX); props->flags |= H5_VFD_MPIO_INDEPENDENT; props->comm = MPI_COMM_SELF; + if (props->throttle > 0) { + h5_warn ("Throttling us not permitted with core VFD. Reset throttling."); + props->throttle = 0; + } H5_CORE_API_RETURN (H5_SUCCESS); } @@ -290,12 +301,30 @@ h5_set_prop_file_throttle ( "props=%p, throttle=%lld", props, (long long int)throttle); if (props->class != H5_PROP_FILE) { - H5_INLINE_FUNC_LEAVE ( + H5_CORE_API_LEAVE ( h5_error ( H5_ERR_INVAL, "Invalid property class: %lld", (long long int)props->class)); } + // throttle only if VFD is MPIO independent od POSIX + h5_int64_t mask = H5_VFD_MPIO_INDEPENDENT; +#if H5_VERSION_LE(1,8,12) + mask |= H5_VFD_MPIO_POSIX; +#endif + if (! (props->flags & mask)) { +#if H5_VERSION_LE(1,8,12) + h5_warn ( + "Throttling is only permitted with the MPI-POSIX " + "or MPI-IO Independent VFD. Property ignored." ); +#else + h5_warn ( + "Throttling is only permitted with " + "the MPI-IO Independent VFD. Property ignored."); +#endif + props->throttle = 0; + } + props->throttle = throttle; H5_CORE_API_RETURN (H5_SUCCESS); } diff --git a/src/include/h5core/h5.h b/src/include/h5core/h5.h index 7415751..601650c 100644 --- a/src/include/h5core/h5.h +++ b/src/include/h5core/h5.h @@ -130,12 +130,6 @@ h5_err_t h5_traverse_steps ( const h5_file_t); -h5_err_t -h5_set_throttle ( - h5_file_t f, - int factor - ); - #ifdef __cplusplus } #endif