Skip to content

Commit

Permalink
merged master
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed May 16, 2019
2 parents dd4fbbb + 2c5ef5a commit 3cb4c6b
Show file tree
Hide file tree
Showing 16 changed files with 629 additions and 660 deletions.
8 changes: 4 additions & 4 deletions src/clib/pio_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,13 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars,

/* Handle MPI errors. */
if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm)))
return check_mpi(file, mpierr2, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr2, __FILE__, __LINE__);
if (mpierr)
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);

/* Share results known only on computation tasks with IO tasks. */
if ((mpierr = MPI_Bcast(&fndims, 1, MPI_INT, ios->comproot, ios->my_comm)))
check_mpi(file, mpierr, __FILE__, __LINE__);
check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "shared fndims = %d", fndims));
}

Expand Down Expand Up @@ -738,7 +738,7 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *
* to flush data. */
if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &needsflush, 1, MPI_INT, MPI_MAX,
ios->comp_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((2, "needsflush = %d", needsflush));

/* Flush data if needed. */
Expand Down
74 changes: 37 additions & 37 deletions src/clib/pio_darray_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,10 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi
if((mpierr = MPI_Type_create_subarray(sa_ndims, gdims,
sacount, sastart,MPI_ORDER_C
,iodesc->mpitype, subarray + true_rrcnt)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

if((mpierr = MPI_Type_commit(subarray + true_rrcnt)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
}

#if PIO_ENABLE_LOGGING
Expand All @@ -247,15 +247,15 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi

/* concatenate all MPI datatypes into filetype */
if((mpierr = MPI_Type_create_struct(true_rrcnt, blocklengths, displacements, subarray, filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

if((mpierr = MPI_Type_commit(filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

for( int rc=0; rc<true_rrcnt; rc++)
if (subarray[rc] != MPI_DATATYPE_NULL && subarray[rc] != iodesc->mpitype &&
(mpierr = MPI_Type_free(subarray + rc)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

return PIO_NOERR;
}
Expand Down Expand Up @@ -593,19 +593,19 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
if (j > 0) { /* at least one vartypes[] is not NULL */
/* concatenate non-NULL vartypes */
if((mpierr = MPI_Type_create_struct(j, blocklens, var_offsets, vartypes, &filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

if((mpierr = MPI_Type_commit(&filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

/* free vartypes */
for (i=j-1; i>0; i--) {
if (vartypes[i] == vartypes[i-1]) continue;
if((mpierr = MPI_Type_free(&vartypes[i])))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
}
if((mpierr = MPI_Type_free(&vartypes[0])))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
}
else /* all vartypes[] are NULL */
filetype = MPI_DATATYPE_NULL;
Expand All @@ -619,7 +619,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
if(filetype != MPI_DATATYPE_NULL)
{
if((mpierr = MPI_Type_free(&filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
}
vard_llen = 0; /* reset request size to 0 */
numReqs = 0;
Expand Down Expand Up @@ -785,12 +785,12 @@ int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset lle

/* Do a handshake. */
if ((mpierr = MPI_Recv(&ierr, 1, MPI_INT, 0, 0, ios->io_comm, &status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);

/* Send local length of iobuffer for each field (all
* fields are the same length). */
if ((mpierr = MPI_Send((void *)&llen, 1, MPI_OFFSET, 0, ios->io_rank, ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "sent llen = %d", llen));

/* Send the number of data regions, the start/count for
Expand All @@ -799,16 +799,16 @@ int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset lle
{
if ((mpierr = MPI_Send((void *)&maxregions, 1, MPI_INT, 0, ios->io_rank + ios->num_iotasks,
ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Send(tmp_start, maxregions * fndims, MPI_OFFSET, 0,
ios->io_rank + 2 * ios->num_iotasks, ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Send(tmp_count, maxregions * fndims, MPI_OFFSET, 0,
ios->io_rank + 3 * ios->num_iotasks, ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Send(iobuf, nvars * llen, iodesc->mpitype, 0,
ios->io_rank + 4 * ios->num_iotasks, ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "sent data for maxregions = %d", maxregions));
}

Expand Down Expand Up @@ -885,13 +885,13 @@ int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame,
{
/* handshake - tell the sending task I'm ready */
if ((mpierr = MPI_Send(&ierr, 1, MPI_INT, rtask, 0, ios->io_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);

/* Get length of iobuffer for each field on this
* task (all fields are the same length). */
if ((mpierr = MPI_Recv(&rlen, 1, MPI_OFFSET, rtask, rtask, ios->io_comm,
&status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "received rlen = %d", rlen));

/* Get the number of regions, the start/count
Expand All @@ -900,16 +900,16 @@ int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame,
{
if ((mpierr = MPI_Recv(&rregions, 1, MPI_INT, rtask, rtask + ios->num_iotasks,
ios->io_comm, &status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Recv(tmp_start, rregions * fndims, MPI_OFFSET, rtask,
rtask + 2 * ios->num_iotasks, ios->io_comm, &status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Recv(tmp_count, rregions * fndims, MPI_OFFSET, rtask,
rtask + 3 * ios->num_iotasks, ios->io_comm, &status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Recv(iobuf, nvars * rlen, iodesc->mpitype, rtask,
rtask + 4 * ios->num_iotasks, ios->io_comm, &status)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "received data rregions = %d fndims = %d", rregions, fndims));
}
}
Expand Down Expand Up @@ -1314,7 +1314,7 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu
vdesc->record, startlist, countlist, &filetype);
ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype);
if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);

#else
/* Read a list of subarrays. */
Expand Down Expand Up @@ -1497,25 +1497,25 @@ int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid,
if (ios->io_rank > 0)
{
if ((mpierr = MPI_Send(&iodesc->llen, 1, MPI_OFFSET, 0, ios->io_rank, ios->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "sent iodesc->llen = %d", iodesc->llen));

if (iodesc->llen > 0)
{
if ((mpierr = MPI_Send(&(iodesc->maxregions), 1, MPI_INT, 0,
ios->num_iotasks + ios->io_rank, ios->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Send(tmp_count, iodesc->maxregions * fndims, MPI_OFFSET, 0,
2 * ios->num_iotasks + ios->io_rank, ios->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Send(tmp_start, iodesc->maxregions * fndims, MPI_OFFSET, 0,
3 * ios->num_iotasks + ios->io_rank, ios->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "sent iodesc->maxregions = %d tmp_count and tmp_start arrays", iodesc->maxregions));

if ((mpierr = MPI_Recv(iobuf, iodesc->llen, iodesc->mpitype, 0,
4 * ios->num_iotasks + ios->io_rank, ios->io_comm, &status)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "received %d elements of data", iodesc->llen));
}
}
Expand All @@ -1533,20 +1533,20 @@ int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid,
if (rtask < ios->num_iotasks)
{
if ((mpierr = MPI_Recv(&tmp_bufsize, 1, MPI_OFFSET, rtask, rtask, ios->io_comm, &status)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "received tmp_bufsize = %d", tmp_bufsize));

if (tmp_bufsize > 0)
{
if ((mpierr = MPI_Recv(&maxregions, 1, MPI_INT, rtask, ios->num_iotasks + rtask,
ios->io_comm, &status)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Recv(this_count, maxregions * fndims, MPI_OFFSET, rtask,
2 * ios->num_iotasks + rtask, ios->io_comm, &status)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Recv(this_start, maxregions * fndims, MPI_OFFSET, rtask,
3 * ios->num_iotasks + rtask, ios->io_comm, &status)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
LOG((3, "received maxregions = %d this_count, this_start arrays ", maxregions));
}
}
Expand Down Expand Up @@ -1644,7 +1644,7 @@ int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid,
if (rtask < ios->num_iotasks && tmp_bufsize > 0)
if ((mpierr = MPI_Send(iobuf, tmp_bufsize, iodesc->mpitype, rtask,
4 * ios->num_iotasks + rtask, ios->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
}
}
}
Expand Down Expand Up @@ -1694,7 +1694,7 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize)
usage += addsize;
if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &usage, 1, MPI_OFFSET, MPI_MAX,
file->iosystem->io_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
}

/* Keep track of the maximum usage. */
Expand Down Expand Up @@ -1806,10 +1806,10 @@ void cn_buffer_report(iosystem_desc_t *ios, bool collective)
{
LOG((3, "cn_buffer_report calling MPI_Reduce ios->comp_comm = %d", ios->comp_comm));
if ((mpierr = MPI_Reduce(bget_stats, bget_maxs, 5, MPI_LONG, MPI_MAX, 0, ios->comp_comm)))
check_mpi(NULL, mpierr, __FILE__, __LINE__);
check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "cn_buffer_report calling MPI_Reduce"));
if ((mpierr = MPI_Reduce(bget_stats, bget_mins, 5, MPI_LONG, MPI_MIN, 0, ios->comp_comm)))
check_mpi(NULL, mpierr, __FILE__, __LINE__);
check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
if (ios->compmaster == MPI_ROOT)
{
LOG((1, "Currently allocated buffer space %ld %ld", bget_mins[0], bget_maxs[0]));
Expand Down Expand Up @@ -2193,7 +2193,7 @@ int compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc)
LOG((3, "before allreaduce maxbytes = %d", maxbytes));
if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &maxbytes, 1, MPI_INT, MPI_MIN,
ios->union_comm)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "after allreaduce maxbytes = %d", maxbytes));

/* Remember the result. */
Expand Down
18 changes: 9 additions & 9 deletions src/clib/pio_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ int PIOc_closefile(int ncid)

/* Handle MPI errors. */
if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm)))
return check_mpi(file, mpierr2, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr2, __FILE__, __LINE__);
if (mpierr)
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
}

/* If this is an IO task, then call the netCDF function. */
Expand Down Expand Up @@ -269,7 +269,7 @@ int PIOc_closefile(int ncid)

/* Broadcast and check the return code. */
if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if (ierr)
return check_netcdf(file, ierr, __FILE__, __LINE__);

Expand Down Expand Up @@ -321,9 +321,9 @@ int PIOc_deletefile(int iosysid, const char *filename)

/* Handle MPI errors. */
if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm)))
return check_mpi2(ios, NULL, mpierr2, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr2, __FILE__, __LINE__);
if (mpierr)
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
LOG((3, "done hanlding errors mpierr = %d", mpierr));
}

Expand All @@ -345,7 +345,7 @@ int PIOc_deletefile(int iosysid, const char *filename)

/* Broadcast and check the return code. */
if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi2(ios, NULL, mpierr2, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr2, __FILE__, __LINE__);
if (ierr)
return check_netcdf2(ios, NULL, ierr, __FILE__, __LINE__);

Expand Down Expand Up @@ -416,9 +416,9 @@ int PIOc_sync(int ncid)

/* Handle MPI errors. */
if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm)))
check_mpi(file, mpierr2, __FILE__, __LINE__);
check_mpi(NULL, file, mpierr2, __FILE__, __LINE__);
if (mpierr)
return check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
}

/* Call the sync function on IO tasks. */
Expand Down Expand Up @@ -452,7 +452,7 @@ int PIOc_sync(int ncid)

/* Broadcast and check the return code. */
if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__);
if (ierr)
return check_netcdf2(ios, NULL, ierr, __FILE__, __LINE__);

Expand Down
Loading

0 comments on commit 3cb4c6b

Please sign in to comment.