diff options
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); } |