diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2022-05-01 20:54:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-01 20:54:41 (GMT) |
commit | 2ba7a01bfff451b043e2ec00811c0aad78921545 (patch) | |
tree | 31dc785e35a95578ea9fbb491fbc931e62234302 /testpar/t_mpi.c | |
parent | 5eba258d90aa89c3d1d58f1b5ef93c1cf9821c29 (diff) | |
download | hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.zip hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.gz hdf5-2ba7a01bfff451b043e2ec00811c0aad78921545.tar.bz2 |
Fix some const cast and stack/static object size warnings (#1700)
* Fix various warnings
* Move HDfree_const to H5private.h for wider use
* Print output from all ranks in parallel tests on allocation failure
* Move const pointer freeing macro to h5test.h for now
Diffstat (limited to 'testpar/t_mpi.c')
-rw-r--r-- | testpar/t_mpi.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c index 39d7722..47cb6af 100644 --- a/testpar/t_mpi.c +++ b/testpar/t_mpi.c @@ -41,18 +41,18 @@ static int errors_sum(int nerrs); static int test_mpio_overlap_writes(char *filename) { - int mpi_size, mpi_rank; - MPI_Comm comm; - MPI_Info info = MPI_INFO_NULL; - int color, mrc; - MPI_File fh; - int i; - int vrfyerrs, nerrs; - unsigned char buf[4093]; /* use some prime number for size */ - int bufsize = sizeof(buf); - MPI_Offset stride; - MPI_Offset mpi_off; - MPI_Status mpi_stat; + int mpi_size, mpi_rank; + MPI_Comm comm; + MPI_Info info = MPI_INFO_NULL; + int color, mrc; + MPI_File fh; + int i; + int vrfyerrs, nerrs; + unsigned char *buf = NULL; + int bufsize; + MPI_Offset stride; + MPI_Offset mpi_off; + MPI_Status mpi_stat; if (VERBOSE_MED) HDprintf("MPIO independent overlapping writes test on file %s\n", filename); @@ -70,6 +70,13 @@ test_mpio_overlap_writes(char *filename) return 0; } + bufsize = 4093; /* use some prime number for size */ + if (NULL == (buf = HDmalloc((size_t)bufsize))) { + if (MAINPROCESS) + HDprintf("couldn't allocate buffer\n"); + return 1; + } + /* splits processes 0 to n-2 into one comm. and the last one into another */ color = ((mpi_rank < (mpi_size - 1)) ? 0 : 1); mrc = MPI_Comm_split(MPI_COMM_WORLD, color, mpi_rank, &comm); @@ -159,6 +166,9 @@ test_mpio_overlap_writes(char *filename) */ mrc = MPI_Barrier(MPI_COMM_WORLD); VRFY((mrc == MPI_SUCCESS), "Sync before leaving test"); + + HDfree(buf); + return (nerrs); } |