From 534e535823f0bbe584f353421bf53f0153882377 Mon Sep 17 00:00:00 2001 From: "M. Scot Breitenfeld" Date: Fri, 11 Jan 2019 09:27:17 -0600 Subject: misc. merge clean-up --- src/H5CXprivate.h | 1 - src/H5Dmpio.c | 7 ----- src/H5FDmpio.c | 79 ++++++++++++++++++++++++++++--------------------------- 3 files changed, 40 insertions(+), 47 deletions(-) diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index 6b8e3b2..a091292 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -128,7 +128,6 @@ 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 20b2066..7352375 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -82,11 +82,6 @@ /* Macros to represent the regularity of the selection for multiple chunk IO case. */ #define H5D_CHUNK_SELECT_REG 1 -/* Macros for reasons to not enable read-proc-and-bcast. */ -#define H5D_MPIO_PROC0_BCAST 0x00 -#define H5D_MPIO_NOT_H5S_ALL 0x01 -#define H5D_MPIO_GREATER_THAN_2GB 0x02 - /******************/ /* Local Typedefs */ /******************/ @@ -299,7 +294,6 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */ htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */ 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 @@ -419,7 +413,6 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space, */ if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm))) HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code) - } /* end else */ /* Set the local & global values of no-collective-cause in the API context */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 689f43c..c6bc8e4 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1414,33 +1414,35 @@ static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/) { - H5FD_mpio_t *file = (H5FD_mpio_t*)_file; - MPI_Offset mpi_off; - MPI_Status mpi_stat; /* Status from I/O operation */ - int mpi_code; /* mpi return code */ - MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ - int size_i; /* Integer copy of 'size' to read */ + H5FD_mpio_t *file = (H5FD_mpio_t*)_file; + MPI_Offset mpi_off; + MPI_Status mpi_stat; /* Status from I/O operation */ + int mpi_code; /* mpi return code */ + MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */ + int size_i; /* Integer copy of 'size' to read */ #if MPI_VERSION >= 3 - MPI_Count bytes_read = 0; /* Number of bytes read in */ - MPI_Count type_size; /* MPI datatype used for I/O's size */ - MPI_Count io_size; /* Actual number of bytes requested */ - MPI_Count n; + MPI_Count bytes_read = 0; /* Number of bytes read in */ + MPI_Count type_size; /* MPI datatype used for I/O's size */ + MPI_Count io_size; /* Actual number of bytes requested */ + MPI_Count n; #else - int bytes_read = 0; /* Number of bytes read in */ - int type_size; /* MPI datatype used for I/O's size */ - int io_size; /* Actual number of bytes requested */ - int n; + int bytes_read = 0; /* Number of bytes read in */ + int type_size; /* MPI datatype used for I/O's size */ + int io_size; /* Actual number of bytes requested */ + int n; #endif hbool_t use_view_this_time = FALSE; hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Entering H5FD_mpio_read\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Entering\n", FUNC); #endif + + /* Sanity checks */ HDassert(file); HDassert(H5FD_MPIO==file->pub.driver_id); HDassert(buf); @@ -1449,16 +1451,15 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, HDmemset(&mpi_stat,0,sizeof(MPI_Status)); /* some numeric conversions */ - if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0) + if(H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off") size_i = (int)size; - if ((hsize_t)size_i != size) + if((hsize_t)size_i != size) HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i") #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'r']) - fprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n", - (long)mpi_off, size_i ); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i); #endif /* Only look for MPI views for raw data transfers */ @@ -1475,7 +1476,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which * could mean "use MPI_BYTE" by convention). */ - if(xfer_mode==H5FD_MPIO_COLLECTIVE) { + if(xfer_mode == H5FD_MPIO_COLLECTIVE) { MPI_Datatype file_type; /* Remember that views are used */ @@ -1503,8 +1504,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, H5FD_mpio_collective_opt_t coll_opt_mode; #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if(H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1512,8 +1513,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: doing MPI collective IO\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if(H5CX_get_mpio_rank0_bcast()) { @@ -1537,8 +1538,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, } /* end if */ else { #ifdef H5FDmpio_DEBUG - if(H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "H5FD_mpio_read: doing MPI independent IO\n"); + if(H5FD_mpio_Debug[(int)'r']) + HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC); #endif if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) @@ -1550,10 +1551,10 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, */ if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - } else { + } /* end if */ + else if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) - } + HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code) /* Only retrieve bytes read if this rank _actually_ participated in I/O */ if(!rank0_bcast || (rank0_bcast && file->mpi_rank == 0) ) { @@ -1582,25 +1583,25 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, #else if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size))) #endif - HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code) /* Compute the actual number of bytes requested */ - io_size=type_size*size_i; + io_size = type_size * size_i; /* Check for read failure */ - if (bytes_read<0 || bytes_read>io_size) + if(bytes_read < 0 || bytes_read > io_size) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") /* * This gives us zeroes beyond end of physical MPI file. */ - if ((n=(io_size-bytes_read)) > 0) - HDmemset((char*)buf+bytes_read, 0, (size_t)n); + if((n = (io_size - bytes_read)) > 0) + HDmemset((char*)buf+bytes_read, 0, (size_t)n); done: #ifdef H5FDmpio_DEBUG - if (H5FD_mpio_Debug[(int)'t']) - fprintf(stdout, "Leaving H5FD_mpio_read\n" ); + if(H5FD_mpio_Debug[(int)'t']) + HDfprintf(stdout, "%s: Leaving\n", FUNC); #endif FUNC_LEAVE_NOAPI(ret_value) -- cgit v0.12