From 03ed7a3d790c2add2dccc15300005c1aec0f4f6f Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 29 Jun 2022 13:02:38 -0700 Subject: Fixes a few minor parallel warnings (#1832) --- src/H5Dmpio.c | 17 ++++++++++++++++- testpar/t_prop.c | 12 ++++++++++-- tools/src/h5perf/perf.c | 13 +++++-------- tools/src/h5perf/pio_engine.c | 9 ++++++--- 4 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 0620459..655d475 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -4068,10 +4068,18 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk else { int all_sends_completed; - /* Determine if all send requests have completed */ + /* Determine if all send requests have completed + * + * gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 + */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Testall((int)num_send_requests, send_requests, &all_sends_completed, MPI_STATUSES_IGNORE))) HMPI_GOTO_ERROR(FAIL, "MPI_Testall failed", mpi_code) + H5_GCC_DIAG_ON("stringop-overflow") if (all_sends_completed) { /* Post non-blocking barrier */ @@ -4105,9 +4113,16 @@ H5D__mpio_share_chunk_modification_data(H5D_filtered_collective_io_info_t *chunk * in the order that chunks are processed. So, the safest way to * support both I/O modes is to simply make sure all messages * are available. + * + * gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 */ + H5_GCC_DIAG_OFF("stringop-overflow") if (MPI_SUCCESS != (mpi_code = MPI_Waitall((int)num_recv_requests, recv_requests, MPI_STATUSES_IGNORE))) HMPI_GOTO_ERROR(FAIL, "MPI_Waitall failed", mpi_code) + H5_GCC_DIAG_ON("stringop-overflow") /* Set the new number of locally-selected chunks */ *chunk_list_num_entries = last_assigned_idx; diff --git a/testpar/t_prop.c b/testpar/t_prop.c index 930b895..c08a022 100644 --- a/testpar/t_prop.c +++ b/testpar/t_prop.c @@ -69,14 +69,22 @@ test_encode_decode(hid_t orig_pl, int mpi_rank, int recv_proc) HDfree(rbuf); } /* end if */ - if (0 == mpi_rank) + if (0 == mpi_rank) { + /* gcc 11 complains about passing MPI_STATUSES_IGNORE as an MPI_Status + * array. See the discussion here: + * + * https://github.com/pmodels/mpich/issues/5687 + */ + H5_GCC_DIAG_OFF("stringop-overflow") MPI_Waitall(2, req, MPI_STATUSES_IGNORE); + H5_GCC_DIAG_ON("stringop-overflow") + } if (NULL != sbuf) HDfree(sbuf); MPI_Barrier(MPI_COMM_WORLD); - return (0); + return 0; } void diff --git a/tools/src/h5perf/perf.c b/tools/src/h5perf/perf.c index 84be7e8..270af57 100644 --- a/tools/src/h5perf/perf.c +++ b/tools/src/h5perf/perf.c @@ -457,7 +457,7 @@ parse_args(int argc, char **argv) } } - return (0); + return 0; } /*------------------------------------------------------------------------- * Function: getenv_all @@ -478,14 +478,9 @@ parse_args(int argc, char **argv) * Programmer: Leon Arber * 4/4/05 * - * Modifications: - * Use original getenv if MPI is not initialized. This happens - * one uses the PHDF5 library to build a serial nature code. - * Albert 2006/04/07 - * *------------------------------------------------------------------------- */ -char * +static char * getenv_all(MPI_Comm comm, int root, const char *name) { int mpi_size, mpi_rank, mpi_initialized, mpi_finalized; @@ -539,7 +534,9 @@ getenv_all(MPI_Comm comm, int root, const char *name) #endif } else { - /* use original getenv */ + /* Use the original getenv if MPI is not initialized. This happens + * if you use the parallel HDF5 library to build a serial program. + */ if (env) HDfree(env); env = HDgetenv(name); diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 9d08938..d50e783 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -146,7 +146,7 @@ do_pio(parameters param) file_descr fd; iotype iot; - char fname[FILENAME_MAX]; + char *fname = NULL; long nf; long ndsets; off_t nbytes; /*number of bytes per dataset */ @@ -168,6 +168,9 @@ do_pio(parameters param) /* IO type */ iot = param.io_type; + if (NULL == (fname = HDcalloc(FILENAME_MAX, sizeof(char)))) + GOTOERROR(FAIL); + switch (iot) { case MPIO: fd.mpifd = MPI_FILE_NULL; @@ -365,8 +368,8 @@ done: } /* release generic resources */ - if (buffer) - HDfree(buffer); + HDfree(buffer); + HDfree(fname); res.ret_code = ret_code; return res; } -- cgit v0.12