summaryrefslogtreecommitdiffstats
path: root/testpar/t_mpi.c
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-06-24 03:16:21 (GMT)
committerGitHub <noreply@github.com>2022-06-24 03:16:21 (GMT)
commitac7bddf2af317d4bc34854f5565396da51ff12aa (patch)
treef06f4267731f53e29da848d7d043950ec023f0b3 /testpar/t_mpi.c
parent50b3fb09a79cf94064d09087df6c44e680adc3a8 (diff)
downloadhdf5-ac7bddf2af317d4bc34854f5565396da51ff12aa.zip
hdf5-ac7bddf2af317d4bc34854f5565396da51ff12aa.tar.gz
hdf5-ac7bddf2af317d4bc34854f5565396da51ff12aa.tar.bz2
VFD SWMR: sync with develop (#1825)
* bin directory sync * doxygen changes * C++ sync with develop * Fortran sync with develop * Sync various docs with develop * Java sync with develop * More doxygen sync with develop * tools sync with develop * h5test.h testing macros get enclosed in do..while loops (#1721) * Minor examples normalization with develop * hl sync with develop * sprintf to snprintf (#1815) * Misc sync w/ develop * Brings some selection I/O bits over from develop * Brings over some const fixes from develop * Brings over more const bits from develop * Minor bits missed in early syncs * Brings over rest of selection I/O * Sync of mirror VFD changes w/ develop * Committing clang-format changes * Adds missing testpar file Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'testpar/t_mpi.c')
-rw-r--r--testpar/t_mpi.c34
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);
}