From 0f241db88cfee1912a2769a052dba0d2d79f83d5 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Tue, 12 Dec 2017 14:22:54 -0700 Subject: [PATCH] response to comments --- src/clib/pio_darray.c | 12 ++++++------ src/clib/pio_msg.c | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/clib/pio_darray.c b/src/clib/pio_darray.c index a07b2a26ae2..4f205cede7a 100644 --- a/src/clib/pio_darray.c +++ b/src/clib/pio_darray.c @@ -561,12 +561,6 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * } LOG((2, "wmb->num_arrays = %d arraylen = %d vdesc->mpi_type_size = %d\n", wmb->num_arrays, arraylen, vdesc->mpi_type_size)); - /* the limit of data_size < INT_MAX is due to a bug in ROMIO which limits - the size of contiguous data to INT_MAX, a fix has been proposed in - https://github.com/pmodels/mpich/pull/2888 */ - io_data_size = (1 + wmb->num_arrays) * iodesc->maxiobuflen * vdesc->mpi_type_size; - if(io_data_size > INT_MAX) - needsflush = 2; #if PIO_USE_MALLOC /* Try realloc first and call flush if realloc fails. */ if (arraylen > 0) @@ -594,6 +588,12 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * if (needsflush == 0) needsflush = (maxfree <= 1.1 * (1 + wmb->num_arrays) * arraylen * vdesc->mpi_type_size); #endif + /* the limit of data_size < INT_MAX is due to a bug in ROMIO which limits + the size of contiguous data to INT_MAX, a fix has been proposed in + https://github.com/pmodels/mpich/pull/2888 */ + io_data_size = (1 + wmb->num_arrays) * iodesc->maxiobuflen * vdesc->mpi_type_size; + if(io_data_size > INT_MAX) + needsflush = 2; /* Tell all tasks on the computation communicator whether we need * to flush data. */ diff --git a/src/clib/pio_msg.c b/src/clib/pio_msg.c index d0bf01d8ef3..eb5e09d9827 100644 --- a/src/clib/pio_msg.c +++ b/src/clib/pio_msg.c @@ -1095,7 +1095,7 @@ int inq_var_chunking_handler(iosystem_desc_t *ios) if (storage_present) storagep = &storage; if (chunksizes_present) - if (!(chunksizesp = malloc(ndims))) + if (!(chunksizesp = malloc(ndims *sizeof(PIO_Offset)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); /* Call the inq function to get the values. */ @@ -1521,7 +1521,7 @@ int def_var_chunking_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(&chunksizes_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__); if (chunksizes_present){ - if (!(chunksizesp = malloc(ndims))) + if (!(chunksizesp = malloc(ndims* sizeof(PIO_Offset)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(chunksizesp, ndims, MPI_OFFSET, 0, ios->intercomm))) return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);