Skip to content

Commit

Permalink
response to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Dec 12, 2017
1 parent 1007a7a commit 0f241db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/clib/pio_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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. */
Expand Down
4 changes: 2 additions & 2 deletions src/clib/pio_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down Expand Up @@ -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__);
Expand Down

0 comments on commit 0f241db

Please sign in to comment.