diff --git a/src/clib/bget.c b/src/clib/bget.c index 98bfc36893d..d6e8b7bbbbb 100644 --- a/src/clib/bget.c +++ b/src/clib/bget.c @@ -564,12 +564,12 @@ static bufsize pool_len = 0; /* 0: no bpool calls have been made /* added for PIO so that a bpool can be freed and another allocated */ void bpoolrelease() { - LOG((2, "bpoolrelease")); + PLOG((2, "bpoolrelease")); freelist.bh.prevfree=0; freelist.bh.bsize=0; freelist.ql.flink=&freelist; freelist.ql.blink=&freelist; - LOG((2, "bpoolrelease")); + PLOG((2, "bpoolrelease")); #ifdef BufStats totalloc = 0; /* Total space currently allocated */ @@ -583,7 +583,7 @@ void bpoolrelease() numdrel = 0; /* Number of direct gets and rels */ #endif /* BECtl */ #endif /* BufStats */ - LOG((2, "bpoolrelease")); + PLOG((2, "bpoolrelease")); #ifdef BECtl /* Automatic expansion block management functions */ @@ -593,7 +593,7 @@ void bpoolrelease() exp_incr = 0; pool_len = 0; #endif - LOG((2, "bpoolrelease")); + PLOG((2, "bpoolrelease")); } diff --git a/src/clib/pio_darray.c b/src/clib/pio_darray.c index 7e939c1f222..9d752c1ee96 100644 --- a/src/clib/pio_darray.c +++ b/src/clib/pio_darray.c @@ -147,9 +147,9 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, if (nvars <= 0 || !varids) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_write_darray_multi ncid = %d ioid = %d nvars = %d arraylen = %ld " - "flushtodisk = %d", - ncid, ioid, nvars, arraylen, flushtodisk)); + PLOG((1, "PIOc_write_darray_multi ncid = %d ioid = %d nvars = %d arraylen = %ld " + "flushtodisk = %d", + ncid, ioid, nvars, arraylen, flushtodisk)); /* Check that we can write to this file. */ if (!file->writable) @@ -181,10 +181,10 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, if (!ios->async || !ios->ioproc) { /* Get the number of dims for this var. */ - LOG((3, "about to call PIOc_inq_varndims varids[0] = %d", varids[0])); + PLOG((3, "about to call PIOc_inq_varndims varids[0] = %d", varids[0])); if ((ierr = PIOc_inq_varndims(file->pio_ncid, varids[0], &fndims))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3, "called PIOc_inq_varndims varids[0] = %d fndims = %d", varids[0], fndims)); + PLOG((3, "called PIOc_inq_varndims varids[0] = %d fndims = %d", varids[0], fndims)); for (int v=1; v < nvars; v++){ if ((ierr = PIOc_inq_varndims(file->pio_ncid, varids[v], &fndims2))) return check_netcdf(file, ierr, __FILE__, __LINE__); @@ -234,9 +234,9 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&flushtodisk_int, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_write_darray_multi file->pio_ncid = %d nvars = %d ioid = %d arraylen = %d " - "frame_present = %d fillvalue_present = %d flushtodisk = %d", file->pio_ncid, nvars, - ioid, arraylen, frame_present, fillvalue_present, flushtodisk)); + PLOG((2, "PIOc_write_darray_multi file->pio_ncid = %d nvars = %d ioid = %d arraylen = %d " + "frame_present = %d fillvalue_present = %d flushtodisk = %d", file->pio_ncid, nvars, + ioid, arraylen, frame_present, fillvalue_present, flushtodisk)); } /* Handle MPI errors. */ @@ -248,7 +248,7 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, /* 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(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "shared fndims = %d", fndims)); + PLOG((3, "shared fndims = %d", fndims)); } /* if the buffer is already in use in pnetcdf we need to flush first */ @@ -274,13 +274,13 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, /* Allocate memory for the buffer for all vars/records. */ if (!(file->iobuf = bget(iodesc->mpitype_size * (size_t)rlen))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); - LOG((3, "allocated %lld bytes for variable buffer", (size_t)rlen * iodesc->mpitype_size)); + PLOG((3, "allocated %lld bytes for variable buffer", (size_t)rlen * iodesc->mpitype_size)); /* If fill values are desired, and we're using the BOX * rearranger, insert fill values. */ if (iodesc->needsfill && iodesc->rearranger == PIO_REARR_BOX && fillvalue) { - LOG((3, "inerting fill values iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); + PLOG((3, "inerting fill values iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); for (int nv = 0; nv < nvars; nv++) for (int i = 0; i < iodesc->maxiobuflen; i++) memcpy(&((char *)file->iobuf)[iodesc->mpitype_size * (i + nv * iodesc->maxiobuflen)], @@ -294,7 +294,7 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, collectively (from all iotasks) */ if (!(file->iobuf = bget(1))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); - LOG((3, "allocated token for variable buffer")); + PLOG((3, "allocated token for variable buffer")); } if (iodesc->needssort) { @@ -312,7 +312,7 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, return pio_err(ios, file, ierr, __FILE__, __LINE__); /* Write the darray based on the iotype. */ - LOG((2, "about to write darray for iotype = %d", file->iotype)); + PLOG((2, "about to write darray for iotype = %d", file->iotype)); switch (file->iotype) { case PIO_IOTYPE_NETCDF4P: @@ -338,7 +338,7 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, /* Release resources. */ if (file->iobuf) { - LOG((3,"freeing variable buffer in pio_darray")); + PLOG((3,"freeing variable buffer in pio_darray")); brel(file->iobuf); file->iobuf = NULL; } @@ -356,8 +356,8 @@ PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, * those values later. */ if (iodesc->rearranger == PIO_REARR_SUBSET && iodesc->needsfill) { - LOG((2, "nvars = %d holegridsize = %ld iodesc->needsfill = %d\n", nvars, - iodesc->holegridsize, iodesc->needsfill)); + PLOG((2, "nvars = %d holegridsize = %ld iodesc->needsfill = %d\n", nvars, + iodesc->holegridsize, iodesc->needsfill)); pioassert(!vdesc0->fillbuf, "buffer overwrite",__FILE__, __LINE__); @@ -457,13 +457,13 @@ pio_inq_var_fill_expected(int ncid, int varid, int pio_type, PIO_Offset type_siz /* Check inputs. */ assert(fillvalue); - LOG((2, "pio_inq_var_fill_expected ncid %d varid %d pio_type %d type_size %d", - ncid, varid, pio_type, type_size)); + PLOG((2, "pio_inq_var_fill_expected ncid %d varid %d pio_type %d type_size %d", + ncid, varid, pio_type, type_size)); /* Is there a _FillValue attribute? */ ret = PIOc_inq_att_eh(ncid, varid, "_FillValue", 0, NULL, NULL); - LOG((3, "pio_inq_var_fill_expected ret %d", ret)); + PLOG((3, "pio_inq_var_fill_expected ret %d", ret)); /* If there is a fill value, get it. */ if (!ret) @@ -551,7 +551,7 @@ find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) pioassert(file && file->iosystem && vdesc, "invalid input", __FILE__, __LINE__); ios = file->iosystem; - LOG((3, "find_var_fillvalue file->pio_ncid = %d varid = %d", file->pio_ncid, varid)); + PLOG((3, "find_var_fillvalue file->pio_ncid = %d varid = %d", file->pio_ncid, varid)); /* Find out PIO data type of var. */ if ((ierr = PIOc_inq_vartype(file->pio_ncid, varid, &pio_type))) @@ -560,8 +560,8 @@ find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) /* Find out length of type. */ if ((ierr = PIOc_inq_type(file->pio_ncid, pio_type, NULL, &type_size))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); - LOG((3, "getting fill value for varid = %d pio_type = %d type_size = %d", - varid, pio_type, type_size)); + PLOG((3, "getting fill value for varid = %d pio_type = %d type_size = %d", + varid, pio_type, type_size)); /* Allocate storage for the fill value. */ if (!(vdesc->fillvalue = malloc(type_size))) @@ -572,7 +572,7 @@ find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) if ((ierr = PIOc_inq_var_fill(file->pio_ncid, varid, &no_fill, vdesc->fillvalue))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); vdesc->use_fill = no_fill ? 0 : 1; - LOG((3, "vdesc->use_fill = %d", vdesc->use_fill)); + PLOG((3, "vdesc->use_fill = %d", vdesc->use_fill)); /* Get the fill value one would expect, if NOFILL were not turned * on. */ @@ -654,8 +654,8 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra int ierr = PIO_NOERR; /* Return code. */ size_t io_data_size; /* potential size of data on io task */ - LOG((1, "PIOc_write_darray ncid = %d varid = %d ioid = %d arraylen = %d", - ncid, varid, ioid, arraylen)); + PLOG((1, "PIOc_write_darray ncid = %d varid = %d ioid = %d arraylen = %d", + ncid, varid, ioid, arraylen)); #ifdef USE_MPE pio_start_mpe_log(DARRAY_WRITE); #endif /* USE_MPE */ @@ -679,9 +679,9 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra * excess values will be ignored.) */ if (arraylen < iodesc->ndof) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((2, "%s arraylen = %d iodesc->ndof = %d", - (iodesc->ndof != arraylen) ? "WARNING: iodesc->ndof != arraylen" : "", - arraylen, iodesc->ndof)); + PLOG((2, "%s arraylen = %d iodesc->ndof = %d", + (iodesc->ndof != arraylen) ? "WARNING: iodesc->ndof != arraylen" : "", + arraylen, iodesc->ndof)); /* Get var description. */ if ((ierr = get_var_desc(varid, &file->varlist, &vdesc))) @@ -710,7 +710,7 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra hashid = ioid*10 + vdesc->rec_var; HASH_FIND_INT( file->buffer, &hashid, wmb); if (wmb) - LOG((3, "wmb->ioid = %d wmb->recordvar = %d", wmb->ioid, wmb->recordvar)); + PLOG((3, "wmb->ioid = %d wmb->recordvar = %d", wmb->ioid, wmb->recordvar)); /* If we did not find an existing wmb entry, create a new wmb. */ if (!wmb) @@ -731,8 +731,8 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra wmb->htid = hashid; HASH_ADD_INT( file->buffer, htid, wmb ); } - LOG((2, "wmb->num_arrays = %d arraylen = %d iodesc->mpitype_size = %d\n", - wmb->num_arrays, arraylen, iodesc->mpitype_size)); + PLOG((2, "wmb->num_arrays = %d arraylen = %d iodesc->mpitype_size = %d\n", + wmb->num_arrays, arraylen, iodesc->mpitype_size)); #if PIO_USE_MALLOC /* Try realloc first and call flush if realloc fails. */ if (arraylen > 0) @@ -748,8 +748,8 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra { needsflush = 1; } - LOG((2, "realloc attempted to get %ld bytes for data, needsflush %d", data_size, - needsflush)); + PLOG((2, "realloc attempted to get %ld bytes for data, needsflush %d", data_size, + needsflush)); } #else /* Find out how much free, contiguous space is available. */ @@ -772,7 +772,7 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &needsflush, 1, MPI_INT, MPI_MAX, ios->comp_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "needsflush = %d", needsflush)); + PLOG((2, "needsflush = %d", needsflush)); /* Flush data if needed. */ if (needsflush > 0) @@ -781,9 +781,9 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra #ifdef PIO_ENABLE_LOGGING /* Collect a debug report about buffer. */ cn_buffer_report(ios, true); - LOG((2, "maxfree = %ld wmb->num_arrays = %d (1 + wmb->num_arrays) *" - " arraylen * iodesc->mpitype_size = %ld totfree = %ld\n", maxfree, wmb->num_arrays, - (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size, totfree)); + PLOG((2, "maxfree = %ld wmb->num_arrays = %d (1 + wmb->num_arrays) *" + " arraylen * iodesc->mpitype_size = %ld totfree = %ld\n", maxfree, wmb->num_arrays, + (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size, totfree)); #endif /* PIO_ENABLE_LOGGING */ #endif /* !PIO_USE_MALLOC */ @@ -800,7 +800,7 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra { if (!(wmb->data = realloc(wmb->data, (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); - LOG((2, "after a flush, realloc got %ld bytes for data", (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size)); + PLOG((2, "after a flush, realloc got %ld bytes for data", (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size)); } #else /* Get memory for data. */ @@ -808,7 +808,7 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra { if (!(wmb->data = bgetr(wmb->data, (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); - LOG((2, "got %ld bytes for data", (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size)); + PLOG((2, "got %ld bytes for data", (1 + wmb->num_arrays) * arraylen * iodesc->mpitype_size)); } #endif @@ -840,15 +840,15 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra /* Tell the buffer about the data it is getting. */ wmb->arraylen = arraylen; wmb->vid[wmb->num_arrays] = varid; - LOG((3, "wmb->num_arrays = %d wmb->vid[wmb->num_arrays] = %d", wmb->num_arrays, - wmb->vid[wmb->num_arrays])); + PLOG((3, "wmb->num_arrays = %d wmb->vid[wmb->num_arrays] = %d", wmb->num_arrays, + wmb->vid[wmb->num_arrays])); /* Copy the user-provided data to the buffer. */ bufptr = (void *)((char *)wmb->data + arraylen * iodesc->mpitype_size * wmb->num_arrays); if (arraylen > 0) { memcpy(bufptr, array, arraylen * iodesc->mpitype_size); - LOG((3, "copied %ld bytes of user data", arraylen * iodesc->mpitype_size)); + PLOG((3, "copied %ld bytes of user data", arraylen * iodesc->mpitype_size)); } /* Add the unlimited dimension value of this variable to the frame @@ -861,9 +861,9 @@ PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *arra pio_stop_mpe_log(DARRAY_WRITE, __func__); #endif /* USE_MPE */ - LOG((2, "wmb->num_arrays = %d iodesc->maxbytes / iodesc->mpitype_size = %d " - "iodesc->ndof = %d iodesc->llen = %d", wmb->num_arrays, - iodesc->maxbytes / iodesc->mpitype_size, iodesc->ndof, iodesc->llen)); + PLOG((2, "wmb->num_arrays = %d iodesc->maxbytes / iodesc->mpitype_size = %d " + "iodesc->ndof = %d iodesc->llen = %d", wmb->num_arrays, + iodesc->maxbytes / iodesc->mpitype_size, iodesc->ndof, iodesc->llen)); return PIO_NOERR; } diff --git a/src/clib/pio_darray_int.c b/src/clib/pio_darray_int.c index 58859bba432..c3116e5e0c4 100644 --- a/src/clib/pio_darray_int.c +++ b/src/clib/pio_darray_int.c @@ -75,7 +75,7 @@ compute_buffer_init(iosystem_desc_t *ios) bectl(NULL, malloc, bpool_free, pio_cnbuffer_limit); } #endif - LOG((2, "compute_buffer_init complete")); + PLOG((2, "compute_buffer_init complete")); return PIO_NOERR; } @@ -106,10 +106,10 @@ get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, /* We need to confirm the file has an unlimited dimension and if it doesn't we need to find the extent of the first variable dimension. */ - LOG((3,"look for numunlimdims")); + PLOG((3,"look for numunlimdims")); if ((ierr = PIOc_inq_unlimdims(file->pio_ncid, &numunlimdims, NULL))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3,"numunlimdims = %d", numunlimdims)); + PLOG((3,"numunlimdims = %d", numunlimdims)); if (numunlimdims <= 0) { int dimids[fndims]; @@ -119,7 +119,7 @@ get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, return check_netcdf(file, ierr, __FILE__, __LINE__); } } - LOG((3,"gdim0 = %d",*gdim0)); + PLOG((3,"gdim0 = %d",*gdim0)); return ierr; } @@ -250,8 +250,8 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi #if PIO_ENABLE_LOGGING for (int i=0; i< sa_ndims; i++) - LOG((3, "vard: sastart[%d]=%d sacount[%d]=%d gdims[%d]=%d %ld %ld displacement = %ld un %d", - i,sastart[i], i,sacount[i], i, gdims[i], startlist[rc][i], countlist[rc][i], displacements[rc], unlimdimoffset)); + PLOG((3, "vard: sastart[%d]=%d sacount[%d]=%d gdims[%d]=%d %ld %ld displacement = %ld un %d", + i,sastart[i], i,sacount[i], i, gdims[i], startlist[rc][i], countlist[rc][i], displacements[rc], unlimdimoffset)); #endif if (isContig) { /* this request rc is contiguous, no need to create a new MPI datatype */ if (prev_end == disp) { @@ -282,7 +282,7 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi } #if PIO_ENABLE_LOGGING - LOG((3,"vard: blocklengths[%d]=%d displacement[%d]=%ld unlimdimoffset=%ld",rc,blocklengths[rc], rc, displacements[rc], unlimdimoffset)); + PLOG((3,"vard: blocklengths[%d]=%d displacement[%d]=%ld unlimdimoffset=%ld",rc,blocklengths[rc], rc, displacements[rc], unlimdimoffset)); #endif } @@ -373,7 +373,7 @@ find_start_count(int ndims, int fndims, var_desc_t *vdesc, #if PIO_ENABLE_LOGGING /* Log arrays for debug purposes. */ for (int i = 0; i < ndims; i++) - LOG((3, "start[%d] = %d count[%d] = %d", i, start[i], i, count[i])); + PLOG((3, "start[%d] = %d count[%d] = %d", i, start[i], i, count[i])); #endif /* PIO_ENABLE_LOGGING */ } @@ -416,9 +416,9 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari pioassert(file && file->iosystem && varids && varids[0] >= 0 && varids[0] <= PIO_MAX_VARS && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "write_darray_multi_par nvars = %d iodesc->ndims = %d iodesc->mpitype = %d " - "iodesc->maxregions = %d iodesc->llen = %d", nvars, iodesc->ndims, - iodesc->mpitype, iodesc->maxregions, iodesc->llen)); + PLOG((1, "write_darray_multi_par nvars = %d iodesc->ndims = %d iodesc->mpitype = %d " + "iodesc->maxregions = %d iodesc->llen = %d", nvars, iodesc->ndims, + iodesc->mpitype, iodesc->maxregions, iodesc->llen)); #ifdef TIMING /* Start timer if desired. */ @@ -502,7 +502,7 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari dsize = 1; for (int i = 0; i < fndims; i++) dsize *= count[i]; - LOG((3, "dsize = %d", dsize)); + PLOG((3, "dsize = %d", dsize)); /* For pnetcdf's ncmpi_iput_varn() function, we need * to provide arrays of arrays for start/count. */ @@ -520,8 +520,8 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari { startlist[rrcnt][i] = start[i]; countlist[rrcnt][i] = count[i]; - LOG((3, "startlist[%d][%d] = %d countlist[%d][%d] = %d", rrcnt, i, - startlist[rrcnt][i], rrcnt, i, countlist[rrcnt][i])); + PLOG((3, "startlist[%d][%d] = %d countlist[%d][%d] = %d", rrcnt, i, + startlist[rrcnt][i], rrcnt, i, countlist[rrcnt][i])); } rrcnt++; } @@ -591,7 +591,7 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari { if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) return pio_err(NULL, file, ierr, __FILE__, __LINE__); - LOG((3, "num_regions = %d unlimdimoffset %ld", num_regions, unlimdimoffset)); + PLOG((3, "num_regions = %d unlimdimoffset %ld", num_regions, unlimdimoffset)); }else unlimdimoffset = gdim0; if (frame) @@ -660,9 +660,9 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari else /* there is only one variable to flush */ filetype = vartypes[0]; - LOG((3, "vard: call ncmpi_put_vard llen = %d %d", llen, iodesc->mpitype_size )); + PLOG((3, "vard: call ncmpi_put_vard llen = %d %d", llen, iodesc->mpitype_size )); ierr = ncmpi_put_vard_all(file->fh, var0_id, filetype, vard_bufptr, vard_llen, iodesc->mpitype); - LOG((3, "vard: return ncmpi_put_vard ierr = %d", ierr)); + PLOG((3, "vard: return ncmpi_put_vard ierr = %d", ierr)); if(filetype != MPI_DATATYPE_NULL) { if((mpierr = MPI_Type_free(&filetype))) @@ -685,8 +685,8 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari } /* Write, in non-blocking fashion, a list of subarrays. */ - LOG((3, "about to call ncmpi_iput_varn() varids[%d] = %d rrcnt = %d, llen = %d", - nv, varids[nv], rrcnt, llen)); + PLOG((3, "about to call ncmpi_iput_varn() varids[%d] = %d rrcnt = %d, llen = %d", + nv, varids[nv], rrcnt, llen)); ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist, bufptr, llen, iodesc->mpitype, &vdesc->request[vdesc->nreqs]); @@ -781,9 +781,9 @@ find_all_start_count(io_region *region, int maxregions, int fndims, { tmp_start[i + r * fndims] = region->start[i - (fndims - iodesc_ndims)]; tmp_count[i + r * fndims] = region->count[i - (fndims - iodesc_ndims)]; - LOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + r * fndims, - tmp_start[i + r * fndims], i + r * fndims, - tmp_count[i + r * fndims])); + PLOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + r * fndims, + tmp_start[i + r * fndims], i + r * fndims, + tmp_count[i + r * fndims])); } } else @@ -793,9 +793,9 @@ find_all_start_count(io_region *region, int maxregions, int fndims, { tmp_start[i + r * fndims] = region->start[i]; tmp_count[i + r * fndims] = region->count[i]; - LOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + r * fndims, - tmp_start[i + r * fndims], i + r * fndims, - tmp_count[i + r * fndims])); + PLOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + r * fndims, + tmp_start[i + r * fndims], i + r * fndims, + tmp_count[i + r * fndims])); } } @@ -840,7 +840,7 @@ send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, * fields are the same length). */ if ((mpierr = MPI_Send((void *)&llen, 1, MPI_OFFSET, 0, ios->io_rank, ios->io_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "sent llen = %d", llen)); + PLOG((3, "sent llen = %d", llen)); /* Send the number of data regions, the start/count for * all regions, and the data buffer with all the data. */ @@ -858,7 +858,7 @@ send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, if ((mpierr = MPI_Send(iobuf, nvars * llen, iodesc->mpitype, 0, ios->io_rank + 4 * ios->num_iotasks, ios->io_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "sent data for maxregions = %d", maxregions)); + PLOG((3, "sent data for maxregions = %d", maxregions)); } return PIO_NOERR; @@ -919,8 +919,8 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, pioassert(file && varids && iodesc && tmp_start && tmp_count, "invalid input", __FILE__, __LINE__); - LOG((2, "recv_and_write_data llen = %d maxregions = %d nvars = %d fndims = %d", - llen, maxregions, nvars, fndims)); + PLOG((2, "recv_and_write_data llen = %d maxregions = %d nvars = %d fndims = %d", + llen, maxregions, nvars, fndims)); /* Get pointer to IO system. */ ios = file->iosystem; @@ -942,7 +942,7 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, if ((mpierr = MPI_Recv(&rlen, 1, MPI_OFFSET, rtask, rtask, ios->io_comm, &status))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "received rlen = %d", rlen)); + PLOG((3, "received rlen = %d", rlen)); /* Get the number of regions, the start/count * values for all regions, and the data buffer. */ @@ -960,7 +960,7 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, if ((mpierr = MPI_Recv(iobuf, nvars * rlen, iodesc->mpitype, rtask, rtask + 4 * ios->num_iotasks, ios->io_comm, &status))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "received data rregions = %d fndims = %d", rregions, fndims)); + PLOG((3, "received data rregions = %d fndims = %d", rregions, fndims)); } } else /* task 0 */ @@ -968,7 +968,7 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, rlen = llen; rregions = maxregions; } - LOG((3, "rtask = %d rlen = %d rregions = %d", rtask, rlen, rregions)); + PLOG((3, "rtask = %d rlen = %d rregions = %d", rtask, rlen, rregions)); /* If there is data from this task, write it. */ if (rlen > 0) @@ -976,20 +976,20 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, loffset = 0; for (int regioncnt = 0; regioncnt < rregions; regioncnt++) { - LOG((3, "writing data for region with regioncnt = %d", regioncnt)); + PLOG((3, "writing data for region with regioncnt = %d", regioncnt)); /* Get the start/count arrays for this region. */ for (int i = 0; i < fndims; i++) { start[i] = tmp_start[i + regioncnt * fndims]; count[i] = tmp_count[i + regioncnt * fndims]; - LOG((3, "start[%d] = %d count[%d] = %d", i, start[i], i, count[i])); + PLOG((3, "start[%d] = %d count[%d] = %d", i, start[i], i, count[i])); } /* Process each variable in the buffer. */ for (int nv = 0; nv < nvars; nv++) { - LOG((3, "writing buffer var %d", nv)); + PLOG((3, "writing buffer var %d", nv)); if ((ierr = get_var_desc(varids[0], &file->varlist, &vdesc))) return pio_err(NULL, file, ierr, __FILE__, __LINE__); @@ -1014,7 +1014,7 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, #ifdef LOGGING for (int i = 1; i < fndims; i++) - LOG((3, "start[%d] %d count[%d] %d", i, start[i], i, count[i])); + PLOG((3, "start[%d] %d count[%d] %d", i, start[i], i, count[i])); #endif /* LOGGING */ /* Call the netCDF functions to write the data. */ @@ -1031,8 +1031,8 @@ recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, /* Keep track of where we are in the buffer. */ loffset += tsize; - LOG((3, " at bottom of loop regioncnt = %d tsize = %d loffset = %d", regioncnt, - tsize, loffset)); + PLOG((3, " at bottom of loop regioncnt = %d tsize = %d loffset = %d", regioncnt, + tsize, loffset)); } /* next regioncnt */ } /* endif (rlen > 0) */ } /* next rtask */ @@ -1072,8 +1072,8 @@ write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *v pioassert(file && file->iosystem && varids && varids[0] >= 0 && varids[0] <= PIO_MAX_VARS && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "write_darray_multi_serial nvars = %d fndims = %d iodesc->ndims = %d " - "iodesc->mpitype = %d", nvars, fndims, iodesc->ndims, iodesc->mpitype)); + PLOG((1, "write_darray_multi_serial nvars = %d fndims = %d iodesc->ndims = %d " + "iodesc->mpitype = %d", nvars, fndims, iodesc->ndims, iodesc->mpitype)); /* Get the iosystem info. */ ios = file->iosystem; @@ -1101,7 +1101,7 @@ write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *v size_t tmp_start[fndims * num_regions]; /* A start array for each region. */ size_t tmp_count[fndims * num_regions]; /* A count array for each region. */ - LOG((3, "num_regions = %d", num_regions)); + PLOG((3, "num_regions = %d", num_regions)); /* Fill the tmp_start and tmp_count arrays, which contain the * start and count arrays for all regions. */ @@ -1173,7 +1173,7 @@ pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) /* Get the IO system info. */ ios = file->iosystem; - LOG((3, "pio_read_darray_nc ios->ioproc %d", ios->ioproc)); + PLOG((3, "pio_read_darray_nc ios->ioproc %d", ios->ioproc)); #ifdef TIMING /* Start timer if desired. */ @@ -1195,7 +1195,7 @@ pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) if(!ios->async || !ios->ioproc) ierr = get_gdim0(file, iodesc, vid, fndims, &gdim0); #endif - /* LOG((4, "fndims %d ndims %d", fndims, ndims)); */ + /* PLOG((4, "fndims %d ndims %d", fndims, ndims)); */ /* IO procs will read the data. */ if (ios->ioproc) @@ -1246,8 +1246,8 @@ pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) else bufptr=(void *)((char *)iobuf + iodesc->mpitype_size * region->loffset); - LOG((2, "iodesc->llen - region->loffset %d, iodesc->llen %d, region->loffset %d vdesc->record %d", - iodesc->llen - region->loffset, iodesc->llen, region->loffset, vdesc->record)); + PLOG((2, "iodesc->llen - region->loffset %d, iodesc->llen %d, region->loffset %d vdesc->record %d", + iodesc->llen - region->loffset, iodesc->llen, region->loffset, vdesc->record)); /* Get the start/count arrays. */ if (vdesc->record >= 0 && fndims > 1) @@ -1278,7 +1278,7 @@ pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) #ifdef PIO_ENABLE_LOGGING for (int i = 1; i < ndims; i++) - LOG((3, "start[%d] %d count[%d] %d", i, start[i], i, count[i])); + PLOG((3, "start[%d] %d count[%d] %d", i, start[i], i, count[i])); #endif /* LOGGING */ /* Do the read. */ switch (file->iotype) @@ -1444,7 +1444,7 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, pioassert(file && file->iosystem && iodesc && vid >= 0 && vid <= PIO_MAX_VARS, "invalid input", __FILE__, __LINE__); - LOG((2, "pio_read_darray_nc_serial vid = %d", vid)); + PLOG((2, "pio_read_darray_nc_serial vid = %d", vid)); ios = file->iosystem; #ifdef TIMING @@ -1539,10 +1539,10 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, #if PIO_ENABLE_LOGGING /* Log arrays for debug purposes. */ - LOG((3, "region = %d", region)); + PLOG((3, "region = %d", region)); for (int i = 0; i < fndims; i++) - LOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + regioncnt * fndims, tmp_start[i + regioncnt * fndims], - i + regioncnt * fndims, tmp_count[i + regioncnt * fndims])); + PLOG((3, "tmp_start[%d] = %d tmp_count[%d] = %d", i + regioncnt * fndims, tmp_start[i + regioncnt * fndims], + i + regioncnt * fndims, tmp_count[i + regioncnt * fndims])); #endif /* PIO_ENABLE_LOGGING */ /* Move to next region. */ @@ -1556,7 +1556,7 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, { if ((mpierr = MPI_Send(&iodesc->llen, 1, MPI_OFFSET, 0, ios->io_rank, ios->io_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "sent iodesc->llen = %d", iodesc->llen)); + PLOG((3, "sent iodesc->llen = %d", iodesc->llen)); if (iodesc->llen > 0) { @@ -1569,12 +1569,12 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, 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(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "sent iodesc->maxregions = %d tmp_count and tmp_start arrays", iodesc->maxregions)); + PLOG((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(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "received %d elements of data", iodesc->llen)); + PLOG((3, "received %d elements of data", iodesc->llen)); } } else if (ios->io_rank == 0) @@ -1592,7 +1592,7 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, { if ((mpierr = MPI_Recv(&tmp_bufsize, 1, MPI_OFFSET, rtask, rtask, ios->io_comm, &status))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "received tmp_bufsize = %d", tmp_bufsize)); + PLOG((3, "received tmp_bufsize = %d", tmp_bufsize)); if (tmp_bufsize > 0) { @@ -1605,7 +1605,7 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, if ((mpierr = MPI_Recv(this_start, maxregions * fndims, MPI_OFFSET, rtask, 3 * ios->num_iotasks + rtask, ios->io_comm, &status))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "received maxregions = %d this_count, this_start arrays ", maxregions)); + PLOG((3, "received maxregions = %d this_count, this_start arrays ", maxregions)); } } else @@ -1613,7 +1613,7 @@ pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, maxregions = iodesc->maxregions; tmp_bufsize = iodesc->llen; } - LOG((3, "maxregions = %d tmp_bufsize = %d", maxregions, tmp_bufsize)); + PLOG((3, "maxregions = %d tmp_bufsize = %d", maxregions, tmp_bufsize)); /* Now get each region of data. */ loffset = 0; @@ -1739,7 +1739,7 @@ flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) /* Check inputs. */ pioassert(file, "invalid input", __FILE__, __LINE__); - LOG((1, "flush_output_buffer")); + PLOG((1, "flush_output_buffer")); /* Find out the buffer usage. */ if ((ierr = ncmpi_inq_buffer_usage(file->fh, &usage))) /* allow the buffer to be undefined */ @@ -1760,7 +1760,7 @@ flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) if (usage > maxusage) maxusage = usage; - LOG((2, "flush_output_buffer usage=%ld force=%d",usage, force)); + PLOG((2, "flush_output_buffer usage=%ld force=%d",usage, force)); /* If the user forces it, or the buffer has exceeded the size * limit, then flush to disk. */ if (force || (usage >= pio_buffer_size_limit)) @@ -1799,7 +1799,7 @@ flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) #endif for (reqcnt = 0; reqcnt < vdesc->nreqs; reqcnt++) request[rcnt++] = max(vdesc->request[reqcnt], NC_REQ_NULL); - LOG((3,"flush_output_buffer rcnt=%d",rcnt)); + PLOG((3,"flush_output_buffer rcnt=%d",rcnt)); if (vdesc->request != NULL) free(vdesc->request); @@ -1818,7 +1818,7 @@ flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) /* Release resources. */ if (file->iobuf) { - LOG((3,"freeing variable buffer in flush_output_buffer")); + PLOG((3,"freeing variable buffer in flush_output_buffer")); brel(file->iobuf); file->iobuf = NULL; } @@ -1853,8 +1853,8 @@ cn_buffer_report(iosystem_desc_t *ios, bool collective) { int mpierr; /* Return code from MPI functions. */ - LOG((2, "cn_buffer_report ios->iossysid = %d collective = %d CN_bpool = %d", - ios->iosysid, collective, CN_bpool)); + PLOG((2, "cn_buffer_report ios->iossysid = %d collective = %d CN_bpool = %d", + ios->iosysid, collective, CN_bpool)); if (CN_bpool) { long bget_stats[5]; @@ -1864,28 +1864,28 @@ cn_buffer_report(iosystem_desc_t *ios, bool collective) bstats(bget_stats, bget_stats+1,bget_stats+2,bget_stats+3,bget_stats+4); if (collective) { - LOG((3, "cn_buffer_report calling MPI_Reduce ios->comp_comm = %d", ios->comp_comm)); + PLOG((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, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "cn_buffer_report calling MPI_Reduce")); + PLOG((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, NULL, mpierr, __FILE__, __LINE__); if (ios->compmaster == MPI_ROOT) { - LOG((1, "Currently allocated buffer space %ld %ld", bget_mins[0], bget_maxs[0])); - LOG((1, "Currently available buffer space %ld %ld", bget_mins[1], bget_maxs[1])); - LOG((1, "Current largest free block %ld %ld", bget_mins[2], bget_maxs[2])); - LOG((1, "Number of successful bget calls %ld %ld", bget_mins[3], bget_maxs[3])); - LOG((1, "Number of successful brel calls %ld %ld", bget_mins[4], bget_maxs[4])); + PLOG((1, "Currently allocated buffer space %ld %ld", bget_mins[0], bget_maxs[0])); + PLOG((1, "Currently available buffer space %ld %ld", bget_mins[1], bget_maxs[1])); + PLOG((1, "Current largest free block %ld %ld", bget_mins[2], bget_maxs[2])); + PLOG((1, "Number of successful bget calls %ld %ld", bget_mins[3], bget_maxs[3])); + PLOG((1, "Number of successful brel calls %ld %ld", bget_mins[4], bget_maxs[4])); } } else { - LOG((1, "Currently allocated buffer space %ld", bget_stats[0])); - LOG((1, "Currently available buffer space %ld", bget_stats[1])); - LOG((1, "Current largest free block %ld", bget_stats[2])); - LOG((1, "Number of successful bget calls %ld", bget_stats[3])); - LOG((1, "Number of successful brel calls %ld", bget_stats[4])); + PLOG((1, "Currently allocated buffer space %ld", bget_stats[0])); + PLOG((1, "Currently available buffer space %ld", bget_stats[1])); + PLOG((1, "Current largest free block %ld", bget_stats[2])); + PLOG((1, "Number of successful bget calls %ld", bget_stats[3])); + PLOG((1, "Number of successful brel calls %ld", bget_stats[4])); } } } @@ -1902,13 +1902,13 @@ void free_cn_buffer_pool(iosystem_desc_t *ios) { #if !PIO_USE_MALLOC - LOG((2, "free_cn_buffer_pool CN_bpool = %d", CN_bpool)); + PLOG((2, "free_cn_buffer_pool CN_bpool = %d", CN_bpool)); /* Note: it is possible that CN_bpool has been freed and set to NULL by bpool_free() */ if (CN_bpool) { cn_buffer_report(ios, false); bpoolrelease(CN_bpool); - LOG((2, "free_cn_buffer_pool done!")); + PLOG((2, "free_cn_buffer_pool done!")); free(CN_bpool); CN_bpool = NULL; } @@ -1938,7 +1938,7 @@ flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) if ((ret = pio_get_file(ncid, &file))) return pio_err(NULL, NULL, ret, __FILE__, __LINE__); - LOG((1, "flush_buffer ncid = %d flushtodisk = %d", ncid, flushtodisk)); + PLOG((1, "flush_buffer ncid = %d flushtodisk = %d", ncid, flushtodisk)); /* If there are any variables in this buffer... */ if (wmb->num_arrays > 0) @@ -1947,7 +1947,7 @@ flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) ret = PIOc_write_darray_multi(ncid, wmb->vid, wmb->ioid, wmb->num_arrays, wmb->arraylen, wmb->data, wmb->frame, wmb->fillvalue, flushtodisk); - LOG((2, "return from PIOc_write_darray_multi ret = %d", ret)); + PLOG((2, "return from PIOc_write_darray_multi ret = %d", ret)); wmb->num_arrays = 0; @@ -2250,8 +2250,8 @@ compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) /* Check inputs. */ pioassert(iodesc, "invalid input", __FILE__, __LINE__); - LOG((2, "compute_maxaggregate_bytes iodesc->maxiobuflen = %d iodesc->ndof = %d", - iodesc->maxiobuflen, iodesc->ndof)); + PLOG((2, "compute_maxaggregate_bytes iodesc->maxiobuflen = %d iodesc->ndof = %d", + iodesc->maxiobuflen, iodesc->ndof)); /* Determine the max bytes that can be held on IO task. */ if (ios->ioproc && iodesc->maxiobuflen > 0) @@ -2263,15 +2263,15 @@ compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) /* Take the min of the max IO and max comp bytes. */ maxbytes = min(maxbytesoniotask, maxbytesoncomputetask); - LOG((2, "compute_maxaggregate_bytes maxbytesoniotask = %d maxbytesoncomputetask = %d", - maxbytesoniotask, maxbytesoncomputetask)); + PLOG((2, "compute_maxaggregate_bytes maxbytesoniotask = %d maxbytesoncomputetask = %d", + maxbytesoniotask, maxbytesoncomputetask)); /* Get the min value of this on all tasks. */ - LOG((3, "before allreaduce maxbytes = %d", maxbytes)); + PLOG((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, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "after allreaduce maxbytes = %d", maxbytes)); + PLOG((3, "after allreaduce maxbytes = %d", maxbytes)); /* Remember the result. */ iodesc->maxbytes = maxbytes; diff --git a/src/clib/pio_error.h b/src/clib/pio_error.h index 23b347951b5..dbf71abaca9 100644 --- a/src/clib/pio_error.h +++ b/src/clib/pio_error.h @@ -17,7 +17,7 @@ * Handle non-MPI errors by printing error message and goto exit. This * is used in test code. */ -#define BAIL(e) do { \ +#define PBAIL(e) do { \ fprintf(stderr, "%d Error %d in %s, line %d\n", my_rank, e, __FILE__, __LINE__); \ goto exit; \ } while (0) diff --git a/src/clib/pio_file.c b/src/clib/pio_file.c index 1260df8429f..39b870e8f09 100644 --- a/src/clib/pio_file.c +++ b/src/clib/pio_file.c @@ -54,8 +54,8 @@ extern int event_num[2][NUM_EVENTS]; int PIOc_openfile(int iosysid, int *ncidp, int *iotype, const char *filename, int mode) { - LOG((1, "PIOc_openfile iosysid %d *iotype %d filename %s mode %d", iosysid, - iotype ? *iotype: 0, filename, mode)); + PLOG((1, "PIOc_openfile iosysid %d *iotype %d filename %s mode %d", iosysid, + iotype ? *iotype: 0, filename, mode)); return PIOc_openfile_retry(iosysid, ncidp, iotype, filename, mode, 1); } @@ -81,8 +81,8 @@ int PIOc_openfile(int iosysid, int *ncidp, int *iotype, const char *filename, int PIOc_openfile2(int iosysid, int *ncidp, int *iotype, const char *filename, int mode) { - LOG((1, "PIOc_openfile2 iosysid %d *iotype %d filename %s mode %d", iosysid, - iotype ? *iotype : 0, filename, mode)); + PLOG((1, "PIOc_openfile2 iosysid %d *iotype %d filename %s mode %d", iosysid, + iotype ? *iotype : 0, filename, mode)); return PIOc_openfile_retry(iosysid, ncidp, iotype, filename, mode, 0); } @@ -103,7 +103,7 @@ int PIOc_open(int iosysid, const char *path, int mode, int *ncidp) { int iotype; - LOG((1, "PIOc_open iosysid = %d path = %s mode = %x", iosysid, path, mode)); + PLOG((1, "PIOc_open iosysid = %d path = %s mode = %x", iosysid, path, mode)); /* Figure out the iotype. */ if (mode & NC_NETCDF4) @@ -154,8 +154,8 @@ int PIOc_createfile(int iosysid, int *ncidp, int *iotype, const char *filename, if (!(ios = pio_get_iosystem_from_id(iosysid))) return pio_err(NULL, NULL, PIO_EBADID, __FILE__, __LINE__); - LOG((1, "PIOc_createfile iosysid = %d iotype = %d filename = %s mode = %d", - iosysid, *iotype, filename, mode)); + PLOG((1, "PIOc_createfile iosysid = %d iotype = %d filename = %s mode = %d", + iosysid, *iotype, filename, mode)); /* Create the file. */ if ((ret = PIOc_createfile_int(iosysid, ncidp, iotype, filename, mode))) @@ -230,7 +230,7 @@ int PIOc_closefile(int ncid) pio_start_mpe_log(CLOSE); #endif /* USE_MPE */ - LOG((1, "PIOc_closefile ncid = %d", ncid)); + PLOG((1, "PIOc_closefile ncid = %d", ncid)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) return pio_err(NULL, NULL, ierr, __FILE__, __LINE__); @@ -326,7 +326,7 @@ int PIOc_deletefile(int iosysid, const char *filename) int msg = PIO_MSG_DELETE_FILE; size_t len; - LOG((1, "PIOc_deletefile iosysid = %d filename = %s", iosysid, filename)); + PLOG((1, "PIOc_deletefile iosysid = %d filename = %s", iosysid, filename)); /* Get the IO system info from the id. */ if (!(ios = pio_get_iosystem_from_id(iosysid))) @@ -346,7 +346,7 @@ int PIOc_deletefile(int iosysid, const char *filename) if (!mpierr) mpierr = MPI_Bcast((void *)filename, len + 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "Bcast len = %d filename = %s", len, filename)); + PLOG((2, "Bcast len = %d filename = %s", len, filename)); } /* Handle MPI errors. */ @@ -354,7 +354,7 @@ int PIOc_deletefile(int iosysid, const char *filename) return check_mpi(ios, NULL, mpierr2, __FILE__, __LINE__); if (mpierr) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "done hanlding errors mpierr = %d", mpierr)); + PLOG((3, "done hanlding errors mpierr = %d", mpierr)); } /* If this is an IO task, then call the netCDF function. The @@ -371,7 +371,7 @@ int PIOc_deletefile(int iosysid, const char *filename) if (!mpierr) mpierr = MPI_Barrier(ios->io_comm); } - LOG((2, "PIOc_deletefile ierr = %d", ierr)); + PLOG((2, "PIOc_deletefile ierr = %d", ierr)); /* Broadcast and check the return code. */ if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) @@ -402,7 +402,7 @@ int PIOc_sync(int ncid) int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ierr = PIO_NOERR; /* Return code from function calls. */ - LOG((1, "PIOc_sync ncid = %d", ncid)); + PLOG((1, "PIOc_sync ncid = %d", ncid)); /* Get the file info from the ncid. */ if ((ierr = pio_get_file(ncid, &file))) @@ -416,18 +416,18 @@ int PIOc_sync(int ncid) { wmulti_buffer *wmb, *twmb; - LOG((3, "PIOc_sync checking buffers")); - HASH_ITER(hh, file->buffer, wmb, twmb) - { + PLOG((3, "PIOc_sync checking buffers")); + HASH_ITER(hh, file->buffer, wmb, twmb) + { /* If there are any data arrays waiting in the * multibuffer, flush it. */ if (wmb->num_arrays > 0) flush_buffer(ncid, wmb, true); - HASH_DEL(file->buffer, wmb); - brel(wmb); - - } - file->buffer = NULL; + HASH_DEL(file->buffer, wmb); + brel(wmb); + + } + file->buffer = NULL; } } @@ -478,7 +478,7 @@ int PIOc_sync(int ncid) return pio_err(ios, file, PIO_EBADIOTYPE, __FILE__, __LINE__); } } - LOG((2, "PIOc_sync ierr = %d", ierr)); + PLOG((2, "PIOc_sync ierr = %d", ierr)); } /* Broadcast and check the return code. */ diff --git a/src/clib/pio_get_nc.c b/src/clib/pio_get_nc.c index 589a3de11e2..a1a3428469f 100644 --- a/src/clib/pio_get_nc.c +++ b/src/clib/pio_get_nc.c @@ -1039,7 +1039,7 @@ int PIOc_get_var1_ushort(int ncid, int varid, const PIO_Offset *index, unsigned int PIOc_get_var1_short(int ncid, int varid, const PIO_Offset *index, short *buf) { int ret = PIOc_get_var1_tc(ncid, varid, index, NC_SHORT, buf); - LOG((1, "PIOc_get_var1_short returned %d", ret)); + PLOG((1, "PIOc_get_var1_short returned %d", ret)); return ret; } diff --git a/src/clib/pio_get_vard.c b/src/clib/pio_get_vard.c index e0decf92dca..f94e9fb17c9 100644 --- a/src/clib/pio_get_vard.c +++ b/src/clib/pio_get_vard.c @@ -1,12 +1,12 @@ /** - * @file - * PIO functions to get data with distributed arrays. - * - * @author Ed Hartnett - * @date 2019 - * - * @see https://github.com/NCAR/ParallelIO - */ + * @file + * PIO functions to get data with distributed arrays. + * + * @author Ed Hartnett + * @date 2019 + * + * @see https://github.com/NCAR/ParallelIO + */ #include #include #include diff --git a/src/clib/pio_getput_int.c b/src/clib/pio_getput_int.c index 2eb37064bb8..896557078ab 100644 --- a/src/clib/pio_getput_int.c +++ b/src/clib/pio_getput_int.c @@ -48,8 +48,8 @@ PIOc_put_att_tc(int ncid, int varid, const char *name, nc_type atttype, if (!name || !op || strlen(name) > NC_MAX_NAME || len < 0) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_put_att_tc ncid = %d varid = %d name = %s atttype = %d len = %d memtype = %d", - ncid, varid, name, atttype, len, memtype)); + PLOG((1, "PIOc_put_att_tc ncid = %d varid = %d name = %s atttype = %d len = %d memtype = %d", + ncid, varid, name, atttype, len, memtype)); /* Run these on all tasks if async is not in use, but only on * non-IO tasks if async is in use. */ @@ -67,7 +67,7 @@ PIOc_put_att_tc(int ncid, int varid, const char *name, nc_type atttype, if ((ierr = PIOc_inq_type(ncid, memtype, NULL, &memtype_len))) return check_netcdf(file, ierr, __FILE__, __LINE__); } - LOG((2, "PIOc_put_att atttype_len = %d memtype_len = %d", ncid, atttype_len, memtype_len)); + PLOG((2, "PIOc_put_att atttype_len = %d memtype_len = %d", ncid, atttype_len, memtype_len)); } /* If async is in use, and this is not an IO task, bcast the parameters. */ @@ -102,9 +102,9 @@ PIOc_put_att_tc(int ncid, int varid, const char *name, nc_type atttype, if (!mpierr) mpierr = MPI_Bcast((void *)op, len * memtype_len, MPI_BYTE, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_put_att finished bcast ncid = %d varid = %d namelen = %d name = %s " - "len = %d atttype_len = %d memtype = %d memtype_len = %d", ncid, varid, namelen, - name, len, atttype_len, memtype, memtype_len)); + PLOG((2, "PIOc_put_att finished bcast ncid = %d varid = %d namelen = %d name = %s " + "len = %d atttype_len = %d memtype = %d memtype_len = %d", ncid, varid, namelen, + name, len, atttype_len, memtype, memtype_len)); } /* Handle MPI errors. */ @@ -118,8 +118,8 @@ PIOc_put_att_tc(int ncid, int varid, const char *name, nc_type atttype, check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&memtype_len, 1, MPI_OFFSET, ios->comproot, ios->my_comm))) check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_put_att bcast from comproot = %d atttype_len = %d", ios->comproot, - atttype_len, memtype_len)); + PLOG((2, "PIOc_put_att bcast from comproot = %d atttype_len = %d", ios->comproot, + atttype_len, memtype_len)); } /* If this is an IO task, then call the netCDF function. */ @@ -193,7 +193,7 @@ PIOc_put_att_tc(int ncid, int varid, const char *name, nc_type atttype, ierr = nc_put_att_uint(file->fh, varid, name, atttype, len, op); break; case NC_INT64: - LOG((3, "about to call nc_put_att_longlong")); + PLOG((3, "about to call nc_put_att_longlong")); ierr = nc_put_att_longlong(file->fh, varid, name, atttype, len, op); break; case NC_UINT64: @@ -257,8 +257,8 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip if (!name || !ip || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_get_att_tc ncid %d varid %d name %s memtype %d", - ncid, varid, name, memtype)); + PLOG((1, "PIOc_get_att_tc ncid %d varid %d name %s memtype %d", + ncid, varid, name, memtype)); /* Run these on all tasks if async is not in use, but only on * non-IO tasks if async is in use. */ @@ -267,7 +267,7 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip /* Get the type and length of the attribute. */ if ((ierr = PIOc_inq_att(ncid, varid, name, &atttype, &attlen))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((2, "atttype = %d attlen = %d", atttype, attlen)); + PLOG((2, "atttype = %d attlen = %d", atttype, attlen)); /* Get the length (in bytes) of the type of the attribute. */ if ((ierr = PIOc_inq_type(ncid, atttype, NULL, &atttype_len))) @@ -283,7 +283,7 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip return check_netcdf(file, ierr, __FILE__, __LINE__); } } - LOG((2, "atttype_len = %d memtype_len = %d", atttype_len, memtype_len)); + PLOG((2, "atttype_len = %d memtype_len = %d", atttype_len, memtype_len)); /* If async is in use, and this is not an IO task, bcast the * parameters and the attribute and type information we fetched. */ @@ -292,7 +292,7 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip if (!ios->ioproc) { int msg = PIO_MSG_GET_ATT; - LOG((2, "sending parameters")); + PLOG((2, "sending parameters")); /* Send the message to IO master. */ if (ios->compmaster == MPI_ROOT) @@ -320,9 +320,9 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip mpierr = MPI_Bcast(&memtype, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&memtype_len, 1, MPI_OFFSET, ios->compmaster, ios->intercomm); - LOG((2, "Bcast complete ncid = %d varid = %d namelen = %d name = %s iotype = %d " - "atttype = %d attlen = %d atttype_len = %d", ncid, varid, namelen, name, file->iotype, - atttype, attlen, atttype_len)); + PLOG((2, "Bcast complete ncid = %d varid = %d namelen = %d name = %s iotype = %d " + "atttype = %d attlen = %d atttype_len = %d", ncid, varid, namelen, name, file->iotype, + atttype, attlen, atttype_len)); } /* Handle MPI errors. */ @@ -330,24 +330,24 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip check_mpi(NULL, file, mpierr2, __FILE__, __LINE__); if (mpierr) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "mpi errors handled")); + PLOG((2, "mpi errors handled")); /* Broadcast values currently only known on computation tasks to IO tasks. */ - LOG((2, "PIOc_get_att_tc bcast from comproot = %d attlen = %d atttype_len = %d", ios->comproot, attlen, atttype_len)); + PLOG((2, "PIOc_get_att_tc bcast from comproot = %d attlen = %d atttype_len = %d", ios->comproot, attlen, atttype_len)); if ((mpierr = MPI_Bcast(&attlen, 1, MPI_OFFSET, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&atttype_len, 1, MPI_OFFSET, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&memtype_len, 1, MPI_OFFSET, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_get_att_tc bcast complete attlen = %d atttype_len = %d memtype_len = %d", attlen, atttype_len, - memtype_len)); + PLOG((2, "PIOc_get_att_tc bcast complete attlen = %d atttype_len = %d memtype_len = %d", attlen, atttype_len, + memtype_len)); } /* If this is an IO task, then call the netCDF function. */ if (ios->ioproc) { - LOG((2, "calling pnetcdf/netcdf")); + PLOG((2, "calling pnetcdf/netcdf")); #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { @@ -416,7 +416,7 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip ierr = nc_get_att_uint(file->fh, varid, name, ip); break; case NC_INT64: - LOG((3, "about to call nc_get_att_longlong")); + PLOG((3, "about to call nc_get_att_longlong")); ierr = nc_get_att_longlong(file->fh, varid, name, ip); break; case NC_UINT64: @@ -433,19 +433,19 @@ PIOc_get_att_tc(int ncid, int varid, const char *name, nc_type memtype, void *ip } /* Broadcast and check the return code. */ - LOG((2, "ierr = %d", ierr)); + PLOG((2, "ierr = %d", ierr)); if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if (ierr) return check_netcdf(file, ierr, __FILE__, __LINE__); /* Broadcast results to all tasks. */ - LOG((2, "bcasting att values attlen = %d memtype_len = %d", attlen, memtype_len)); + PLOG((2, "bcasting att values attlen = %d memtype_len = %d", attlen, memtype_len)); if ((mpierr = MPI_Bcast(ip, (int)attlen * memtype_len, MPI_BYTE, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "get_att_tc data bcast complete")); + PLOG((2, "get_att_tc data bcast complete")); return PIO_NOERR; } @@ -502,9 +502,9 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ierr; /* Return code. */ - LOG((1, "PIOc_get_vars_tc ncid = %d varid = %d xtype = %d start_present = %d " - "count_present = %d stride_present = %d", ncid, varid, xtype, start_present, - count_present, stride_present)); + PLOG((1, "PIOc_get_vars_tc ncid = %d varid = %d xtype = %d start_present = %d " + "count_present = %d stride_present = %d", ncid, varid, xtype, start_present, + count_present, stride_present)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -539,7 +539,7 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset /* Get the number of dims for this var. */ if ((ierr = PIOc_inq_varndims(ncid, varid, &ndims))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3, "ndims = %d", ndims)); + PLOG((3, "ndims = %d", ndims)); /* Only scalar vars can pass NULL for start/count. */ pioassert(ndims == 0 || (start && count), "need start/count", __FILE__, __LINE__); @@ -548,7 +548,7 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset * num_elem will remain 1). */ for (int vd = 0; vd < ndims; vd++) num_elem *= count[vd]; - LOG((2, "PIOc_get_vars_tc num_elem = %d", num_elem)); + PLOG((2, "PIOc_get_vars_tc num_elem = %d", num_elem)); } /* If async is in use, and this is not an IO task, bcast the parameters. */ @@ -587,9 +587,9 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset mpierr = MPI_Bcast(&num_elem, 1, MPI_OFFSET, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&typelen, 1, MPI_OFFSET, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_get_vars_tc ncid = %d varid = %d ndims = %d start_present = %d " - "count_present = %d stride_present = %d xtype = %d num_elem = %d", ncid, varid, - ndims, start_present, count_present, stride_present, xtype, num_elem)); + PLOG((2, "PIOc_get_vars_tc ncid = %d varid = %d ndims = %d start_present = %d " + "count_present = %d stride_present = %d xtype = %d num_elem = %d", ncid, varid, + ndims, start_present, count_present, stride_present, xtype, num_elem)); } /* Handle MPI errors. */ @@ -613,7 +613,7 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset { if (!stride_present) { - LOG((2, "stride not present ")); + PLOG((2, "stride not present ")); if (!(fake_stride = malloc(ndims * sizeof(PIO_Offset)))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); for (int d = 0; d < ndims; d++) @@ -627,11 +627,11 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset if (ios->ioproc) { - LOG((2, "file->iotype = %d xtype = %d file->do_io = %d", file->iotype, xtype, file->do_io)); + PLOG((2, "file->iotype = %d xtype = %d file->do_io = %d", file->iotype, xtype, file->do_io)); #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { - LOG((2, "pnetcdf calling ncmpi_get_vars_*() file->fh = %d varid = %d", file->fh, varid)); + PLOG((2, "pnetcdf calling ncmpi_get_vars_*() file->fh = %d varid = %d", file->fh, varid)); /* Turn on independent access for pnetcdf file. */ if ((ierr = ncmpi_begin_indep_data(file->fh))) return pio_err(ios, file, ierr, __FILE__, __LINE__); @@ -674,12 +674,12 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset } #endif /* _PNETCDF */ - LOG((2, "duck ndims %d", ndims)); + PLOG((2, "duck ndims %d", ndims)); for (int d = 0; d < ndims; d++) { - LOG((2, "start[%d] %d", d, start[d])); - LOG((2, "count[%d] %d", d, count[d])); - LOG((2, "fake_stride[%d] %d", d, fake_stride[d])); + PLOG((2, "start[%d] %d", d, start[d])); + PLOG((2, "count[%d] %d", d, count[d])); + PLOG((2, "fake_stride[%d] %d", d, fake_stride[d])); } if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) @@ -728,7 +728,7 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset (ptrdiff_t *)fake_stride, buf); break; case NC_INT64: - LOG((3, "about to call nc_get_vars_longlong")); + PLOG((3, "about to call nc_get_vars_longlong")); ierr = nc_get_vars_longlong(file->fh, varid, (size_t *)start, (size_t *)count, (ptrdiff_t *)fake_stride, buf); break; @@ -748,10 +748,10 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset } - LOG((2, "howdy ndims %d", ndims)); + PLOG((2, "howdy ndims %d", ndims)); for (int d = 0; d < ndims; d++) { - LOG((2, "fake_stride[%d] %d", d, fake_stride[d])); + PLOG((2, "fake_stride[%d] %d", d, fake_stride[d])); } /* Free malloced resources. */ @@ -765,11 +765,11 @@ PIOc_get_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset return check_netcdf(file, ierr, __FILE__, __LINE__); /* Send the data. */ - LOG((2, "PIOc_get_vars_tc bcasting data num_elem = %d typelen = %d ios->ioroot = %d", num_elem, - typelen, ios->ioroot)); + PLOG((2, "PIOc_get_vars_tc bcasting data num_elem = %d typelen = %d ios->ioroot = %d", num_elem, + typelen, ios->ioroot)); if ((mpierr = MPI_Bcast(buf, num_elem * typelen, MPI_BYTE, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_get_vars_tc bcasting data complete")); + PLOG((2, "PIOc_get_vars_tc bcasting data complete")); return PIO_NOERR; } @@ -840,8 +840,8 @@ PIOc_get_var_tc(int ncid, int varid, nc_type xtype, void *buf) int ndims; /* The number of dimensions in the variable. */ int ierr; /* Return code from function calls. */ - LOG((1, "PIOc_get_var_tc ncid = %d varid = %d xtype = %d", ncid, varid, - xtype)); + PLOG((1, "PIOc_get_var_tc ncid = %d varid = %d xtype = %d", ncid, varid, + xtype)); /* Find the info about this file. We need this for error handling. */ if ((ierr = pio_get_file(ncid, &file))) @@ -883,8 +883,8 @@ PIOc_get_var_tc(int ncid, int varid, nc_type xtype, void *buf) for (int d = 0; d < ndims; d++) { startp[d] = 0; - LOG((3, "startp[%d] = %d countp[%d] = %d", d, startp[d], d, - countp[d])); + PLOG((3, "startp[%d] = %d countp[%d] = %d", d, startp[d], d, + countp[d])); } } @@ -951,9 +951,9 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ierr; /* Return code from function calls. */ - LOG((1, "PIOc_put_vars_tc ncid = %d varid = %d start_present = %d " - "count_present = %d stride_present = %d xtype = %d", ncid, varid, - start_present, count_present, stride_present, xtype)); + PLOG((1, "PIOc_put_vars_tc ncid = %d varid = %d start_present = %d " + "count_present = %d stride_present = %d xtype = %d", ncid, varid, + start_present, count_present, stride_present, xtype)); /* Get file info. */ if ((ierr = pio_get_file(ncid, &file))) @@ -989,7 +989,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset return check_netcdf(file, ierr, __FILE__, __LINE__); } - LOG((2, "ndims = %d typelen = %d", ndims, typelen)); + PLOG((2, "ndims = %d typelen = %d", ndims, typelen)); /* How many elements of data? If no count array was passed, * this is a scalar. */ @@ -1034,9 +1034,9 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset mpierr = MPI_Bcast(&num_elem, 1, MPI_OFFSET, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&typelen, 1, MPI_OFFSET, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_put_vars_tc ncid = %d varid = %d ndims = %d start_present = %d " - "count_present = %d stride_present = %d xtype = %d num_elem = %d", ncid, varid, - ndims, start_present, count_present, stride_present, xtype, num_elem)); + PLOG((2, "PIOc_put_vars_tc ncid = %d varid = %d ndims = %d start_present = %d " + "count_present = %d stride_present = %d xtype = %d num_elem = %d", ncid, varid, + ndims, start_present, count_present, stride_present, xtype, num_elem)); /* Send the data. */ if (!mpierr) @@ -1049,15 +1049,15 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset return check_mpi(NULL, file, mpierr2, __FILE__, __LINE__); if (mpierr) check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_put_vars_tc checked mpierr = %d", mpierr)); + PLOG((2, "PIOc_put_vars_tc checked mpierr = %d", mpierr)); /* Broadcast values currently only known on computation tasks to IO tasks. */ - LOG((2, "PIOc_put_vars_tc bcast from comproot")); + PLOG((2, "PIOc_put_vars_tc bcast from comproot")); if ((mpierr = MPI_Bcast(&ndims, 1, MPI_INT, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&xtype, 1, MPI_INT, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_put_vars_tc complete bcast from comproot ndims = %d", ndims)); + PLOG((2, "PIOc_put_vars_tc complete bcast from comproot ndims = %d", ndims)); } /* If this is an IO task, then call the netCDF function. */ @@ -1067,7 +1067,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset { if (!stride_present) { - LOG((2, "stride not present")); + PLOG((2, "stride not present")); if (!(fake_stride = malloc(ndims * sizeof(PIO_Offset)))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); for (int d = 0; d < ndims; d++) @@ -1084,8 +1084,8 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset if (ndims == 0) { /* This is a scalar var. */ - LOG((2, "pnetcdf writing scalar with ncmpi_put_vars_*() file->fh = %d varid = %d", - file->fh, varid)); + PLOG((2, "pnetcdf writing scalar with ncmpi_put_vars_*() file->fh = %d varid = %d", + file->fh, varid)); pioassert(!start && !count && !stride, "expected NULLs", __FILE__, __LINE__); /* Turn on independent access for pnetcdf file. */ @@ -1134,7 +1134,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset var_desc_t *vdesc; int *request; - LOG((2, "PIOc_put_vars_tc calling pnetcdf function")); + PLOG((2, "PIOc_put_vars_tc calling pnetcdf function")); /*vdesc = &file->varlist[varid];*/ if ((ierr = get_var_desc(varid, &file->varlist, &vdesc))) return pio_err(ios, file, ierr, __FILE__, __LINE__); @@ -1143,7 +1143,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset sizeof(int) * (vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK)))) return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); request = vdesc->request + vdesc->nreqs; - LOG((2, "PIOc_put_vars_tc request = %d", vdesc->request)); + PLOG((2, "PIOc_put_vars_tc request = %d", vdesc->request)); /* Only the IO master actually does the call. */ if (ios->iomaster == MPI_ROOT) @@ -1174,14 +1174,14 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset default: return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__); } - LOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr)); + PLOG((2, "PIOc_put_vars_tc io_rank 0 done with pnetcdf call, ierr=%d", ierr)); } else *request = PIO_REQ_NULL; vdesc->nreqs++; flush_output_buffer(file, false, 0); - LOG((2, "PIOc_put_vars_tc flushed output buffer")); + PLOG((2, "PIOc_put_vars_tc flushed output buffer")); } /* endif ndims == 0 */ } @@ -1189,8 +1189,8 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) { - LOG((2, "PIOc_put_vars_tc calling netcdf function file->iotype = %d", - file->iotype)); + PLOG((2, "PIOc_put_vars_tc calling netcdf function file->iotype = %d", + file->iotype)); switch(xtype) { case NC_BYTE: @@ -1250,7 +1250,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset default: return pio_err(ios, file, PIO_EBADTYPE, __FILE__, __LINE__); } - LOG((2, "PIOc_put_vars_tc io_rank 0 done with netcdf call, ierr=%d", ierr)); + PLOG((2, "PIOc_put_vars_tc io_rank 0 done with netcdf call, ierr=%d", ierr)); } /* Free malloced resources. */ @@ -1266,7 +1266,7 @@ PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Offset /* return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); */ /* if (ierr) */ /* return check_netcdf(file, ierr, __FILE__, __LINE__); */ - LOG((2, "PIOc_put_vars_tc bcast netcdf return code %d complete", ierr)); + PLOG((2, "PIOc_put_vars_tc bcast netcdf return code %d complete", ierr)); return PIO_NOERR; } @@ -1362,8 +1362,8 @@ PIOc_put_var_tc(int ncid, int varid, nc_type xtype, const void *op) int ndims; /* The number of dimensions in the variable. */ int ierr; /* Return code from function calls. */ - LOG((1, "PIOc_put_var_tc ncid = %d varid = %d xtype = %d", ncid, - varid, xtype)); + PLOG((1, "PIOc_put_var_tc ncid = %d varid = %d xtype = %d", ncid, + varid, xtype)); /* Find the info about this file. We need this for error handling. */ if ((ierr = pio_get_file(ncid, &file))) @@ -1454,8 +1454,8 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum, var_desc_t *vdesc; /* Pointer to var information. */ int ret; - LOG((1, "PIOc_get_vard_tc ncid %d varid %d decompid %d recnum %d " - "xtype %d", ncid, varid, decompid, recnum, xtype)); + PLOG((1, "PIOc_get_vard_tc ncid %d varid %d decompid %d recnum %d " + "xtype %d", ncid, varid, decompid, recnum, xtype)); /* Get file info. */ if ((ret = pio_get_file(ncid, &file))) @@ -1469,7 +1469,7 @@ PIOc_get_vard_tc(int ncid, int varid, int decompid, const PIO_Offset recnum, /* Get var info. */ if ((ret = get_var_desc(varid, &file->varlist, &vdesc))) return pio_err(ios, file, ret, __FILE__, __LINE__); - LOG((2, "vdesc->pio_type %d", vdesc->pio_type)); + PLOG((2, "vdesc->pio_type %d", vdesc->pio_type)); /* Disallow type conversion for now. */ if (xtype != NC_NAT && xtype != vdesc->pio_type) diff --git a/src/clib/pio_internal.h b/src/clib/pio_internal.h index 6c6146e702a..6fd2523034f 100644 --- a/src/clib/pio_internal.h +++ b/src/clib/pio_internal.h @@ -60,10 +60,10 @@ #if PIO_ENABLE_LOGGING void pio_log(int severity, const char *fmt, ...); -#define LOG(e) pio_log e +#define PLOG(e) pio_log e #else /** Logging macro for debugging. */ -#define LOG(e) +#define PLOG(e) #endif /* PIO_ENABLE_LOGGING */ /** Find maximum. */ diff --git a/src/clib/pio_lists.c b/src/clib/pio_lists.c index 2d236d5e57b..c0d26268144 100644 --- a/src/clib/pio_lists.c +++ b/src/clib/pio_lists.c @@ -49,7 +49,7 @@ pio_get_file(int ncid, file_desc_t **cfile1) { file_desc_t *cfile = NULL; - LOG((2, "pio_get_file ncid = %d", ncid)); + PLOG((2, "pio_get_file ncid = %d", ncid)); /* Caller must provide this. */ if (!cfile1) @@ -133,11 +133,11 @@ pio_delete_iosystem_from_list(int piosysid) { iosystem_desc_t *ciosystem, *piosystem = NULL; - LOG((1, "pio_delete_iosystem_from_list piosysid = %d", piosysid)); + PLOG((1, "pio_delete_iosystem_from_list piosysid = %d", piosysid)); for (ciosystem = pio_iosystem_list; ciosystem; ciosystem = ciosystem->next) { - LOG((3, "ciosystem->iosysid = %d", ciosystem->iosysid)); + PLOG((3, "ciosystem->iosysid = %d", ciosystem->iosysid)); if (ciosystem->iosysid == piosysid) { if (piosystem == NULL) @@ -199,7 +199,7 @@ pio_get_iosystem_from_id(int iosysid) { iosystem_desc_t *ciosystem; - LOG((2, "pio_get_iosystem_from_id iosysid = %d", iosysid)); + PLOG((2, "pio_get_iosystem_from_id iosysid = %d", iosysid)); for (ciosystem = pio_iosystem_list; ciosystem; ciosystem = ciosystem->next) if (ciosystem->iosysid == iosysid) @@ -223,7 +223,7 @@ pio_num_iosystem(int *niosysid) /* Count the elements in the list. */ for (iosystem_desc_t *c = pio_iosystem_list; c; c = c->next) { - LOG((3, "pio_num_iosystem c->iosysid %d", c->iosysid)); + PLOG((3, "pio_num_iosystem c->iosysid %d", c->iosysid)); count++; } diff --git a/src/clib/pio_msg.c b/src/clib/pio_msg.c index cb146cc47e7..cdaceb79b9b 100644 --- a/src/clib/pio_msg.c +++ b/src/clib/pio_msg.c @@ -47,7 +47,7 @@ int inq_type_handler(iosystem_desc_t *ios) PIO_Offset *sizep = NULL, size; int mpierr; - LOG((1, "inq_type_handler")); + PLOG((1, "inq_type_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -70,7 +70,7 @@ int inq_type_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_inq_type(ncid, xtype, namep, sizep); - LOG((1, "inq_type_handler succeeded!")); + PLOG((1, "inq_type_handler succeeded!")); return PIO_NOERR; } @@ -91,7 +91,7 @@ int inq_format_handler(iosystem_desc_t *ios) char format_present; int mpierr; - LOG((1, "inq_format_handler")); + PLOG((1, "inq_format_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -100,8 +100,8 @@ int inq_format_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&format_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "inq_format_handler got parameters ncid = %d format_present = %d", - ncid, format_present)); + PLOG((2, "inq_format_handler got parameters ncid = %d format_present = %d", + ncid, format_present)); /* Manage NULL pointers. */ if (format_present) @@ -110,7 +110,7 @@ int inq_format_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_inq_format(ncid, formatp); - LOG((1, "inq_format_handler succeeded!")); + PLOG((1, "inq_format_handler succeeded!")); return PIO_NOERR; } @@ -131,7 +131,7 @@ int set_fill_handler(iosystem_desc_t *ios) int old_mode, *old_modep = NULL; int mpierr; - LOG((1, "set_fill_handler")); + PLOG((1, "set_fill_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -142,8 +142,8 @@ int set_fill_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&old_modep_present, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "set_fill_handler got parameters ncid = %d fillmode = %d old_modep_present = %d", - ncid, fillmode, old_modep_present)); + PLOG((2, "set_fill_handler got parameters ncid = %d fillmode = %d old_modep_present = %d", + ncid, fillmode, old_modep_present)); /* Manage NULL pointers. */ if (old_modep_present) @@ -152,7 +152,7 @@ int set_fill_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_set_fill(ncid, fillmode, old_modep); - LOG((1, "set_fill_handler succeeded!")); + PLOG((1, "set_fill_handler succeeded!")); return PIO_NOERR; } @@ -174,7 +174,7 @@ int create_file_handler(iosystem_desc_t *ios) int mode; int mpierr; - LOG((1, "create_file_handler comproot = %d", ios->comproot)); + PLOG((1, "create_file_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master @@ -191,14 +191,14 @@ int create_file_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&mode, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "create_file_handler got parameters len = %d filename = %s iotype = %d mode = %d", - len, filename, iotype, mode)); + PLOG((1, "create_file_handler got parameters len = %d filename = %s iotype = %d mode = %d", + len, filename, iotype, mode)); /* Call the create file function. */ PIOc_createfile(ios->iosysid, &ncid, &iotype, filename, mode); - LOG((1, "create_file_handler succeeded!")); + PLOG((1, "create_file_handler succeeded!")); return PIO_NOERR; } @@ -217,19 +217,19 @@ int close_file_handler(iosystem_desc_t *ios) int ncid; int mpierr; - LOG((1, "close_file_handler")); + PLOG((1, "close_file_handler")); assert(ios); /* Get the parameters for this function that the the comp master * task is broadcasting. */ if ((mpierr = MPI_Bcast(&ncid, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "close_file_handler got parameter ncid = %d", ncid)); + PLOG((1, "close_file_handler got parameter ncid = %d", ncid)); /* Call the close file function. */ PIOc_closefile(ncid); - LOG((1, "close_file_handler succeeded!")); + PLOG((1, "close_file_handler succeeded!")); return PIO_NOERR; } @@ -251,7 +251,7 @@ int inq_handler(iosystem_desc_t *ios) char ndims_present, nvars_present, ngatts_present, unlimdimid_present; int mpierr; - LOG((1, "inq_handler")); + PLOG((1, "inq_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -266,8 +266,8 @@ int inq_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&unlimdimid_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "inq_handler ndims_present = %d nvars_present = %d ngatts_present = %d unlimdimid_present = %d", - ndims_present, nvars_present, ngatts_present, unlimdimid_present)); + PLOG((1, "inq_handler ndims_present = %d nvars_present = %d ngatts_present = %d unlimdimid_present = %d", + ndims_present, nvars_present, ngatts_present, unlimdimid_present)); /* NULLs passed in to any of the pointers in the original call * need to be matched with NULLs here. Assign pointers where @@ -306,7 +306,7 @@ int inq_unlimdims_handler(iosystem_desc_t *ios) char nunlimdimsp_present, unlimdimidsp_present; int mpierr; - LOG((1, "inq_unlimdims_handler")); + PLOG((1, "inq_unlimdims_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -317,8 +317,8 @@ int inq_unlimdims_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&unlimdimidsp_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "inq_unlimdims_handler nunlimdimsp_present = %d unlimdimidsp_present = %d", - nunlimdimsp_present, unlimdimidsp_present)); + PLOG((1, "inq_unlimdims_handler nunlimdimsp_present = %d unlimdimidsp_present = %d", + nunlimdimsp_present, unlimdimidsp_present)); /* NULLs passed in to any of the pointers in the original call * need to be matched with NULLs here. Assign pointers where @@ -355,7 +355,7 @@ int inq_dim_handler(iosystem_desc_t *ios, int msg) PIO_Offset dimlen; int mpierr; - LOG((1, "inq_dim_handler")); + PLOG((1, "inq_dim_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -368,8 +368,8 @@ int inq_dim_handler(iosystem_desc_t *ios, int msg) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&len_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "inq_handler name_present = %d len_present = %d", name_present, - len_present)); + PLOG((2, "inq_handler name_present = %d len_present = %d", name_present, + len_present)); /* Set the non-null pointers. */ if (name_present) @@ -401,7 +401,7 @@ int inq_dimid_handler(iosystem_desc_t *ios) char name[PIO_MAX_NAME + 1]; int mpierr; - LOG((1, "inq_dimid_handler")); + PLOG((1, "inq_dimid_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -414,8 +414,8 @@ int inq_dimid_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&id_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "inq_dimid_handler ncid = %d namelen = %d name = %s id_present = %d", - ncid, namelen, name, id_present)); + PLOG((1, "inq_dimid_handler ncid = %d namelen = %d name = %s id_present = %d", + ncid, namelen, name, id_present)); /* Set non-null pointer. */ if (id_present) @@ -447,7 +447,7 @@ int inq_att_handler(iosystem_desc_t *ios) char xtype_present, len_present; int mpierr; - LOG((1, "inq_att_handler")); + PLOG((1, "inq_att_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -496,7 +496,7 @@ int inq_attname_handler(iosystem_desc_t *ios) char name_present; int mpierr; - LOG((1, "inq_att_name_handler")); + PLOG((1, "inq_att_name_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -509,8 +509,8 @@ int inq_attname_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&name_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "inq_attname_handler got ncid = %d varid = %d attnum = %d name_present = %d", - ncid, varid, attnum, name_present)); + PLOG((2, "inq_attname_handler got ncid = %d varid = %d attnum = %d name_present = %d", + ncid, varid, attnum, name_present)); /* Match NULLs in collective function call. */ if (name_present) @@ -541,7 +541,7 @@ int inq_attid_handler(iosystem_desc_t *ios) char id_present; int mpierr; - LOG((1, "inq_attid_handler")); + PLOG((1, "inq_attid_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -556,8 +556,8 @@ int inq_attid_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&id_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "inq_attid_handler got ncid = %d varid = %d id_present = %d", - ncid, varid, id_present)); + PLOG((2, "inq_attid_handler got ncid = %d varid = %d id_present = %d", + ncid, varid, id_present)); /* Match NULLs in collective function call. */ if (id_present) @@ -591,7 +591,7 @@ int att_put_handler(iosystem_desc_t *ios) void *op; int mpierr; - LOG((1, "att_put_handler")); + PLOG((1, "att_put_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -623,9 +623,9 @@ int att_put_handler(iosystem_desc_t *ios) free(op); return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); } - LOG((1, "att_put_handler ncid = %d varid = %d namelen = %d name = %s" - "atttype = %d attlen = %d atttype_len = %d memtype = %d memtype_len = 5d", - ncid, varid, namelen, name, atttype, attlen, atttype_len, memtype, memtype_len)); + PLOG((1, "att_put_handler ncid = %d varid = %d namelen = %d name = %s" + "atttype = %d attlen = %d atttype_len = %d memtype = %d memtype_len = 5d", + ncid, varid, namelen, name, atttype, attlen, atttype_len, memtype, memtype_len)); /* Call the function to write the attribute. */ PIOc_put_att_tc(ncid, varid, name, atttype, attlen, memtype, op); @@ -633,7 +633,7 @@ int att_put_handler(iosystem_desc_t *ios) /* Free resources. */ free(op); - LOG((2, "att_put_handler complete!")); + PLOG((2, "att_put_handler complete!")); return PIO_NOERR; } @@ -660,7 +660,7 @@ int att_get_handler(iosystem_desc_t *ios) int *ip; int iotype; - LOG((1, "att_get_handler")); + PLOG((1, "att_get_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -685,9 +685,9 @@ int att_get_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&memtype_len, 1, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "att_get_handler ncid = %d varid = %d namelen = %d name = %s iotype = %d" - " atttype = %d attlen = %d atttype_len = %d memtype = %d memtype_len = %d", - ncid, varid, namelen, name, iotype, atttype, attlen, atttype_len, memtype, memtype_len)); + PLOG((1, "att_get_handler ncid = %d varid = %d namelen = %d name = %s iotype = %d" + " atttype = %d attlen = %d atttype_len = %d memtype = %d memtype_len = %d", + ncid, varid, namelen, name, iotype, atttype, attlen, atttype_len, memtype, memtype_len)); /* Allocate space for the attribute data. */ if (!(ip = malloc(attlen * memtype_len))) @@ -727,7 +727,7 @@ int put_vars_handler(iosystem_desc_t *ios) PIO_Offset num_elem; /* Number of data elements in the buffer. */ int mpierr; /* Error code from MPI function calls. */ - LOG((1, "put_vars_handler")); + PLOG((1, "put_vars_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -747,7 +747,7 @@ int put_vars_handler(iosystem_desc_t *ios) if (start_present) if ((mpierr = MPI_Bcast(start, ndims, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "put_vars_handler getting start[0] = %d ndims = %d", start[0], ndims)); + PLOG((1, "put_vars_handler getting start[0] = %d ndims = %d", start[0], ndims)); if ((mpierr = MPI_Bcast(&count_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if (count_present) @@ -764,10 +764,10 @@ int put_vars_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&typelen, 1, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "put_vars_handler ncid = %d varid = %d ndims = %d " - "start_present = %d count_present = %d stride_present = %d xtype = %d " - "num_elem = %d typelen = %d", ncid, varid, ndims, start_present, count_present, - stride_present, xtype, num_elem, typelen)); + PLOG((1, "put_vars_handler ncid = %d varid = %d ndims = %d " + "start_present = %d count_present = %d stride_present = %d xtype = %d " + "num_elem = %d typelen = %d", ncid, varid, ndims, start_present, count_present, + stride_present, xtype, num_elem, typelen)); /* Allocate room for our data. */ if (!(buf = malloc(num_elem * typelen))) @@ -868,7 +868,7 @@ int get_vars_handler(iosystem_desc_t *ios) void *buf; /** Buffer for data storage. */ PIO_Offset num_elem; /** Number of data elements in the buffer. */ - LOG((1, "get_vars_handler")); + PLOG((1, "get_vars_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -912,9 +912,9 @@ int get_vars_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&typelen, 1, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "get_vars_handler ncid = %d varid = %d ndims = %d " - "stride_present = %d xtype = %d num_elem = %d typelen = %d", - ncid, varid, ndims, stride_present, xtype, num_elem, typelen)); + PLOG((1, "get_vars_handler ncid = %d varid = %d ndims = %d " + "stride_present = %d xtype = %d num_elem = %d typelen = %d", + ncid, varid, ndims, stride_present, xtype, num_elem, typelen)); /* Allocate room for our data. */ if (!(buf = malloc(num_elem * typelen))) @@ -989,7 +989,7 @@ int get_vars_handler(iosystem_desc_t *ios) if (stride_present) free(stride); - LOG((1, "get_vars_handler succeeded!")); + PLOG((1, "get_vars_handler succeeded!")); return PIO_NOERR; } @@ -1013,7 +1013,7 @@ int inq_var_handler(iosystem_desc_t *ios) int ndims, natts; int mpierr; - LOG((1, "inq_var_handler")); + PLOG((1, "inq_var_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -1032,9 +1032,9 @@ int inq_var_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&natts_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"inq_var_handler ncid = %d varid = %d name_present = %d xtype_present = %d ndims_present = %d " - "dimids_present = %d natts_present = %d", - ncid, varid, name_present, xtype_present, ndims_present, dimids_present, natts_present)); + PLOG((2,"inq_var_handler ncid = %d varid = %d name_present = %d xtype_present = %d ndims_present = %d " + "dimids_present = %d natts_present = %d", + ncid, varid, name_present, xtype_present, ndims_present, dimids_present, natts_present)); /* Set the non-NULL pointers. */ if (name_present) @@ -1044,7 +1044,7 @@ int inq_var_handler(iosystem_desc_t *ios) if (ndims_present) ndimsp = &ndims; if (dimids_present) - dimidsp = dimids; + dimidsp = dimids; if (natts_present) nattsp = &natts; @@ -1052,7 +1052,7 @@ int inq_var_handler(iosystem_desc_t *ios) PIOc_inq_var(ncid, varid, namep, xtypep, ndimsp, dimidsp, nattsp); if (ndims_present) - LOG((2, "inq_var_handler ndims = %d", ndims)); + PLOG((2, "inq_var_handler ndims = %d", ndims)); return PIO_NOERR; } @@ -1075,7 +1075,7 @@ int inq_var_chunking_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "inq_var_chunking_handler")); + PLOG((1, "inq_var_chunking_handler")); /* Get the parameters for this function that the the comp master * task is broadcasting. */ @@ -1089,8 +1089,8 @@ int inq_var_chunking_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&chunksizes_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"inq_var_handler ncid = %d varid = %d storage_present = %d chunksizes_present = %d", - ncid, varid, storage_present, chunksizes_present)); + PLOG((2,"inq_var_handler ncid = %d varid = %d storage_present = %d chunksizes_present = %d", + ncid, varid, storage_present, chunksizes_present)); /* Set the non-NULL pointers. */ if (storage_present) @@ -1103,7 +1103,7 @@ int inq_var_chunking_handler(iosystem_desc_t *ios) PIOc_inq_var_chunking(ncid, varid, storagep, chunksizesp); if(chunksizes_present) - free(chunksizesp); + free(chunksizesp); return PIO_NOERR; } @@ -1126,7 +1126,7 @@ int inq_var_fill_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "inq_var_fill_handler")); + PLOG((1, "inq_var_fill_handler")); /* Get the parameters for this function that the the comp master * task is broadcasting. */ @@ -1140,8 +1140,8 @@ int inq_var_fill_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&fill_value_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"inq_var_fill_handler ncid = %d varid = %d type_size = %lld, fill_mode_present = %d fill_value_present = %d", - ncid, varid, type_size, fill_mode_present, fill_value_present)); + PLOG((2,"inq_var_fill_handler ncid = %d varid = %d type_size = %lld, fill_mode_present = %d fill_value_present = %d", + ncid, varid, type_size, fill_mode_present, fill_value_present)); /* If we need to, alocate storage for fill value. */ if (fill_value_present) @@ -1155,21 +1155,21 @@ int inq_var_fill_handler(iosystem_desc_t *ios) fill_valuep = fill_value; /* Call the inq function to get the values. */ - LOG((3, "inq_var_fill_handlder about to call inq_var_fill")); + PLOG((3, "inq_var_fill_handlder about to call inq_var_fill")); PIOc_inq_var_fill(ncid, varid, fill_modep, fill_valuep); if (fill_modep) - LOG((3, "after inq_var_fill fill_modep %d", *fill_modep)); + PLOG((3, "after inq_var_fill fill_modep %d", *fill_modep)); /* Free fill value storage if we allocated some. */ if (fill_value_present) { - LOG((3, "about to free fill_value")); + PLOG((3, "about to free fill_value")); free(fill_value); - LOG((3, "freed fill_value")); + PLOG((3, "freed fill_value")); } if (fill_modep) - LOG((3, "done with inq_var_fill_handler", *fill_modep)); + PLOG((3, "done with inq_var_fill_handler", *fill_modep)); return PIO_NOERR; } @@ -1189,7 +1189,7 @@ int inq_var_endian_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "inq_var_endian_handler")); + PLOG((1, "inq_var_endian_handler")); /* Get the parameters for this function that the the comp master * task is broadcasting. */ @@ -1199,8 +1199,8 @@ int inq_var_endian_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&endian_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"inq_var_endian_handler ncid = %d varid = %d endian_present = %d", ncid, varid, - endian_present)); + PLOG((2,"inq_var_endian_handler ncid = %d varid = %d endian_present = %d", ncid, varid, + endian_present)); /* Set the non-NULL pointers. */ if (endian_present) @@ -1232,7 +1232,7 @@ int inq_var_deflate_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "inq_var_deflate_handler")); + PLOG((1, "inq_var_deflate_handler")); /* Get the parameters for this function that the the comp master * task is broadcasting. */ @@ -1255,9 +1255,9 @@ int inq_var_deflate_handler(iosystem_desc_t *ios) if (deflate_level_present && !mpierr) if ((mpierr = MPI_Bcast(&deflate_level, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "inq_var_handler ncid = %d varid = %d shuffle_present = %d deflate_present = %d " - "deflate_level_present = %d", ncid, varid, shuffle_present, deflate_present, - deflate_level_present)); + PLOG((2, "inq_var_handler ncid = %d varid = %d shuffle_present = %d deflate_present = %d " + "deflate_level_present = %d", ncid, varid, shuffle_present, deflate_present, + deflate_level_present)); /* Set the non-NULL pointers. */ if (shuffle_present) @@ -1321,19 +1321,19 @@ int sync_file_handler(iosystem_desc_t *ios) int ncid; int mpierr; - LOG((1, "sync_file_handler")); + PLOG((1, "sync_file_handler")); assert(ios); /* Get the parameters for this function that the comp master * task is broadcasting. */ if ((mpierr = MPI_Bcast(&ncid, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "sync_file_handler got parameter ncid = %d", ncid)); + PLOG((1, "sync_file_handler got parameter ncid = %d", ncid)); /* Call the sync file function. */ PIOc_sync(ncid); - LOG((2, "sync_file_handler succeeded!")); + PLOG((2, "sync_file_handler succeeded!")); return PIO_NOERR; } @@ -1354,7 +1354,7 @@ int setframe_handler(iosystem_desc_t *ios) int frame; int mpierr; - LOG((1, "setframe_handler")); + PLOG((1, "setframe_handler")); assert(ios); /* Get the parameters for this function that the comp master @@ -1365,13 +1365,13 @@ int setframe_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&frame, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "setframe_handler got parameter ncid = %d varid = %d frame = %d", - ncid, varid, frame)); + PLOG((1, "setframe_handler got parameter ncid = %d varid = %d frame = %d", + ncid, varid, frame)); /* Call the function. */ PIOc_setframe(ncid, varid, frame); - LOG((2, "setframe_handler succeeded!")); + PLOG((2, "setframe_handler succeeded!")); return PIO_NOERR; } @@ -1391,7 +1391,7 @@ int advanceframe_handler(iosystem_desc_t *ios) int varid; int mpierr; - LOG((1, "advanceframe_handler")); + PLOG((1, "advanceframe_handler")); assert(ios); /* Get the parameters for this function that the comp master @@ -1400,13 +1400,13 @@ int advanceframe_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&varid, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "advanceframe_handler got parameter ncid = %d varid = %d", - ncid, varid)); + PLOG((1, "advanceframe_handler got parameter ncid = %d varid = %d", + ncid, varid)); /* Call the function. */ PIOc_advanceframe(ncid, varid); - LOG((2, "advanceframe_handler succeeded!")); + PLOG((2, "advanceframe_handler succeeded!")); return PIO_NOERR; } @@ -1425,7 +1425,7 @@ int change_def_file_handler(iosystem_desc_t *ios, int msg) int ncid; int mpierr; - LOG((1, "change_def_file_handler")); + PLOG((1, "change_def_file_handler")); assert(ios); /* Get the parameters for this function that the comp master @@ -1439,7 +1439,7 @@ int change_def_file_handler(iosystem_desc_t *ios, int msg) else PIOc_redef(ncid); - LOG((1, "change_def_file_handler succeeded!")); + PLOG((1, "change_def_file_handler succeeded!")); return PIO_NOERR; } @@ -1464,7 +1464,7 @@ int def_var_handler(iosystem_desc_t *ios) int *dimids; int mpierr; - LOG((1, "def_var_handler comproot = %d", ios->comproot)); + PLOG((1, "def_var_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master @@ -1486,8 +1486,8 @@ int def_var_handler(iosystem_desc_t *ios) free(dimids); return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); } - LOG((1, "def_var_handler got parameters namelen = %d " - "name = %s ncid = %d", namelen, name, ncid)); + PLOG((1, "def_var_handler got parameters namelen = %d " + "name = %s ncid = %d", namelen, name, ncid)); /* Call the function. */ PIOc_def_var(ncid, name, xtype, ndims, dimids, &varid); @@ -1495,7 +1495,7 @@ int def_var_handler(iosystem_desc_t *ios) /* Free resources. */ free(dimids); - LOG((1, "def_var_handler succeeded!")); + PLOG((1, "def_var_handler succeeded!")); return PIO_NOERR; } @@ -1517,7 +1517,7 @@ int def_var_chunking_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "def_var_chunking_handler comproot = %d", ios->comproot)); + PLOG((1, "def_var_chunking_handler comproot = %d", ios->comproot)); /* Get the parameters for this function that the he comp master * task is broadcasting. */ @@ -1537,16 +1537,16 @@ int def_var_chunking_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(chunksizesp, ndims, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); } - LOG((1, "def_var_chunking_handler got parameters ncid = %d varid = %d storage = %d " - "ndims = %d chunksizes_present = %d", ncid, varid, storage, ndims, chunksizes_present)); + PLOG((1, "def_var_chunking_handler got parameters ncid = %d varid = %d storage = %d " + "ndims = %d chunksizes_present = %d", ncid, varid, storage, ndims, chunksizes_present)); /* Call the function. */ PIOc_def_var_chunking(ncid, varid, storage, chunksizesp); if(chunksizes_present) - free(chunksizesp); + free(chunksizesp); - LOG((1, "def_var_chunking_handler succeeded!")); + PLOG((1, "def_var_chunking_handler succeeded!")); return PIO_NOERR; } @@ -1568,7 +1568,7 @@ int def_var_fill_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "def_var_fill_handler comproot = %d", ios->comproot)); + PLOG((1, "def_var_fill_handler comproot = %d", ios->comproot)); /* Get the parameters for this function that the he comp master * task is broadcasting. */ @@ -1592,8 +1592,8 @@ int def_var_fill_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); } } - LOG((1, "def_var_fill_handler got parameters ncid = %d varid = %d fill_mode = %d " - "type_size = %lld fill_value_present = %d", ncid, varid, fill_mode, type_size, fill_value_present)); + PLOG((1, "def_var_fill_handler got parameters ncid = %d varid = %d fill_mode = %d " + "type_size = %lld fill_value_present = %d", ncid, varid, fill_mode, type_size, fill_value_present)); /* Call the function. */ PIOc_def_var_fill(ncid, varid, fill_mode, fill_valuep); @@ -1602,7 +1602,7 @@ int def_var_fill_handler(iosystem_desc_t *ios) if (fill_valuep) free(fill_valuep); - LOG((1, "def_var_fill_handler succeeded!")); + PLOG((1, "def_var_fill_handler succeeded!")); return PIO_NOERR; } @@ -1621,7 +1621,7 @@ int def_var_endian_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "def_var_endian_handler comproot = %d", ios->comproot)); + PLOG((1, "def_var_endian_handler comproot = %d", ios->comproot)); /* Get the parameters for this function that the he comp master * task is broadcasting. */ @@ -1631,13 +1631,13 @@ int def_var_endian_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&endian, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "def_var_endian_handler got parameters ncid = %d varid = %d endain = %d ", - ncid, varid, endian)); + PLOG((1, "def_var_endian_handler got parameters ncid = %d varid = %d endain = %d ", + ncid, varid, endian)); /* Call the function. */ PIOc_def_var_endian(ncid, varid, endian); - LOG((1, "def_var_chunking_handler succeeded!")); + PLOG((1, "def_var_chunking_handler succeeded!")); return PIO_NOERR; } @@ -1658,7 +1658,7 @@ int def_var_deflate_handler(iosystem_desc_t *ios) int mpierr; assert(ios); - LOG((1, "def_var_deflate_handler comproot = %d", ios->comproot)); + PLOG((1, "def_var_deflate_handler comproot = %d", ios->comproot)); /* Get the parameters for this function that the he comp master * task is broadcasting. */ @@ -1672,13 +1672,13 @@ int def_var_deflate_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&deflate_level, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "def_var_deflate_handler got parameters ncid = %d varid = %d shuffle = %d ", - "deflate = %d deflate_level = %d", ncid, varid, shuffle, deflate, deflate_level)); + PLOG((1, "def_var_deflate_handler got parameters ncid = %d varid = %d shuffle = %d ", + "deflate = %d deflate_level = %d", ncid, varid, shuffle, deflate, deflate_level)); /* Call the function. */ PIOc_def_var_deflate(ncid, varid, shuffle, deflate, deflate_level); - LOG((1, "def_var_deflate_handler succeeded!")); + PLOG((1, "def_var_deflate_handler succeeded!")); return PIO_NOERR; } @@ -1699,7 +1699,7 @@ int set_var_chunk_cache_handler(iosystem_desc_t *ios) int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ assert(ios); - LOG((1, "set_var_chunk_cache_handler comproot = %d", ios->comproot)); + PLOG((1, "set_var_chunk_cache_handler comproot = %d", ios->comproot)); /* Get the parameters for this function that the he comp master * task is broadcasting. */ @@ -1713,13 +1713,13 @@ int set_var_chunk_cache_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&preemption, 1, MPI_FLOAT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "set_var_chunk_cache_handler got params ncid = %d varid = %d size = %d " - "nelems = %d preemption = %g", ncid, varid, size, nelems, preemption)); + PLOG((1, "set_var_chunk_cache_handler got params ncid = %d varid = %d size = %d " + "nelems = %d preemption = %g", ncid, varid, size, nelems, preemption)); /* Call the function. */ PIOc_set_var_chunk_cache(ncid, varid, size, nelems, preemption); - LOG((1, "def_var_chunk_cache_handler succeeded!")); + PLOG((1, "def_var_chunk_cache_handler succeeded!")); return PIO_NOERR; } @@ -1741,7 +1741,7 @@ int def_dim_handler(iosystem_desc_t *ios) int dimid; int mpierr; - LOG((1, "def_dim_handler comproot = %d", ios->comproot)); + PLOG((1, "def_dim_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master @@ -1754,13 +1754,13 @@ int def_dim_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&len, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "def_dim_handler got parameters namelen = %d " - "name = %s len = %d ncid = %d", namelen, name, len, ncid)); + PLOG((2, "def_dim_handler got parameters namelen = %d " + "name = %s len = %d ncid = %d", namelen, name, len, ncid)); /* Call the function. */ PIOc_def_dim(ncid, name, len, &dimid); - LOG((1, "def_dim_handler succeeded!")); + PLOG((1, "def_dim_handler succeeded!")); return PIO_NOERR; } @@ -1782,7 +1782,7 @@ int rename_dim_handler(iosystem_desc_t *ios) int dimid; int mpierr; - LOG((1, "rename_dim_handler")); + PLOG((1, "rename_dim_handler")); assert(ios); /* Get the parameters for this function that the he comp master @@ -1795,13 +1795,13 @@ int rename_dim_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(name, namelen + 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "rename_dim_handler got parameters namelen = %d " - "name = %s ncid = %d dimid = %d", namelen, name, ncid, dimid)); + PLOG((2, "rename_dim_handler got parameters namelen = %d " + "name = %s ncid = %d dimid = %d", namelen, name, ncid, dimid)); /* Call the function. */ PIOc_rename_dim(ncid, dimid, name); - LOG((1, "rename_dim_handler succeeded!")); + PLOG((1, "rename_dim_handler succeeded!")); return PIO_NOERR; } @@ -1823,7 +1823,7 @@ int rename_var_handler(iosystem_desc_t *ios) int varid; int mpierr; - LOG((1, "rename_var_handler")); + PLOG((1, "rename_var_handler")); assert(ios); /* Get the parameters for this function that the he comp master @@ -1836,13 +1836,13 @@ int rename_var_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(name, namelen + 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "rename_var_handler got parameters namelen = %d " - "name = %s ncid = %d varid = %d", namelen, name, ncid, varid)); + PLOG((2, "rename_var_handler got parameters namelen = %d " + "name = %s ncid = %d varid = %d", namelen, name, ncid, varid)); /* Call the function. */ PIOc_rename_var(ncid, varid, name); - LOG((1, "rename_var_handler succeeded!")); + PLOG((1, "rename_var_handler succeeded!")); return PIO_NOERR; } @@ -1864,7 +1864,7 @@ int rename_att_handler(iosystem_desc_t *ios) char name[PIO_MAX_NAME + 1], newname[PIO_MAX_NAME + 1]; int mpierr; - LOG((1, "rename_att_handler")); + PLOG((1, "rename_att_handler")); assert(ios); /* Get the parameters for this function that the he comp master @@ -1881,13 +1881,13 @@ int rename_att_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(newname, newnamelen + 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "rename_att_handler got parameters namelen = %d name = %s ncid = %d varid = %d " - "newnamelen = %d newname = %s", namelen, name, ncid, varid, newnamelen, newname)); + PLOG((2, "rename_att_handler got parameters namelen = %d name = %s ncid = %d varid = %d " + "newnamelen = %d newname = %s", namelen, name, ncid, varid, newnamelen, newname)); /* Call the function. */ PIOc_rename_att(ncid, varid, name, newname); - LOG((1, "rename_att_handler succeeded!")); + PLOG((1, "rename_att_handler succeeded!")); return PIO_NOERR; } @@ -1909,7 +1909,7 @@ int delete_att_handler(iosystem_desc_t *ios) char name[PIO_MAX_NAME + 1]; int mpierr; - LOG((1, "delete_att_handler")); + PLOG((1, "delete_att_handler")); assert(ios); /* Get the parameters for this function that the he comp master @@ -1922,13 +1922,13 @@ int delete_att_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(name, namelen + 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "delete_att_handler namelen = %d name = %s ncid = %d varid = %d ", - namelen, name, ncid, varid)); + PLOG((2, "delete_att_handler namelen = %d name = %s ncid = %d varid = %d ", + namelen, name, ncid, varid)); /* Call the function. */ PIOc_del_att(ncid, varid, name); - LOG((1, "delete_att_handler succeeded!")); + PLOG((1, "delete_att_handler succeeded!")); return PIO_NOERR; } @@ -1950,14 +1950,14 @@ int open_file_handler(iosystem_desc_t *ios) int mode; int mpierr; - LOG((1, "open_file_handler comproot = %d", ios->comproot)); + PLOG((1, "open_file_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master * task is broadcasting. */ if ((mpierr = MPI_Bcast(&len, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "open_file_handler got parameter len = %d", len)); + PLOG((2, "open_file_handler got parameter len = %d", len)); /* Get space for the filename. */ char filename[len + 1]; @@ -1969,8 +1969,8 @@ int open_file_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(&mode, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "open_file_handler got parameters len = %d filename = %s iotype = %d mode = %d", - len, filename, iotype, mode)); + PLOG((2, "open_file_handler got parameters len = %d filename = %s iotype = %d mode = %d", + len, filename, iotype, mode)); /* Call the open file function. Errors are handling within * function, so return code can be ignored. */ @@ -1994,7 +1994,7 @@ int delete_file_handler(iosystem_desc_t *ios) int len; int mpierr; - LOG((1, "delete_file_handler comproot = %d", ios->comproot)); + PLOG((1, "delete_file_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master @@ -2007,13 +2007,13 @@ int delete_file_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(filename, len + 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "delete_file_handler got parameters len = %d filename = %s", - len, filename)); + PLOG((1, "delete_file_handler got parameters len = %d filename = %s", + len, filename)); /* Call the delete file function. */ PIOc_deletefile(ios->iosysid, filename); - LOG((1, "delete_file_handler succeeded!")); + PLOG((1, "delete_file_handler succeeded!")); return PIO_NOERR; } @@ -2040,7 +2040,7 @@ int initdecomp_dof_handler(iosystem_desc_t *ios) PIO_Offset *iocountp = NULL; int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ - LOG((1, "initdecomp_dof_handler called")); + PLOG((1, "initdecomp_dof_handler called")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2090,9 +2090,9 @@ int initdecomp_dof_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(iocount, ndims, MPI_OFFSET, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "initdecomp_dof_handler iosysid = %d pio_type = %d ndims = %d maplen = %d " - "rearranger_present = %d iostart_present = %d iocount_present = %d ", - iosysid, pio_type, ndims, maplen, rearranger_present, iostart_present, iocount_present)); + PLOG((2, "initdecomp_dof_handler iosysid = %d pio_type = %d ndims = %d maplen = %d " + "rearranger_present = %d iostart_present = %d iocount_present = %d ", + iosysid, pio_type, ndims, maplen, rearranger_present, iostart_present, iocount_present)); if (rearranger_present) rearrangerp = &rearranger; @@ -2105,7 +2105,7 @@ int initdecomp_dof_handler(iosystem_desc_t *ios) PIOc_InitDecomp(iosysid, pio_type, ndims, dims, maplen, compmap, &ioid, rearrangerp, iostartp, iocountp); - LOG((1, "PIOc_InitDecomp returned")); + PLOG((1, "PIOc_InitDecomp returned")); free(compmap); return PIO_NOERR; @@ -2140,7 +2140,7 @@ int write_darray_multi_handler(iosystem_desc_t *ios) int mpierr; int ret; - LOG((1, "write_darray_multi_handler")); + PLOG((1, "write_darray_multi_handler")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2186,9 +2186,9 @@ int write_darray_multi_handler(iosystem_desc_t *ios) } if ((mpierr = MPI_Bcast(&flushtodisk, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "write_darray_multi_handler ncid = %d nvars = %d ioid = %d arraylen = %d " - "frame_present = %d fillvalue_present flushtodisk = %d", ncid, nvars, - ioid, arraylen, frame_present, fillvalue_present, flushtodisk)); + PLOG((1, "write_darray_multi_handler ncid = %d nvars = %d ioid = %d arraylen = %d " + "frame_present = %d fillvalue_present flushtodisk = %d", ncid, nvars, + ioid, arraylen, frame_present, fillvalue_present, flushtodisk)); /* Get file info based on ncid. */ if ((ret = pio_get_file(ncid, &file))) @@ -2218,7 +2218,7 @@ int write_darray_multi_handler(iosystem_desc_t *ios) free(fillvalue); free(array); - LOG((1, "write_darray_multi_handler succeeded!")); + PLOG((1, "write_darray_multi_handler succeeded!")); return PIO_NOERR; } @@ -2257,7 +2257,7 @@ int seterrorhandling_handler(iosystem_desc_t *ios) int *old_methodp = NULL; int mpierr; - LOG((1, "seterrorhandling_handler comproot = %d", ios->comproot)); + PLOG((1, "seterrorhandling_handler comproot = %d", ios->comproot)); assert(ios); /* Get the parameters for this function that the he comp master @@ -2267,8 +2267,8 @@ int seterrorhandling_handler(iosystem_desc_t *ios) if ((mpierr = MPI_Bcast(&old_method_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "seterrorhandling_handler got parameters method = %d old_method_present = %d", - method, old_method_present)); + PLOG((1, "seterrorhandling_handler got parameters method = %d old_method_present = %d", + method, old_method_present)); if (old_method_present) old_methodp = &old_method; @@ -2276,7 +2276,7 @@ int seterrorhandling_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_set_iosystem_error_handling(ios->iosysid, method, old_methodp); - LOG((1, "seterrorhandling_handler succeeded!")); + PLOG((1, "seterrorhandling_handler succeeded!")); return PIO_NOERR; } @@ -2298,7 +2298,7 @@ int set_chunk_cache_handler(iosystem_desc_t *ios) float preemption; int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ - LOG((1, "set_chunk_cache_handler called")); + PLOG((1, "set_chunk_cache_handler called")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2313,13 +2313,13 @@ int set_chunk_cache_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&preemption, 1, MPI_FLOAT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "set_chunk_cache_handler got params iosysid = %d iotype = %d size = %d " - "nelems = %d preemption = %g", iosysid, iotype, size, nelems, preemption)); + PLOG((1, "set_chunk_cache_handler got params iosysid = %d iotype = %d size = %d " + "nelems = %d preemption = %g", iosysid, iotype, size, nelems, preemption)); /* Call the function. */ PIOc_set_chunk_cache(iosysid, iotype, size, nelems, preemption); - LOG((1, "set_chunk_cache_handler succeeded!")); + PLOG((1, "set_chunk_cache_handler succeeded!")); return PIO_NOERR; } @@ -2342,7 +2342,7 @@ int get_chunk_cache_handler(iosystem_desc_t *ios) float preemption, *preemptionp = NULL; int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ - LOG((1, "get_chunk_cache_handler called")); + PLOG((1, "get_chunk_cache_handler called")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2357,9 +2357,9 @@ int get_chunk_cache_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&preemption_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "get_chunk_cache_handler got params iosysid = %d iotype = %d size_present = %d " - "nelems_present = %d preemption_present = %g", iosysid, iotype, size_present, - nelems_present, preemption_present)); + PLOG((1, "get_chunk_cache_handler got params iosysid = %d iotype = %d size_present = %d " + "nelems_present = %d preemption_present = %g", iosysid, iotype, size_present, + nelems_present, preemption_present)); /* Set the non-NULL pointers. */ if (size_present) @@ -2372,7 +2372,7 @@ int get_chunk_cache_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_get_chunk_cache(iosysid, iotype, sizep, nelemsp, preemptionp); - LOG((1, "get_chunk_cache_handler succeeded!")); + PLOG((1, "get_chunk_cache_handler succeeded!")); return PIO_NOERR; } @@ -2395,7 +2395,7 @@ int get_var_chunk_cache_handler(iosystem_desc_t *ios) float preemption, *preemptionp = NULL; int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ - LOG((1, "get_var_chunk_cache_handler called")); + PLOG((1, "get_var_chunk_cache_handler called")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2410,9 +2410,9 @@ int get_var_chunk_cache_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&preemption_present, 1, MPI_CHAR, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "get_var_chunk_cache_handler got params ncid = %d varid = %d size_present = %d " - "nelems_present = %d preemption_present = %g", ncid, varid, size_present, - nelems_present, preemption_present)); + PLOG((1, "get_var_chunk_cache_handler got params ncid = %d varid = %d size_present = %d " + "nelems_present = %d preemption_present = %g", ncid, varid, size_present, + nelems_present, preemption_present)); /* Set the non-NULL pointers. */ if (size_present) @@ -2425,7 +2425,7 @@ int get_var_chunk_cache_handler(iosystem_desc_t *ios) /* Call the function. */ PIOc_get_var_chunk_cache(ncid, varid, sizep, nelemsp, preemptionp); - LOG((1, "get_var_chunk_cache_handler succeeded!")); + PLOG((1, "get_var_chunk_cache_handler succeeded!")); return PIO_NOERR; } @@ -2443,7 +2443,7 @@ int freedecomp_handler(iosystem_desc_t *ios) int ioid; int mpierr = MPI_SUCCESS; /* Return code from MPI function codes. */ - LOG((1, "freedecomp_handler called")); + PLOG((1, "freedecomp_handler called")); assert(ios); /* Get the parameters for this function that the the comp master @@ -2452,12 +2452,12 @@ int freedecomp_handler(iosystem_desc_t *ios) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Bcast(&ioid, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "freedecomp_handler iosysid = %d ioid = %d", iosysid, ioid)); + PLOG((2, "freedecomp_handler iosysid = %d ioid = %d", iosysid, ioid)); /* Call the function. */ PIOc_freedecomp(iosysid, ioid); - LOG((1, "PIOc_freedecomp returned")); + PLOG((1, "PIOc_freedecomp returned")); return PIO_NOERR; } @@ -2476,19 +2476,19 @@ int finalize_handler(iosystem_desc_t *ios, int index) int iosysid; int mpierr; - LOG((1, "finalize_handler called index = %d", index)); + PLOG((1, "finalize_handler called index = %d", index)); assert(ios); /* Get the parameters for this function that the the comp master * task is broadcasting. */ if ((mpierr = MPI_Bcast(&iosysid, 1, MPI_INT, 0, ios->intercomm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "finalize_handler got parameter iosysid = %d", iosysid)); + PLOG((1, "finalize_handler got parameter iosysid = %d", iosysid)); /* Call the function. */ PIOc_finalize(iosysid); - LOG((1, "finalize_handler succeeded!")); + PLOG((1, "finalize_handler succeeded!")); return PIO_NOERR; } @@ -2516,7 +2516,7 @@ int pio_msg_handler2(int io_rank, int component_count, iosystem_desc_t **iosys, int mpierr; int ret = PIO_NOERR; - LOG((1, "pio_msg_handler2 called")); + PLOG((1, "pio_msg_handler2 called")); assert(iosys); /* Have IO comm rank 0 (the ioroot) register to receive @@ -2526,51 +2526,51 @@ int pio_msg_handler2(int io_rank, int component_count, iosystem_desc_t **iosys, for (int cmp = 0; cmp < component_count; cmp++) { my_iosys = iosys[cmp]; - LOG((1, "about to call MPI_Irecv union_comm = %d", my_iosys->union_comm)); + PLOG((1, "about to call MPI_Irecv union_comm = %d", my_iosys->union_comm)); if ((mpierr = MPI_Irecv(&(messages[cmp]), 1, MPI_INT, my_iosys->comproot, MPI_ANY_TAG, my_iosys->union_comm, &req[cmp]))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "MPI_Irecv req[%d] = %d", cmp, req[cmp])); + PLOG((1, "MPI_Irecv req[%d] = %d", cmp, req[cmp])); } } /* Keep processing messages until loop is broken. */ while (1) { - LOG((3, "pio_msg_handler2 at top of loop")); + PLOG((3, "pio_msg_handler2 at top of loop")); /* Wait until any one of the requests are complete. Once it * returns, the Waitany function automatically sets the * appropriate member of the req array to MPI_REQUEST_NULL. */ if (!io_rank) { - LOG((1, "about to call MPI_Waitany req[0] = %d MPI_REQUEST_NULL = %d", - req[0], MPI_REQUEST_NULL)); + PLOG((1, "about to call MPI_Waitany req[0] = %d MPI_REQUEST_NULL = %d", + req[0], MPI_REQUEST_NULL)); for (int c = 0; c < component_count; c++) - LOG((3, "req[%d] = %d", c, req[c])); + PLOG((3, "req[%d] = %d", c, req[c])); if ((mpierr = MPI_Waitany(component_count, req, &index, &status))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "Waitany returned index = %d req[%d] = %d", index, index, req[index])); - msg = messages[index]; + PLOG((3, "Waitany returned index = %d req[%d] = %d", index, index, req[index])); + msg = messages[index]; for (int c = 0; c < component_count; c++) - LOG((3, "req[%d] = %d", c, req[c])); + PLOG((3, "req[%d] = %d", c, req[c])); } /* Broadcast the index of the computational component that * originated the request to the rest of the IO tasks. */ - LOG((3, "About to do Bcast of index = %d io_comm = %d", index, io_comm)); + PLOG((3, "About to do Bcast of index = %d io_comm = %d", index, io_comm)); if ((mpierr = MPI_Bcast(&index, 1, MPI_INT, 0, io_comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "index MPI_Bcast complete index = %d", index)); + PLOG((3, "index MPI_Bcast complete index = %d", index)); /* Set the correct iosys depending on the index. */ my_iosys = iosys[index]; /* Broadcast the msg value to the rest of the IO tasks. */ - LOG((3, "about to call msg MPI_Bcast io_comm = %d", io_comm)); + PLOG((3, "about to call msg MPI_Bcast io_comm = %d", io_comm)); if ((mpierr = MPI_Bcast(&msg, 1, MPI_INT, 0, io_comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((1, "pio_msg_handler2 msg MPI_Bcast complete msg = %d", msg)); + PLOG((1, "pio_msg_handler2 msg MPI_Bcast complete msg = %d", msg)); /* Handle the message. This code is run on all IO tasks. */ switch (msg) @@ -2722,12 +2722,12 @@ int pio_msg_handler2(int io_rank, int component_count, iosystem_desc_t **iosys, ret = finalize_handler(my_iosys, index); break; default: - LOG((0, "unknown message received %d", msg)); + PLOG((0, "unknown message received %d", msg)); return PIO_EINVAL; } /* If an error was returned by the handler, exit. */ - LOG((3, "pio_msg_handler2 ret %d msg %d index %d io_rank %d", ret, msg, index, io_rank)); + PLOG((3, "pio_msg_handler2 ret %d msg %d index %d io_rank %d", ret, msg, index, io_rank)); if (ret) return pio_err(my_iosys, NULL, ret, __FILE__, __LINE__); @@ -2736,17 +2736,17 @@ int pio_msg_handler2(int io_rank, int component_count, iosystem_desc_t **iosys, if (!io_rank && !finalize) { my_iosys = iosys[index]; - LOG((3, "pio_msg_handler2 about to Irecv index = %d comproot = %d union_comm = %d", - index, my_iosys->comproot, my_iosys->union_comm)); + PLOG((3, "pio_msg_handler2 about to Irecv index = %d comproot = %d union_comm = %d", + index, my_iosys->comproot, my_iosys->union_comm)); if ((mpierr = MPI_Irecv(&(messages[index]), 1, MPI_INT, my_iosys->comproot, MPI_ANY_TAG, my_iosys->union_comm, &req[index]))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "pio_msg_handler2 called MPI_Irecv req[%d] = %d", index, req[index])); + PLOG((3, "pio_msg_handler2 called MPI_Irecv req[%d] = %d", index, req[index])); } - LOG((3, "pio_msg_handler2 done msg = %d open_components = %d", - msg, open_components)); - msg = PIO_MSG_NULL; + PLOG((3, "pio_msg_handler2 done msg = %d open_components = %d", + msg, open_components)); + msg = PIO_MSG_NULL; /* If there are no more open components, exit. */ if (finalize) { @@ -2757,6 +2757,6 @@ int pio_msg_handler2(int io_rank, int component_count, iosystem_desc_t **iosys, } } - LOG((3, "returning from pio_msg_handler2")); + PLOG((3, "returning from pio_msg_handler2")); return PIO_NOERR; } diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index 7223025e0fc..5af2160b986 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -100,7 +100,7 @@ PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function calls. */ - LOG((1, "PIOc_inq ncid = %d", ncid)); + PLOG((1, "PIOc_inq ncid = %d", ncid)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -131,8 +131,8 @@ PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) mpierr = MPI_Bcast(&ngatts_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&unlimdimid_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq ncid = %d ndims_present = %d nvars_present = %d ngatts_present = %d unlimdimid_present = %d", - ncid, ndims_present, nvars_present, ngatts_present, unlimdimid_present)); + PLOG((2, "PIOc_inq ncid = %d ndims_present = %d nvars_present = %d ngatts_present = %d unlimdimid_present = %d", + ncid, ndims_present, nvars_present, ngatts_present, unlimdimid_present)); } /* Handle MPI errors. */ @@ -150,21 +150,21 @@ PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) { ierr = ncmpi_inq(file->fh, ndimsp, nvarsp, ngattsp, unlimdimidp); if (unlimdimidp) - LOG((2, "PIOc_inq returned from ncmpi_inq unlimdimid = %d", *unlimdimidp)); + PLOG((2, "PIOc_inq returned from ncmpi_inq unlimdimid = %d", *unlimdimidp)); } #endif /* _PNETCDF */ if (file->iotype == PIO_IOTYPE_NETCDF && file->do_io) { - LOG((2, "PIOc_inq calling classic nc_inq")); + PLOG((2, "PIOc_inq calling classic nc_inq")); /* Should not be necessary to do this - nc_inq should * handle null pointers. This has been reported as a bug * to netCDF developers. */ int tmp_ndims, tmp_nvars, tmp_ngatts, tmp_unlimdimid; - LOG((2, "PIOc_inq calling classic nc_inq")); + PLOG((2, "PIOc_inq calling classic nc_inq")); ierr = nc_inq(file->fh, &tmp_ndims, &tmp_nvars, &tmp_ngatts, &tmp_unlimdimid); - LOG((2, "PIOc_inq calling classic nc_inq")); + PLOG((2, "PIOc_inq calling classic nc_inq")); if (unlimdimidp) - LOG((2, "classic tmp_unlimdimid = %d", tmp_unlimdimid)); + PLOG((2, "classic tmp_unlimdimid = %d", tmp_unlimdimid)); if (ndimsp) *ndimsp = tmp_ndims; if (nvarsp) @@ -174,15 +174,15 @@ PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) if (unlimdimidp) *unlimdimidp = tmp_unlimdimid; if (unlimdimidp) - LOG((2, "classic unlimdimid = %d", *unlimdimidp)); + PLOG((2, "classic unlimdimid = %d", *unlimdimidp)); } else if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) { - LOG((2, "PIOc_inq calling netcdf-4 nc_inq")); + PLOG((2, "PIOc_inq calling netcdf-4 nc_inq")); ierr = nc_inq(file->fh, ndimsp, nvarsp, ngattsp, unlimdimidp); } - LOG((2, "PIOc_inq netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -224,7 +224,7 @@ PIOc_inq(int ncid, int *ndimsp, int *nvarsp, int *ngattsp, int *unlimdimidp) int PIOc_inq_ndims(int ncid, int *ndimsp) { - LOG((1, "PIOc_inq_ndims")); + PLOG((1, "PIOc_inq_ndims")); return PIOc_inq(ncid, ndimsp, NULL, NULL, NULL); } @@ -271,7 +271,7 @@ PIOc_inq_natts(int ncid, int *ngattsp) int PIOc_inq_unlimdim(int ncid, int *unlimdimidp) { - LOG((1, "PIOc_inq_unlimdim ncid = %d", ncid)); + PLOG((1, "PIOc_inq_unlimdim ncid = %d", ncid)); return PIOc_inq(ncid, NULL, NULL, NULL, unlimdimidp); } @@ -297,7 +297,7 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function calls. */ - LOG((1, "PIOc_inq_unlimdims ncid = %d", ncid)); + PLOG((1, "PIOc_inq_unlimdims ncid = %d", ncid)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -322,8 +322,8 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) mpierr = MPI_Bcast(&nunlimdimsp_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&unlimdimidsp_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq_unlimdims ncid = %d nunlimdimsp_present = %d unlimdimidsp_present = %d", - ncid, nunlimdimsp_present, unlimdimidsp_present)); + PLOG((2, "PIOc_inq_unlimdims ncid = %d nunlimdimsp_present = %d unlimdimidsp_present = %d", + ncid, nunlimdimsp_present, unlimdimidsp_present)); } /* Handle MPI errors. */ @@ -333,16 +333,16 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); } - LOG((2, "file->iotype = %d", file->iotype)); + PLOG((2, "file->iotype = %d", file->iotype)); /* If this is an IO task, then call the netCDF function. */ if (ios->ioproc) { if (file->iotype == PIO_IOTYPE_NETCDF && file->do_io) { - LOG((2, "netcdf")); + PLOG((2, "netcdf")); int tmp_unlimdimid; ierr = nc_inq_unlimdim(file->fh, &tmp_unlimdimid); - LOG((2, "classic tmp_unlimdimid = %d", tmp_unlimdimid)); + PLOG((2, "classic tmp_unlimdimid = %d", tmp_unlimdimid)); tmp_nunlimdims = tmp_unlimdimid >= 0 ? 1 : 0; if (nunlimdimsp) *nunlimdimsp = tmp_unlimdimid >= 0 ? 1 : 0; @@ -352,10 +352,10 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) #ifdef _PNETCDF else if (file->iotype == PIO_IOTYPE_PNETCDF) { - LOG((2, "pnetcdf")); + PLOG((2, "pnetcdf")); int tmp_unlimdimid; ierr = ncmpi_inq_unlimdim(file->fh, &tmp_unlimdimid); - LOG((2, "pnetcdf tmp_unlimdimid = %d", tmp_unlimdimid)); + PLOG((2, "pnetcdf tmp_unlimdimid = %d", tmp_unlimdimid)); tmp_nunlimdims = tmp_unlimdimid >= 0 ? 1 : 0; if (nunlimdimsp) *nunlimdimsp = tmp_nunlimdims; @@ -367,14 +367,14 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) else if ((file->iotype == PIO_IOTYPE_NETCDF4C || file->iotype == PIO_IOTYPE_NETCDF4P) && file->do_io) { - LOG((2, "PIOc_inq calling netcdf-4 nc_inq_unlimdims")); + PLOG((2, "PIOc_inq calling netcdf-4 nc_inq_unlimdims")); int *tmp_unlimdimids; ierr = nc_inq_unlimdims(file->fh, &tmp_nunlimdims, NULL); if (!ierr) { if (nunlimdimsp) *nunlimdimsp = tmp_nunlimdims; - LOG((3, "tmp_nunlimdims = %d", tmp_nunlimdims)); + PLOG((3, "tmp_nunlimdims = %d", tmp_nunlimdims)); if (!(tmp_unlimdimids = malloc(tmp_nunlimdims * sizeof(int)))) ierr = PIO_ENOMEM; if (!ierr) @@ -382,7 +382,7 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) if (unlimdimidsp) for (int d = 0; d < tmp_nunlimdims; d++) { - LOG((3, "tmp_unlimdimids[%d] = %d", d, tmp_unlimdimids[d])); + PLOG((3, "tmp_unlimdimids[%d] = %d", d, tmp_unlimdimids[d])); unlimdimidsp[d] = tmp_unlimdimids[d]; } free(tmp_unlimdimids); @@ -390,7 +390,7 @@ PIOc_inq_unlimdims(int ncid, int *nunlimdimsp, int *unlimdimidsp) } #endif /* _NETCDF4 */ - LOG((2, "PIOc_inq_unlimdims netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq_unlimdims netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -433,7 +433,7 @@ PIOc_inq_type(int ncid, nc_type xtype, char *name, PIO_Offset *sizep) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq_type ncid = %d xtype = %d", ncid, xtype)); + PLOG((1, "PIOc_inq_type ncid = %d xtype = %d", ncid, xtype)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -479,7 +479,7 @@ PIOc_inq_type(int ncid, nc_type xtype, char *name, PIO_Offset *sizep) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_type(file->fh, xtype, name, (size_t *)sizep); - LOG((2, "PIOc_inq_type netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq_type netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -524,7 +524,7 @@ PIOc_inq_format(int ncid, int *formatp) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq ncid = %d", ncid)); + PLOG((1, "PIOc_inq ncid = %d", ncid)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -565,7 +565,7 @@ PIOc_inq_format(int ncid, int *formatp) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_format(file->fh, formatp); - LOG((2, "PIOc_inq netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -609,7 +609,7 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq_dim ncid = %d dimid = %d", ncid, dimid)); + PLOG((1, "PIOc_inq_dim ncid = %d dimid = %d", ncid, dimid)); /* Get the file info, based on the ncid. */ if ((ierr = pio_get_file(ncid, &file))) @@ -634,10 +634,10 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) mpierr = MPI_Bcast(&dimid, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&name_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq netcdf Bcast name_present = %d", name_present)); + PLOG((2, "PIOc_inq netcdf Bcast name_present = %d", name_present)); if (!mpierr) mpierr = MPI_Bcast(&len_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq netcdf Bcast len_present = %d", len_present)); + PLOG((2, "PIOc_inq netcdf Bcast len_present = %d", len_present)); } /* Handle MPI errors. */ @@ -653,17 +653,17 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { - LOG((2, "calling ncmpi_inq_dim")); + PLOG((2, "calling ncmpi_inq_dim")); ierr = ncmpi_inq_dim(file->fh, dimid, name, lenp);; } #endif /* _PNETCDF */ if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) { - LOG((2, "calling nc_inq_dim")); + PLOG((2, "calling nc_inq_dim")); ierr = nc_inq_dim(file->fh, dimid, name, (size_t *)lenp);; } - LOG((2, "ierr = %d", ierr)); + PLOG((2, "ierr = %d", ierr)); } /* Broadcast and check the return code. */ @@ -676,7 +676,7 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) if (name) { int slen; - LOG((2, "bcasting results my_comm = %d", ios->my_comm)); + PLOG((2, "bcasting results my_comm = %d", ios->my_comm)); if (ios->iomaster == MPI_ROOT) slen = strlen(name); if ((mpierr = MPI_Bcast(&slen, 1, MPI_INT, ios->ioroot, ios->my_comm))) @@ -689,7 +689,7 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) if ((mpierr = MPI_Bcast(lenp , 1, MPI_OFFSET, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "done with PIOc_inq_dim")); + PLOG((2, "done with PIOc_inq_dim")); return PIO_NOERR; } @@ -707,7 +707,7 @@ PIOc_inq_dim(int ncid, int dimid, char *name, PIO_Offset *lenp) int PIOc_inq_dimname(int ncid, int dimid, char *name) { - LOG((1, "PIOc_inq_dimname ncid = %d dimid = %d", ncid, dimid)); + PLOG((1, "PIOc_inq_dimname ncid = %d dimid = %d", ncid, dimid)); return PIOc_inq_dim(ncid, dimid, name, NULL); } @@ -756,13 +756,13 @@ PIOc_inq_dimid(int ncid, const char *name, int *idp) if ((ierr = pio_get_file(ncid, &file))) return pio_err(NULL, NULL, ierr, __FILE__, __LINE__); ios = file->iosystem; - LOG((2, "iosysid = %d", ios->iosysid)); + PLOG((2, "iosysid = %d", ios->iosysid)); /* User must provide name shorter than NC_MAX_NAME +1. */ if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_inq_dimid ncid = %d name = %s", ncid, name)); + PLOG((1, "PIOc_inq_dimid ncid = %d name = %s", ncid, name)); /* If using async, and not an IO task, then send parameters. */ if (ios->async) @@ -804,7 +804,7 @@ PIOc_inq_dimid(int ncid, const char *name, int *idp) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_dimid(file->fh, name, idp); } - LOG((3, "nc_inq_dimid call complete ierr = %d", ierr)); + PLOG((3, "nc_inq_dimid call complete ierr = %d", ierr)); /* Broadcast and check the return code. */ if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) @@ -855,7 +855,7 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, int ierr; int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq_var ncid = %d varid = %d", ncid, varid)); + PLOG((1, "PIOc_inq_var ncid = %d varid = %d", ncid, varid)); /* Get the file info, based on the ncid. */ if ((ierr = pio_get_file(ncid, &file))) @@ -891,9 +891,9 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, mpierr = MPI_Bcast(&dimids_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&natts_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq_var name_present = %d xtype_present = %d ndims_present = %d " - "dimids_present = %d, natts_present = %d nattsp = %d", - name_present, xtype_present, ndims_present, dimids_present, natts_present, nattsp)); + PLOG((2, "PIOc_inq_var name_present = %d xtype_present = %d ndims_present = %d " + "dimids_present = %d, natts_present = %d nattsp = %d", + name_present, xtype_present, ndims_present, dimids_present, natts_present, nattsp)); } /* Handle MPI errors. */ @@ -906,12 +906,12 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, /* Call the netCDF layer. */ if (ios->ioproc) { - LOG((2, "Calling the netCDF layer")); + PLOG((2, "Calling the netCDF layer")); #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { ierr = ncmpi_inq_varndims(file->fh, varid, &ndims); - LOG((2, "from pnetcdf ndims = %d", ndims)); + PLOG((2, "from pnetcdf ndims = %d", ndims)); if (!ierr) ierr = ncmpi_inq_var(file->fh, varid, name, xtypep, ndimsp, dimidsp, nattsp); } @@ -920,14 +920,14 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) { ierr = nc_inq_varndims(file->fh, varid, &ndims); - LOG((3, "nc_inq_varndims called ndims = %d", ndims)); + PLOG((3, "nc_inq_varndims called ndims = %d", ndims)); if (!ierr) { char my_name[NC_MAX_NAME + 1]; nc_type my_xtype; int my_ndims = 0, my_dimids[ndims], my_natts = 0; ierr = nc_inq_var(file->fh, varid, my_name, &my_xtype, &my_ndims, my_dimids, &my_natts); - LOG((3, "my_name = %s my_xtype = %d my_ndims = %d my_natts = %d", my_name, my_xtype, my_ndims, my_natts)); + PLOG((3, "my_name = %s my_xtype = %d my_ndims = %d my_natts = %d", my_name, my_xtype, my_ndims, my_natts)); if (!ierr) { if (name) @@ -947,7 +947,7 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, } } if (ndimsp) - LOG((2, "PIOc_inq_var ndims = %d ierr = %d", *ndimsp, ierr)); + PLOG((2, "PIOc_inq_var ndims = %d ierr = %d", *ndimsp, ierr)); } /* Broadcast and check the return code. */ @@ -973,11 +973,11 @@ PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp, if (ndimsp) { - LOG((2, "PIOc_inq_var about to Bcast ndims = %d ios->ioroot = %d ios->my_comm = %d", - *ndimsp, ios->ioroot, ios->my_comm)); + PLOG((2, "PIOc_inq_var about to Bcast ndims = %d ios->ioroot = %d ios->my_comm = %d", + *ndimsp, ios->ioroot, ios->my_comm)); if ((mpierr = MPI_Bcast(ndimsp, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "PIOc_inq_var Bcast ndims = %d", *ndimsp)); + PLOG((2, "PIOc_inq_var Bcast ndims = %d", *ndimsp)); } if (dimidsp) { @@ -1110,7 +1110,7 @@ PIOc_inq_varid(int ncid, const char *name, int *varidp) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_inq_varid ncid = %d name = %s", ncid, name)); + PLOG((1, "PIOc_inq_varid ncid = %d name = %s", ncid, name)); if (ios->async) { @@ -1203,7 +1203,7 @@ PIOc_inq_att_eh(int ncid, int varid, const char *name, int eh, if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_inq_att ncid = %d varid = %d", ncid, varid)); + PLOG((1, "PIOc_inq_att ncid = %d varid = %d", ncid, varid)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1248,7 +1248,7 @@ PIOc_inq_att_eh(int ncid, int varid, const char *name, int eh, if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_att(file->fh, varid, name, xtypep, (size_t *)lenp); - LOG((2, "PIOc_inq netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -1358,8 +1358,8 @@ PIOc_inq_attname(int ncid, int varid, int attnum, char *name) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq_attname ncid = %d varid = %d attnum = %d", ncid, varid, - attnum)); + PLOG((1, "PIOc_inq_attname ncid = %d varid = %d attnum = %d", ncid, varid, + attnum)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -1404,7 +1404,7 @@ PIOc_inq_attname(int ncid, int varid, int attnum, char *name) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_attname(file->fh, varid, attnum, name); - LOG((2, "PIOc_inq_attname netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq_attname netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -1463,7 +1463,7 @@ PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_inq_attid ncid = %d varid = %d name = %s", ncid, varid, name)); + PLOG((1, "PIOc_inq_attid ncid = %d varid = %d name = %s", ncid, varid, name)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1506,7 +1506,7 @@ PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_attid(file->fh, varid, name, idp); - LOG((2, "PIOc_inq_attname netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq_attname netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -1557,7 +1557,7 @@ PIOc_rename_dim(int ncid, int dimid, const char *name) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_rename_dim ncid = %d dimid = %d name = %s", ncid, dimid, name)); + PLOG((1, "PIOc_rename_dim ncid = %d dimid = %d name = %s", ncid, dimid, name)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1578,8 +1578,8 @@ PIOc_rename_dim(int ncid, int dimid, const char *name) mpierr = MPI_Bcast(&namelen, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast((void *)name, namelen + 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_rename_dim Bcast file->fh = %d dimid = %d namelen = %d name = %s", - file->fh, dimid, namelen, name)); + PLOG((2, "PIOc_rename_dim Bcast file->fh = %d dimid = %d namelen = %d name = %s", + file->fh, dimid, namelen, name)); } /* Handle MPI errors. */ @@ -1600,7 +1600,7 @@ PIOc_rename_dim(int ncid, int dimid, const char *name) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_rename_dim(file->fh, dimid, name); - LOG((2, "PIOc_inq netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -1646,7 +1646,7 @@ PIOc_rename_var(int ncid, int varid, const char *name) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_rename_var ncid = %d varid = %d name = %s", ncid, varid, name)); + PLOG((1, "PIOc_rename_var ncid = %d varid = %d name = %s", ncid, varid, name)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1667,8 +1667,8 @@ PIOc_rename_var(int ncid, int varid, const char *name) mpierr = MPI_Bcast(&namelen, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast((void *)name, namelen + 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_rename_var Bcast file->fh = %d varid = %d namelen = %d name = %s", - file->fh, varid, namelen, name)); + PLOG((2, "PIOc_rename_var Bcast file->fh = %d varid = %d namelen = %d name = %s", + file->fh, varid, namelen, name)); } /* Handle MPI errors. */ @@ -1689,7 +1689,7 @@ PIOc_rename_var(int ncid, int varid, const char *name) if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_rename_var(file->fh, varid, name); - LOG((2, "PIOc_inq netcdf call returned %d", ierr)); + PLOG((2, "PIOc_inq netcdf call returned %d", ierr)); } /* Broadcast and check the return code. */ @@ -1738,8 +1738,8 @@ PIOc_rename_att(int ncid, int varid, const char *name, !newname || strlen(newname) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_rename_att ncid = %d varid = %d name = %s newname = %s", - ncid, varid, name, newname)); + PLOG((1, "PIOc_rename_att ncid = %d varid = %d name = %s newname = %s", + ncid, varid, name, newname)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1792,7 +1792,7 @@ PIOc_rename_att(int ncid, int varid, const char *name, if (ierr) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((2, "PIOc_rename_att succeeded")); + PLOG((2, "PIOc_rename_att succeeded")); return PIO_NOERR; } @@ -1829,7 +1829,7 @@ PIOc_del_att(int ncid, int varid, const char *name) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_del_att ncid = %d varid = %d name = %s", ncid, varid, name)); + PLOG((1, "PIOc_del_att ncid = %d varid = %d name = %s", ncid, varid, name)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -1904,7 +1904,7 @@ PIOc_set_fill(int ncid, int fillmode, int *old_modep) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI functions. */ - LOG((1, "PIOc_set_fill ncid = %d fillmode = %d", ncid, fillmode)); + PLOG((1, "PIOc_set_fill ncid = %d fillmode = %d", ncid, fillmode)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -1919,7 +1919,7 @@ PIOc_set_fill(int ncid, int fillmode, int *old_modep) int msg = PIO_MSG_SET_FILL; int old_modep_present = old_modep ? 1 : 0; - LOG((3, "PIOc_set_fill about to send msg %d", msg)); + PLOG((3, "PIOc_set_fill about to send msg %d", msg)); if (ios->compmaster == MPI_ROOT) mpierr = MPI_Send(&msg, 1,MPI_INT, ios->ioroot, 1, ios->union_comm); @@ -1929,8 +1929,8 @@ PIOc_set_fill(int ncid, int fillmode, int *old_modep) mpierr = MPI_Bcast(&fillmode, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&old_modep_present, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_set_fill sent ncid = %d fillmode = %d old_modep_present = %d", ncid, fillmode, - old_modep_present)); + PLOG((2, "PIOc_set_fill sent ncid = %d fillmode = %d old_modep_present = %d", ncid, fillmode, + old_modep_present)); } /* Handle MPI errors. */ @@ -1946,7 +1946,7 @@ PIOc_set_fill(int ncid, int fillmode, int *old_modep) #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { - LOG((3, "about to call ncmpi_set_fill() fillmode = %d", fillmode)); + PLOG((3, "about to call ncmpi_set_fill() fillmode = %d", fillmode)); ierr = ncmpi_set_fill(file->fh, fillmode, old_modep); } #endif /* _PNETCDF */ @@ -1964,12 +1964,12 @@ PIOc_set_fill(int ncid, int fillmode, int *old_modep) /* Broadcast results. */ if (old_modep) { - LOG((2, "old_mode = %d", *old_modep)); + PLOG((2, "old_mode = %d", *old_modep)); if ((mpierr = MPI_Bcast(old_modep, 1, MPI_INT, ios->ioroot, ios->my_comm))) check_mpi(NULL, file, mpierr, __FILE__, __LINE__); } - LOG((2, "PIOc_set_fill succeeded")); + PLOG((2, "PIOc_set_fill succeeded")); return PIO_NOERR; } @@ -2047,7 +2047,7 @@ PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_def_dim ncid = %d name = %s len = %d", ncid, name, len)); + PLOG((1, "PIOc_def_dim ncid = %d name = %s len = %d", ncid, name, len)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -2102,7 +2102,7 @@ PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) if ((mpierr = MPI_Bcast(idp , 1, MPI_INT, ios->ioroot, ios->my_comm))) check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "def_dim ierr = %d", ierr)); + PLOG((2, "def_dim ierr = %d", ierr)); return PIO_NOERR; } @@ -2149,8 +2149,8 @@ PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, if (!name || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_def_var ncid = %d name = %s xtype = %d ndims = %d", ncid, name, - xtype, ndims)); + PLOG((1, "PIOc_def_var ncid = %d name = %s xtype = %d ndims = %d", ncid, name, + xtype, ndims)); /* Run this on all tasks if async is not in use, but only on * non-IO tasks if async is in use. Learn whether each dimension @@ -2273,7 +2273,7 @@ PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims, if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_def_var(file->fh, name, xtype, ndims, dimidsp, &varid); - LOG((3, "defined var ierr %d file->iotype %d", ierr, file->iotype)); + PLOG((3, "defined var ierr %d file->iotype %d", ierr, file->iotype)); #ifdef _NETCDF4 /* For netCDF-4 serial files, turn on compression for this variable. */ @@ -2344,8 +2344,8 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_def_var_fill ncid = %d varid = %d fill_mode = %d\n", ncid, varid, - fill_mode)); + PLOG((1, "PIOc_def_var_fill ncid = %d varid = %d fill_mode = %d\n", ncid, varid, + fill_mode)); /* Get the file info. */ if ((ierr = pio_get_file(ncid, &file))) @@ -2366,7 +2366,7 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) return check_netcdf(file, ierr, __FILE__, __LINE__); if ((ierr = PIOc_inq_type(ncid, xtype, NULL, &type_size))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((2, "PIOc_def_var_fill type_size = %d", type_size)); + PLOG((2, "PIOc_def_var_fill type_size = %d", type_size)); } /* If async is in use, and this is not an IO task, bcast the parameters. */ @@ -2393,8 +2393,8 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) if (!mpierr && fill_value_present) mpierr = MPI_Bcast((PIO_Offset *)fill_valuep, type_size, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_def_var_fill ncid = %d varid = %d fill_mode = %d type_size = %d fill_value_present = %d", - ncid, varid, fill_mode, type_size, fill_value_present)); + PLOG((2, "PIOc_def_var_fill ncid = %d varid = %d fill_mode = %d type_size = %d fill_value_present = %d", + ncid, varid, fill_mode, type_size, fill_value_present)); } /* Handle MPI errors. */ @@ -2420,7 +2420,7 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) } else if (file->iotype == PIO_IOTYPE_NETCDF) { - LOG((2, "defining fill value attribute for netCDF classic file")); + PLOG((2, "defining fill value attribute for netCDF classic file")); if (file->do_io) { ierr = nc_set_fill(file->fh, NC_FILL, NULL); @@ -2435,7 +2435,7 @@ PIOc_def_var_fill(int ncid, int varid, int fill_mode, const void *fill_valuep) ierr = nc_def_var_fill(file->fh, varid, fill_mode, fill_valuep); #endif } - LOG((2, "after def_var_fill ierr = %d", ierr)); + PLOG((2, "after def_var_fill ierr = %d", ierr)); } /* Broadcast and check the return code. */ @@ -2477,13 +2477,13 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ierr = PIO_NOERR; /* Return code from function calls. */ - LOG((1, "PIOc_inq_var_fill ncid = %d varid = %d", ncid, varid)); + PLOG((1, "PIOc_inq_var_fill ncid = %d varid = %d", ncid, varid)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) return pio_err(NULL, NULL, ierr, __FILE__, __LINE__); ios = file->iosystem; - LOG((2, "found file")); + PLOG((2, "found file")); /* Run this on all tasks if async is not in use, but only on * non-IO tasks if async is in use. Get the size of this vars @@ -2494,7 +2494,7 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) return check_netcdf(file, ierr, __FILE__, __LINE__); if ((ierr = PIOc_inq_type(ncid, xtype, NULL, &type_size))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((2, "PIOc_inq_var_fill type_size = %d", type_size)); + PLOG((2, "PIOc_inq_var_fill type_size = %d", type_size)); } /* If async is in use, and this is not an IO task, bcast the parameters. */ @@ -2506,7 +2506,7 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) char no_fill_present = no_fill ? true : false; char fill_value_present = fill_valuep ? true : false; - LOG((2, "sending msg type_size = %d", type_size)); + PLOG((2, "sending msg type_size = %d", type_size)); if (ios->compmaster == MPI_ROOT) mpierr = MPI_Send(&msg, 1,MPI_INT, ios->ioroot, 1, ios->union_comm); @@ -2520,8 +2520,8 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) mpierr = MPI_Bcast(&no_fill_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&fill_value_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq_var_fill ncid = %d varid = %d type_size = %lld no_fill_present = %d fill_value_present = %d", - ncid, varid, type_size, no_fill_present, fill_value_present)); + PLOG((2, "PIOc_inq_var_fill ncid = %d varid = %d type_size = %lld no_fill_present = %d fill_value_present = %d", + ncid, varid, type_size, no_fill_present, fill_value_present)); } /* Handle MPI errors. */ @@ -2540,8 +2540,8 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) /* If this is an IO task, then call the netCDF function. */ if (ios->ioproc) { - LOG((2, "calling inq_var_fill file->iotype = %d file->fh = %d varid = %d", - file->iotype, file->fh, varid)); + PLOG((2, "calling inq_var_fill file->iotype = %d file->fh = %d varid = %d", + file->iotype, file->fh, varid)); if (file->iotype == PIO_IOTYPE_PNETCDF) { #ifdef _PNETCDF @@ -2613,7 +2613,7 @@ PIOc_inq_var_fill(int ncid, int varid, int *no_fill, void *fill_valuep) ierr = nc_inq_var_fill(file->fh, varid, no_fill, fill_valuep); #endif /* _NETCDF */ } - LOG((2, "after call to inq_var_fill, ierr = %d", ierr)); + PLOG((2, "after call to inq_var_fill, ierr = %d", ierr)); } /* Broadcast and check the return code. */ @@ -2670,12 +2670,12 @@ PIOc_get_att(int ncid, int varid, const char *name, void *ip) if (!name || !ip || strlen(name) > NC_MAX_NAME) return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_get_att ncid %d varid %d name %s", ncid, varid, name)); + PLOG((1, "PIOc_get_att ncid %d varid %d name %s", ncid, varid, name)); /* Get the type of the attribute. */ if ((ierr = PIOc_inq_att(ncid, varid, name, &atttype, NULL))) return ierr; - LOG((2, "atttype = %d", atttype)); + PLOG((2, "atttype = %d", atttype)); return PIOc_get_att_tc(ncid, varid, name, atttype, ip); } diff --git a/src/clib/pio_nc4.c b/src/clib/pio_nc4.c index b536a2da338..7dc7a7445c5 100644 --- a/src/clib/pio_nc4.c +++ b/src/clib/pio_nc4.c @@ -169,9 +169,9 @@ PIOc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, mpierr = MPI_Bcast(&deflate_level_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (deflate_level_present && !mpierr) mpierr = MPI_Bcast(deflate_levelp, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq_var_deflate ncid = %d varid = %d shuffle_present = %d deflate_present = %d " - "deflate_level_present = %d", ncid, varid, shuffle_present, deflate_present, - deflate_level_present)); + PLOG((2, "PIOc_inq_var_deflate ncid = %d varid = %d shuffle_present = %d deflate_present = %d " + "deflate_level_present = %d", ncid, varid, shuffle_present, deflate_present, + deflate_level_present)); } /* Handle MPI errors. */ @@ -242,8 +242,8 @@ PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunks int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_def_var_chunking ncid = %d varid = %d storage = %d", ncid, - varid, storage)); + PLOG((1, "PIOc_def_var_chunking ncid = %d varid = %d storage = %d", ncid, + varid, storage)); /* Find the info about this file. */ if ((ierr = pio_get_file(ncid, &file))) @@ -260,7 +260,7 @@ PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunks if (!ios->async || !ios->ioproc) if ((ierr = PIOc_inq_varndims(ncid, varid, &ndims))) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((2, "PIOc_def_var_chunking first ndims = %d", ndims)); + PLOG((2, "PIOc_def_var_chunking first ndims = %d", ndims)); /* If async is in use, and this is not an IO task, bcast the parameters. */ if (ios->async) @@ -286,8 +286,8 @@ PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunks if (!mpierr && chunksizes_present) mpierr = MPI_Bcast((PIO_Offset *)chunksizesp, ndims, MPI_OFFSET, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_def_var_chunking ncid = %d varid = %d storage = %d ndims = %d chunksizes_present = %d", - ncid, varid, storage, ndims, chunksizes_present)); + PLOG((2, "PIOc_def_var_chunking ncid = %d varid = %d storage = %d ndims = %d chunksizes_present = %d", + ncid, varid, storage, ndims, chunksizes_present)); } /* Handle MPI errors. */ @@ -301,7 +301,7 @@ PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunks check_mpi(NULL, file, mpierr, __FILE__, __LINE__); } - LOG((2, "PIOc_def_var_chunking ndims = %d", ndims)); + PLOG((2, "PIOc_def_var_chunking ndims = %d", ndims)); /* If this is an IO task, then call the netCDF function. */ if (ios->ioproc) @@ -365,7 +365,7 @@ PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizes int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ndims; /* The number of dimensions in the variable. */ - LOG((1, "PIOc_inq_var_chunking ncid = %d varid = %d")); + PLOG((1, "PIOc_inq_var_chunking ncid = %d varid = %d")); /* Get the file info. */ if ((ierr = pio_get_file(ncid, &file))) @@ -383,7 +383,7 @@ PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizes /* Find the number of dimensions of this variable. */ if ((ierr = PIOc_inq_varndims(ncid, varid, &ndims))) return pio_err(ios, file, ierr, __FILE__, __LINE__); - LOG((2, "ndims = %d", ndims)); + PLOG((2, "ndims = %d", ndims)); } /* If async is in use, and this is not an IO task, bcast the parameters. */ @@ -408,8 +408,8 @@ PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizes mpierr = MPI_Bcast(&ndims, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&chunksizes_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_inq_var_chunking ncid = %d varid = %d storage_present = %d chunksizes_present = %d", - ncid, varid, storage_present, chunksizes_present)); + PLOG((2, "PIOc_inq_var_chunking ncid = %d varid = %d storage_present = %d chunksizes_present = %d", + ncid, varid, storage_present, chunksizes_present)); } /* Handle MPI errors. */ @@ -443,7 +443,7 @@ PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizes } } #endif - LOG((2, "ierr = %d", ierr)); + PLOG((2, "ierr = %d", ierr)); } /* Broadcast and check the return code. */ @@ -572,7 +572,7 @@ PIOc_inq_var_endian(int ncid, int varid, int *endianp) int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_inq_var_endian ncid = %d varid = %d")); + PLOG((1, "PIOc_inq_var_endian ncid = %d varid = %d")); /* Get the file info. */ if ((ierr = pio_get_file(ncid, &file))) @@ -666,8 +666,8 @@ PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset nelems int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_set_chunk_cache iosysid = %d iotype = %d size = %d nelems = %d preemption = %g", - iosysid, iotype, size, nelems, preemption)); + PLOG((1, "PIOc_set_chunk_cache iosysid = %d iotype = %d size = %d nelems = %d preemption = %g", + iosysid, iotype, size, nelems, preemption)); /* Get the IO system info. */ if (!(ios = pio_get_iosystem_from_id(iosysid))) @@ -710,7 +710,7 @@ PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset nelems if (ios->ioproc) { #ifdef _NETCDF4 - LOG((2, "calling nc_chunk_cache")); + PLOG((2, "calling nc_chunk_cache")); if (iotype == PIO_IOTYPE_NETCDF4P) ierr = nc_set_chunk_cache(size, nelems, preemption); else @@ -725,7 +725,7 @@ PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset nelems if (ierr) check_netcdf2(ios, NULL, ierr, __FILE__, __LINE__); - LOG((2, "PIOc_set_chunk_cache complete!")); + PLOG((2, "PIOc_set_chunk_cache complete!")); return PIO_NOERR; } @@ -768,7 +768,7 @@ PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset *nel int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_get_chunk_cache iosysid = %d iotype = %d", iosysid, iotype)); + PLOG((1, "PIOc_get_chunk_cache iosysid = %d iotype = %d", iosysid, iotype)); /* Get the io system info. */ if (!(ios = pio_get_iosystem_from_id(iosysid))) @@ -802,8 +802,8 @@ PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset *nel if (!mpierr) mpierr = MPI_Bcast(&preemption_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_get_chunk_cache size_present = %d nelems_present = %d " - "preemption_present = %d ", size_present, nelems_present, preemption_present)); + PLOG((2, "PIOc_get_chunk_cache size_present = %d nelems_present = %d " + "preemption_present = %d ", size_present, nelems_present, preemption_present)); } /* Handle MPI errors. */ @@ -823,34 +823,34 @@ PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset *nel if (!ios->io_rank) ierr = nc_get_chunk_cache((size_t *)sizep, (size_t *)nelemsp, preemptionp); #endif - LOG((2, "nc_get_chunk_cache called ierr = %d", ierr)); + PLOG((2, "nc_get_chunk_cache called ierr = %d", ierr)); } /* Broadcast and check the return code. */ if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "bcast complete ierr = %d sizep = %d", ierr, sizep)); + PLOG((2, "bcast complete ierr = %d sizep = %d", ierr, sizep)); if (ierr) return check_netcdf(NULL, ierr, __FILE__, __LINE__); if (sizep) { - LOG((2, "bcasting size = %d ios->ioroot = %d", *sizep, ios->ioroot)); + PLOG((2, "bcasting size = %d ios->ioroot = %d", *sizep, ios->ioroot)); if ((mpierr = MPI_Bcast(sizep, 1, MPI_OFFSET, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "bcast size = %d", *sizep)); + PLOG((2, "bcast size = %d", *sizep)); } if (nelemsp) { if ((mpierr = MPI_Bcast(nelemsp, 1, MPI_OFFSET, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "bcast complete nelems = %d", *nelemsp)); + PLOG((2, "bcast complete nelems = %d", *nelemsp)); } if (preemptionp) { if ((mpierr = MPI_Bcast(preemptionp, 1, MPI_FLOAT, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "bcast complete preemption = %d", *preemptionp)); + PLOG((2, "bcast complete preemption = %d", *preemptionp)); } return PIO_NOERR; @@ -976,7 +976,7 @@ PIOc_get_var_chunk_cache(int ncid, int varid, PIO_Offset *sizep, PIO_Offset *nel int ierr; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_get_var_chunk_cache ncid = %d varid = %d")); + PLOG((1, "PIOc_get_var_chunk_cache ncid = %d varid = %d")); /* Get the file info. */ if ((ierr = pio_get_file(ncid, &file))) @@ -1011,8 +1011,8 @@ PIOc_get_var_chunk_cache(int ncid, int varid, PIO_Offset *sizep, PIO_Offset *nel if (!mpierr) mpierr = MPI_Bcast(&preemption_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_get_var_chunk_cache size_present = %d nelems_present = %d " - "preemption_present = %d ", size_present, nelems_present, preemption_present)); + PLOG((2, "PIOc_get_var_chunk_cache size_present = %d nelems_present = %d " + "preemption_present = %d ", size_present, nelems_present, preemption_present)); } /* Handle MPI errors. */ diff --git a/src/clib/pio_put_nc.c b/src/clib/pio_put_nc.c index d6f87ae08f9..8d871b763e6 100644 --- a/src/clib/pio_put_nc.c +++ b/src/clib/pio_put_nc.c @@ -1,11 +1,11 @@ /** - * @file - * PIO functions to write data. - * - * @author Ed Hartnett - * @date 2016 - * @see http://code.google.com/p/parallelio/ - */ + * @file + * PIO functions to write data. + * + * @author Ed Hartnett + * @date 2016 + * @see http://code.google.com/p/parallelio/ + */ #include #include #include diff --git a/src/clib/pio_put_vard.c b/src/clib/pio_put_vard.c index 866fd40e84c..17644a2113a 100644 --- a/src/clib/pio_put_vard.c +++ b/src/clib/pio_put_vard.c @@ -1,11 +1,11 @@ /** - * @file - * PIO functions to write data with distributed arrays. - * - * @author Ed Hartnett - * @date 2019 - * @see https://github.com/NCAR/ParallelIO - */ + * @file + * PIO functions to write data with distributed arrays. + * + * @author Ed Hartnett + * @date 2019 + * @see https://github.com/NCAR/ParallelIO + */ #include #include #include diff --git a/src/clib/pio_rearrange.c b/src/clib/pio_rearrange.c index d2f3b385e29..897a6d99b6a 100644 --- a/src/clib/pio_rearrange.c +++ b/src/clib/pio_rearrange.c @@ -1,9 +1,9 @@ /** - * @file - * Code to map IO to model decomposition. - * - * @author Jim Edwards - */ + * @file + * Code to map IO to model decomposition. + * + * @author Jim Edwards + */ #include #include #include @@ -35,7 +35,7 @@ idx_to_dim_list(int ndims, const int *gdimlen, PIO_Offset idx, /* Check inputs. */ pioassert(ndims >= 0 && gdimlen && idx >= -1 && dim_list, "invalid input", __FILE__, __LINE__); - LOG((2, "idx_to_dim_list ndims = %d idx = %d", ndims, idx)); + PLOG((2, "idx_to_dim_list ndims = %d idx = %d", ndims, idx)); /* Easiest to start from the right and move left. */ for (int i = ndims - 1; i >= 0; --i) @@ -46,8 +46,8 @@ idx_to_dim_list(int ndims, const int *gdimlen, PIO_Offset idx, * and "%". */ next_idx = idx / gdimlen[i]; dim_list[i] = idx - (next_idx * gdimlen[i]); - LOG((3, "next_idx = %d idx = %d gdimlen[%d] = %d dim_list[%d] = %d", - next_idx, idx, i, gdimlen[i], i, dim_list[i])); + PLOG((3, "next_idx = %d idx = %d gdimlen[%d] = %d dim_list[%d] = %d", + next_idx, idx, i, gdimlen[i], i, dim_list[i])); idx = next_idx; } } @@ -161,7 +161,7 @@ find_region(int ndims, const int *gdimlen, int maplen, const PIO_Offset *map, /* Check inputs. */ pioassert(ndims > 0 && gdimlen && maplen > 0 && map && start && count && regionlen, "invalid input", __FILE__, __LINE__); - LOG((2, "find_region ndims = %d maplen = %d", ndims, maplen)); + PLOG((2, "find_region ndims = %d maplen = %d", ndims, maplen)); *regionlen = 1; @@ -176,7 +176,7 @@ find_region(int ndims, const int *gdimlen, int maplen, const PIO_Offset *map, for (int dim = 0; dim < ndims; ++dim) { max_size[dim] = gdimlen[dim] - start[dim]; - LOG((3, "max_size[%d] = %d", max_size[dim])); + PLOG((3, "max_size[%d] = %d", max_size[dim])); } /* For each dimension, figure out how far we can expand in that dimension @@ -250,13 +250,13 @@ compute_maxIObuffersize(MPI_Comm io_comm, io_desc_t *iodesc) totiosize += iosize; } } - LOG((2, "compute_maxIObuffersize got totiosize = %lld", totiosize)); + PLOG((2, "compute_maxIObuffersize got totiosize = %lld", totiosize)); /* Share the max io buffer size with all io tasks. */ if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &totiosize, 1, MPI_OFFSET, MPI_MAX, io_comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); pioassert(totiosize > 0, "totiosize <= 0", __FILE__, __LINE__); - LOG((2, "after allreduce compute_maxIObuffersize got totiosize = %lld", totiosize)); + PLOG((2, "after allreduce compute_maxIObuffersize got totiosize = %lld", totiosize)); /* Remember the result. */ iodesc->maxiobuflen = totiosize; @@ -297,23 +297,23 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, PIO_Offset bsizeT[msgcnt]; - LOG((1, "create_mpi_datatypes mpitype = %d msgcnt = %d", mpitype, - msgcnt)); - LOG((2, "MPI_BYTE = %d MPI_CHAR = %d MPI_SHORT = %d MPI_INT = %d " - "MPI_FLOAT = %d MPI_DOUBLE = %d", MPI_BYTE, MPI_CHAR, MPI_SHORT, - MPI_INT, MPI_FLOAT, MPI_DOUBLE)); + PLOG((1, "create_mpi_datatypes mpitype = %d msgcnt = %d", mpitype, + msgcnt)); + PLOG((2, "MPI_BYTE = %d MPI_CHAR = %d MPI_SHORT = %d MPI_INT = %d " + "MPI_FLOAT = %d MPI_DOUBLE = %d", MPI_BYTE, MPI_CHAR, MPI_SHORT, + MPI_INT, MPI_FLOAT, MPI_DOUBLE)); /* How many indicies in the array? */ for (int j = 0; j < msgcnt; j++) numinds += mcount[j]; - LOG((2, "numinds = %d", numinds)); + PLOG((2, "numinds = %d", numinds)); if (mindex) { if (!(lindex = malloc(numinds * sizeof(PIO_Offset)))) return pio_err(NULL, NULL, PIO_ENOMEM, __FILE__, __LINE__); memcpy(lindex, mindex, (size_t)(numinds * sizeof(PIO_Offset))); - LOG((3, "allocated lindex, copied mindex")); + PLOG((3, "allocated lindex, copied mindex")); } bsizeT[0] = 0; @@ -325,7 +325,7 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, * rearrangers. (If mfrom is NULL, this is the box rearranger.) */ if (mfrom == NULL) { - LOG((3, "mfrom is NULL")); + PLOG((3, "mfrom is NULL")); for (int i = 0; i < msgcnt; i++) { if (mcount[i] > 0) @@ -344,7 +344,7 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, { blocksize = 1; } - LOG((3, "blocksize = %d", blocksize)); + PLOG((3, "blocksize = %d", blocksize)); /* pos is an index to the start of each message block. */ pos = 0; @@ -358,8 +358,8 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, if (!(displace = malloc(sizeof(int) * len))) EXIT1(PIO_ENOMEM); - LOG((3, "blocksize = %d i = %d mcount[%d] = %d len = %d", blocksize, i, i, - mcount[i], len)); + PLOG((3, "blocksize = %d i = %d mcount[%d] = %d len = %d", blocksize, i, i, + mcount[i], len)); if (blocksize == 1) { if (!mfrom) @@ -389,11 +389,11 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, #if PIO_ENABLE_LOGGING for (int j = 0; j < len; j++) - LOG((3, "displace[%d] = %d", j, displace[j])); + PLOG((3, "displace[%d] = %d", j, displace[j])); #endif /* PIO_ENABLE_LOGGING */ - LOG((3, "calling MPI_Type_create_indexed_block len = %d blocksize = %d " - "mpitype = %d", len, blocksize, mpitype)); + PLOG((3, "calling MPI_Type_create_indexed_block len = %d blocksize = %d " + "mpitype = %d", len, blocksize, mpitype)); /* Create an indexed datatype with constant-sized blocks. */ mpierr = MPI_Type_create_indexed_block(len, blocksize, displace, mpitype, &mtype[i]); @@ -406,14 +406,14 @@ create_mpi_datatypes(MPI_Datatype mpitype, int msgcnt, return pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__); /* Commit the MPI data type. */ - LOG((3, "about to commit type")); + PLOG((3, "about to commit type")); if ((mpierr = MPI_Type_commit(&mtype[i]))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); pos += mcount[i]; } } - LOG((3, "done with create_mpi_datatypes()")); + PLOG((3, "done with create_mpi_datatypes()")); exit: /* Free resources. */ @@ -450,8 +450,8 @@ define_iodesc_datatypes(iosystem_desc_t *ios, io_desc_t *iodesc) int ret; /* Return value. */ pioassert(ios && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "define_iodesc_datatypes ios->ioproc = %d iodesc->rtype is %sNULL, iodesc->nrecvs", - ios->ioproc, iodesc->rtype ? "not " : "", iodesc->nrecvs)); + PLOG((1, "define_iodesc_datatypes ios->ioproc = %d iodesc->rtype is %sNULL, iodesc->nrecvs", + ios->ioproc, iodesc->rtype ? "not " : "", iodesc->nrecvs)); /* Set up the to transfer data to and from the IO tasks. */ if (ios->ioproc) @@ -465,8 +465,8 @@ define_iodesc_datatypes(iosystem_desc_t *ios, io_desc_t *iodesc) /* Allocate memory for array of MPI types for the IO tasks. */ if (!(iodesc->rtype = malloc(iodesc->nrecvs * sizeof(MPI_Datatype)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - LOG((2, "allocated memory for IO task MPI types iodesc->nrecvs = %d " - "iodesc->rearranger = %d", iodesc->nrecvs, iodesc->rearranger)); + PLOG((2, "allocated memory for IO task MPI types iodesc->nrecvs = %d " + "iodesc->rearranger = %d", iodesc->nrecvs, iodesc->rearranger)); /* Initialize data types to NULL. */ for (int i = 0; i < iodesc->nrecvs; i++) @@ -499,7 +499,7 @@ define_iodesc_datatypes(iosystem_desc_t *ios, io_desc_t *iodesc) /* Allocate memory for array of MPI types for the computation tasks. */ if (!(iodesc->stype = malloc(ntypes * sizeof(MPI_Datatype)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - LOG((3, "allocated memory for computation MPI types ntypes = %d", ntypes)); + PLOG((3, "allocated memory for computation MPI types ntypes = %d", ntypes)); /* Initialize send types to NULL. */ for (int i = 0; i < ntypes; i++) @@ -509,14 +509,14 @@ define_iodesc_datatypes(iosystem_desc_t *ios, io_desc_t *iodesc) iodesc->num_stypes = ntypes; /* Create the MPI data types. */ - LOG((3, "about to call create_mpi_datatypes for computation MPI types")); + PLOG((3, "about to call create_mpi_datatypes for computation MPI types")); if ((ret = create_mpi_datatypes(iodesc->mpitype, ntypes, iodesc->sindex, iodesc->scount, NULL, iodesc->stype))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); } } - LOG((3, "done with define_iodesc_datatypes()")); + PLOG((3, "done with define_iodesc_datatypes()")); return PIO_NOERR; } @@ -565,8 +565,8 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, (iodesc->ndof > 0 && dest_ioproc && dest_ioindex)) && iodesc->rearranger == PIO_REARR_BOX && ios->num_uniontasks > 0, "invalid input", __FILE__, __LINE__); - LOG((1, "compute_counts ios->num_uniontasks = %d ios->compproc %d ios->ioproc %d", - ios->num_uniontasks, ios->compproc, ios->ioproc)); + PLOG((1, "compute_counts ios->num_uniontasks = %d ios->compproc %d ios->ioproc %d", + ios->num_uniontasks, ios->compproc, ios->ioproc)); /* Arrays for swapm all to all gather calls. */ MPI_Datatype sr_types[ios->num_uniontasks]; @@ -618,8 +618,8 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, { send_counts[ios->ioranks[i]] = 1; send_displs[ios->ioranks[i]] = i * sizeof(int); - LOG((3, "send_counts[%d] = %d send_displs[%d] = %d", ios->ioranks[i], - send_counts[ios->ioranks[i]], ios->ioranks[i], send_displs[ios->ioranks[i]])); + PLOG((3, "send_counts[%d] = %d send_displs[%d] = %d", ios->ioranks[i], + send_counts[ios->ioranks[i]], ios->ioranks[i], send_displs[ios->ioranks[i]])); } } @@ -639,13 +639,13 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, { recv_counts[ios->compranks[i]] = 1; recv_displs[ios->compranks[i]] = i * sizeof(int); - LOG((3, "recv_counts[%d] = %d recv_displs[%d] = %d", ios->compranks[i], - recv_counts[ios->compranks[i]], ios->compranks[i], - recv_displs[ios->compranks[i]])); + PLOG((3, "recv_counts[%d] = %d recv_displs[%d] = %d", ios->compranks[i], + recv_counts[ios->compranks[i]], ios->compranks[i], + recv_displs[ios->compranks[i]])); } } - LOG((2, "about to share scount from each compute task to all IO tasks.")); + PLOG((2, "about to share scount from each compute task to all IO tasks.")); /* Share the iodesc->scount from each compute task to all IO * tasks. The scounts will end up in array recv_buf. */ if ((ierr = pio_swapm(iodesc->scount, send_counts, send_displs, sr_types, @@ -662,7 +662,7 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, { if (recv_buf[i] != 0) nrecvs++; - LOG((3, "recv_buf[%d] = %d", i, recv_buf[i])); + PLOG((3, "recv_buf[%d] = %d", i, recv_buf[i])); } /* Get memory to hold the count of data receives. */ @@ -672,7 +672,7 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, /* Get memory to hold the list of task data was from. */ if (!(iodesc->rfrom = calloc(max(1, nrecvs), sizeof(int)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - LOG((3, "allocared rfrom max(1, nrecvs) = %d", max(1, nrecvs))); + PLOG((3, "allocared rfrom max(1, nrecvs) = %d", max(1, nrecvs))); nrecvs = 0; for (int i = 0; i < ios->num_comptasks; i++) @@ -689,14 +689,14 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, /* ??? */ iodesc->nrecvs = nrecvs; - LOG((3, "iodesc->nrecvs = %d", iodesc->nrecvs)); + PLOG((3, "iodesc->nrecvs = %d", iodesc->nrecvs)); /* Allocate an array for indicies on the computation tasks (the * send side when writing). */ if (iodesc->sindex == NULL && iodesc->ndof > 0) if (!(iodesc->sindex = malloc(iodesc->ndof * sizeof(PIO_Offset)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - LOG((2, "iodesc->ndof = %d ios->num_iotasks = %d", iodesc->ndof, ios->num_iotasks)); + PLOG((2, "iodesc->ndof = %d ios->num_iotasks = %d", iodesc->ndof, ios->num_iotasks)); int tempcount[ios->num_iotasks]; int spos[ios->num_iotasks]; @@ -708,7 +708,7 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, { spos[i] = spos[i - 1] + iodesc->scount[i - 1]; tempcount[i] = 0; - LOG((3, "spos[%d] = %d tempcount[%d] = %d", i, spos[i], i, tempcount[i])); + PLOG((3, "spos[%d] = %d tempcount[%d] = %d", i, spos[i], i, tempcount[i])); } /* ??? */ @@ -717,8 +717,8 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, int iorank; int ioindex; - LOG((3, "dest_ioproc[%d] = %d dest_ioindex[%d] = %d", i, dest_ioproc[i], i, - dest_ioindex[i])); + PLOG((3, "dest_ioproc[%d] = %d dest_ioindex[%d] = %d", i, dest_ioproc[i], i, + dest_ioindex[i])); iorank = dest_ioproc[i]; ioindex = dest_ioindex[i]; if (iorank > -1) @@ -728,8 +728,8 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, s2rindex[spos[iorank] + tempcount[iorank]] = ioindex; (tempcount[iorank])++; - LOG((3, "iorank = %d ioindex = %d tempcount[iorank] = %d", iorank, ioindex, - tempcount[iorank])); + PLOG((3, "iorank = %d ioindex = %d tempcount[iorank] = %d", iorank, ioindex, + tempcount[iorank])); } } @@ -750,8 +750,8 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, send_counts[ios->ioranks[i]] = iodesc->scount[i]; if (send_counts[ios->ioranks[i]] > 0) send_displs[ios->ioranks[i]] = spos[i] * SIZEOF_MPI_OFFSET; - LOG((3, "ios->ioranks[i] = %d iodesc->scount[%d] = %d spos[%d] = %d", - ios->ioranks[i], i, iodesc->scount[i], i, spos[i])); + PLOG((3, "ios->ioranks[i] = %d iodesc->scount[%d] = %d spos[%d] = %d", + ios->ioranks[i], i, iodesc->scount[i], i, spos[i])); } /* Only do this on IO tasks. */ @@ -769,19 +769,19 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, { recv_displs[iodesc->rfrom[i]] = recv_displs[iodesc->rfrom[i - 1]] + iodesc->rcount[i - 1] * SIZEOF_MPI_OFFSET; - LOG((3, "iodesc->rfrom[%d] = %d recv_displs[iodesc->rfrom[i]] = %d", i, - iodesc->rfrom[i], recv_displs[iodesc->rfrom[i]])); + PLOG((3, "iodesc->rfrom[%d] = %d recv_displs[iodesc->rfrom[i]] = %d", i, + iodesc->rfrom[i], recv_displs[iodesc->rfrom[i]])); } /* rindex is an array of the indices of the data to be sent from this io task to each compute task. */ - LOG((3, "totalrecv = %d", totalrecv)); + PLOG((3, "totalrecv = %d", totalrecv)); if (totalrecv > 0) { totalrecv = iodesc->llen; /* can reduce memory usage here */ if (!(iodesc->rindex = calloc(totalrecv, sizeof(PIO_Offset)))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - LOG((3, "allocated totalrecv elements in rindex array")); + PLOG((3, "allocated totalrecv elements in rindex array")); } } @@ -792,7 +792,7 @@ compute_counts(iosystem_desc_t *ios, io_desc_t *iodesc, /* Here we are sending the mapping from the index on the compute * task to the index on the io task. */ /* s2rindex is the list of indeces on each compute task */ - LOG((3, "sending mapping")); + PLOG((3, "sending mapping")); if ((ierr = pio_swapm(s2rindex, send_counts, send_displs, sr_types, iodesc->rindex, recv_counts, recv_displs, sr_types, ios->union_comm, &iodesc->rearr_opts.comp2io))) @@ -834,8 +834,8 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, /* Caller must provide these. */ pioassert(ios && iodesc && nvars > 0, "invalid input", __FILE__, __LINE__); - LOG((1, "rearrange_comp2io nvars = %d iodesc->rearranger = %d", nvars, - iodesc->rearranger)); + PLOG((1, "rearrange_comp2io nvars = %d iodesc->rearranger = %d", nvars, + iodesc->rearranger)); /* Different rearraangers use different communicators. */ if (iodesc->rearranger == PIO_REARR_BOX) @@ -872,8 +872,8 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, recvtypes[i] = PIO_DATATYPE_NULL; sendtypes[i] = PIO_DATATYPE_NULL; } - LOG((3, "ntasks = %d iodesc->mpitype_size = %d niotasks = %d", ntasks, - iodesc->mpitype_size, niotasks)); + PLOG((3, "ntasks = %d iodesc->mpitype_size = %d niotasks = %d", ntasks, + iodesc->mpitype_size, niotasks)); /* If it has not already been done, define the MPI data types that * will be used for this io_desc_t. */ @@ -882,18 +882,18 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, /* If this io proc, we need to exchange data with compute * tasks. Create a MPI DataType for that exchange. */ - LOG((2, "ios->ioproc %d iodesc->nrecvs = %d", ios->ioproc, iodesc->nrecvs)); + PLOG((2, "ios->ioproc %d iodesc->nrecvs = %d", ios->ioproc, iodesc->nrecvs)); if (ios->ioproc && iodesc->nrecvs > 0) { for (int i = 0; i < iodesc->nrecvs; i++) { if (iodesc->rtype[i] != PIO_DATATYPE_NULL) { - LOG((3, "iodesc->rtype[%d] = %d iodesc->rearranger = %d", i, iodesc->rtype[i], - iodesc->rearranger)); + PLOG((3, "iodesc->rtype[%d] = %d iodesc->rearranger = %d", i, iodesc->rtype[i], + iodesc->rearranger)); if (iodesc->rearranger == PIO_REARR_SUBSET) { - LOG((3, "exchanging data for subset rearranger")); + PLOG((3, "exchanging data for subset rearranger")); recvcounts[i] = 1; /* Create an MPI derived data type from equally @@ -912,9 +912,9 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, else { recvcounts[iodesc->rfrom[i]] = 1; - LOG((3, "exchanging data for box rearranger i = %d iodesc->rfrom[i] = %d " - "recvcounts[iodesc->rfrom[i]] = %d", i, iodesc->rfrom[i], - recvcounts[iodesc->rfrom[i]])); + PLOG((3, "exchanging data for box rearranger i = %d iodesc->rfrom[i] = %d " + "recvcounts[iodesc->rfrom[i]] = %d", i, iodesc->rfrom[i], + recvcounts[iodesc->rfrom[i]])); if ((mpierr = MPI_Type_create_hvector(nvars, 1, (MPI_Aint)iodesc->llen * iodesc->mpitype_size, iodesc->rtype[i], &recvtypes[iodesc->rfrom[i]]))) @@ -939,14 +939,14 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, for (int i = 0; i < niotasks; i++) { int io_comprank = ios->ioranks[i]; - LOG((3, "ios->ioranks[%d] = %d", i, ios->ioranks[i])); + PLOG((3, "ios->ioranks[%d] = %d", i, ios->ioranks[i])); if (iodesc->rearranger == PIO_REARR_SUBSET) io_comprank = 0; - LOG((3, "i = %d iodesc->scount[i] = %d", i, iodesc->scount[i])); + PLOG((3, "i = %d iodesc->scount[i] = %d", i, iodesc->scount[i])); if (iodesc->scount[i] > 0 && sbuf) { - LOG((3, "io task %d creating sendtypes[%d]", i, io_comprank)); + PLOG((3, "io task %d creating sendtypes[%d]", i, io_comprank)); sendcounts[io_comprank] = 1; if ((mpierr = MPI_Type_create_hvector(nvars, 1, (MPI_Aint)iodesc->ndof * iodesc->mpitype_size, iodesc->stype[i], &sendtypes[io_comprank]))) @@ -964,7 +964,7 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, } /* Data in sbuf on the compute nodes is sent to rbuf on the ionodes */ - LOG((2, "about to call pio_swapm for sbuf")); + PLOG((2, "about to call pio_swapm for sbuf")); if ((ret = pio_swapm(sbuf, sendcounts, sdispls, sendtypes, rbuf, recvcounts, rdispls, recvtypes, mycomm, &iodesc->rearr_opts.comp2io))) @@ -973,7 +973,7 @@ rearrange_comp2io(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, /* Free the MPI types. */ for (int i = 0; i < ntasks; i++) { - LOG((3, "freeing MPI types for task %d", i)); + PLOG((3, "freeing MPI types for task %d", i)); if (sendtypes[i] != PIO_DATATYPE_NULL) if ((mpierr = MPI_Type_free(&sendtypes[i]))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); @@ -1033,7 +1033,7 @@ rearrange_io2comp(iosystem_desc_t *ios, io_desc_t *iodesc, void *sbuf, mycomm = iodesc->subset_comm; niotasks = 1; } - LOG((3, "niotasks = %d", niotasks)); + PLOG((3, "niotasks = %d", niotasks)); /* Get the size of this communicator. */ if ((mpierr = MPI_Comm_size(mycomm, &ntasks))) @@ -1159,12 +1159,12 @@ determine_fill(iosystem_desc_t *ios, io_desc_t *iodesc, const int *gdimlen, totalllen++; /* Add results accross communicator. */ - LOG((2, "determine_fill before allreduce totalllen = %d totalgridsize = %d", - totalllen, totalgridsize)); + PLOG((2, "determine_fill before allreduce totalllen = %d totalgridsize = %d", + totalllen, totalgridsize)); if ((mpierr = MPI_Allreduce(MPI_IN_PLACE, &totalllen, 1, PIO_OFFSET, MPI_SUM, ios->union_comm))) check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "after allreduce totalllen = %d", totalllen)); + PLOG((2, "after allreduce totalllen = %d", totalllen)); /* If the total size of the data provided to be written is < the * total data size then we need fill values. */ @@ -1225,8 +1225,8 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap /* Check inputs. */ pioassert(ios && maplen >= 0 && compmap && gdimlen && ndims > 0 && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "box_rearrange_create maplen = %d ndims = %d ios->num_comptasks = %d " - "ios->num_iotasks = %d", maplen, ndims, ios->num_comptasks, ios->num_iotasks)); + PLOG((1, "box_rearrange_create maplen = %d ndims = %d ios->num_comptasks = %d " + "ios->num_iotasks = %d", maplen, ndims, ios->num_comptasks, ios->num_iotasks)); /* Allocate arrays needed for this function. */ int *dest_ioproc = NULL; /* Destination IO task for each data element on compute task. */ @@ -1312,8 +1312,8 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap * the IO task. For computation tasks, llen will remain at 0. Also * set up arrays for the allgather which will give every IO task a * complete list of llens for each IO task. */ - LOG((3, "ios->ioproc = %d ios->num_uniontasks = %d", ios->ioproc, - ios->num_uniontasks)); + PLOG((3, "ios->ioproc = %d ios->num_uniontasks = %d", ios->ioproc, + ios->num_uniontasks)); pioassert(iodesc->llen == 0, "error", __FILE__, __LINE__); if (ios->ioproc) { @@ -1324,17 +1324,17 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap for (int i = 0; i < ndims; i++) { iodesc->llen *= iodesc->firstregion->count[i]; - LOG((3, "iodesc->firstregion->start[%d] = %d iodesc->firstregion->count[%d] = %d", - i, iodesc->firstregion->start[i], i, iodesc->firstregion->count[i])); + PLOG((3, "iodesc->firstregion->start[%d] = %d iodesc->firstregion->count[%d] = %d", + i, iodesc->firstregion->start[i], i, iodesc->firstregion->count[i])); } - LOG((2, "iodesc->llen = %d", iodesc->llen)); + PLOG((2, "iodesc->llen = %d", iodesc->llen)); } /* Determine whether fill values will be needed. */ if ((ret = determine_fill(ios, iodesc, gdimlen, compmap))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((2, "iodesc->needsfill = %d ios->num_iotasks = %d", iodesc->needsfill, - ios->num_iotasks)); + PLOG((2, "iodesc->needsfill = %d ios->num_iotasks = %d", iodesc->needsfill, + ios->num_iotasks)); /* Set the iomaplen in the sc_info msg */ sc_info_msg_send[0] = iodesc->llen; @@ -1383,8 +1383,8 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap } /* Send sc_info msg from iotasks (all iotasks) to all procs(compute and I/O procs)*/ - LOG((3, "about to call pio_swapm with start/count from iotask ndims = %d", - ndims)); + PLOG((3, "about to call pio_swapm with start/count from iotask ndims = %d", + ndims)); if ((ret = pio_swapm(sc_info_msg_send, sendcounts, sdispls, dtypes, sc_info_msg_recv, recvcounts, rdispls, dtypes, ios->union_comm, &iodesc->rearr_opts.io2comp))) @@ -1393,18 +1393,18 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap #if PIO_ENABLE_LOGGING /* First entry in the sc_info msg for each iorank is the iomaplen */ for (int i = 0; i < ios->num_iotasks; i++) - LOG((3, "iomaplen[%d] = %d", i, sc_info_msg_recv[i * sc_info_msg_sz])); + PLOG((3, "iomaplen[%d] = %d", i, sc_info_msg_recv[i * sc_info_msg_sz])); #endif /* PIO_ENABLE_LOGGING */ /* Convert a 1-D index into a global coordinate value for each data element */ for (int k = 0; k < maplen; k++) { /* The compmap array is 1 based but calculations are 0 based */ - LOG((3, "about to call idx_to_dim_list ndims = %d ", ndims)); + PLOG((3, "about to call idx_to_dim_list ndims = %d ", ndims)); idx_to_dim_list(ndims, gdimlen, compmap[k] - 1, gcoord_map[k]); #if PIO_ENABLE_LOGGING for (int d = 0; d < ndims; d++) - LOG((3, "gcoord_map[%d][%d] = %lld", k, d, gcoord_map[k][d])); + PLOG((3, "gcoord_map[%d][%d] = %lld", k, d, gcoord_map[k][d])); #endif /* PIO_ENABLE_LOGGING */ } @@ -1422,7 +1422,7 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap #if PIO_ENABLE_LOGGING for (int d = 0; d < ndims; d++) - LOG((3, "start[%d] = %lld count[%d] = %lld", d, start[d], d, count[d])); + PLOG((3, "start[%d] = %lld count[%d] = %lld", d, start[d], d, count[d])); #endif /* PIO_ENABLE_LOGGING */ /* For each element of the data array on the compute task, @@ -1459,8 +1459,8 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap { dest_ioindex[k] = coord_to_lindex(ndims, lcoord, count); dest_ioproc[k] = i; - LOG((3, "found dest_ioindex[%d] = %d dest_ioproc[%d] = %d", k, dest_ioindex[k], - k, dest_ioproc[k])); + PLOG((3, "found dest_ioindex[%d] = %d dest_ioproc[%d] = %d", k, dest_ioindex[k], + k, dest_ioproc[k])); } } } @@ -1475,12 +1475,12 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap for (int k = 0; k < maplen; k++) if (dest_ioproc[k] < 0 && compmap[k] > 0) { - LOG((1, "Error: Found dest_ioproc[%d] = %d and compmap[%d] = %lld", k, dest_ioproc[k], k, compmap[k])); + PLOG((1, "Error: Found dest_ioproc[%d] = %d and compmap[%d] = %lld", k, dest_ioproc[k], k, compmap[k])); return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); } /* Completes the mapping for the box rearranger. */ - LOG((2, "calling compute_counts maplen = %d", maplen)); + PLOG((2, "calling compute_counts maplen = %d", maplen)); if ((ret = compute_counts(ios, iodesc, dest_ioproc, dest_ioindex))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); @@ -1494,14 +1494,14 @@ box_rearrange_create(iosystem_desc_t *ios, int maplen, const PIO_Offset *compmap { if ((ret = compute_maxIObuffersize(ios->io_comm, iodesc))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); + PLOG((3, "iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); } /* Using maxiobuflen compute the maximum number of bytes that the * io task buffer can handle. */ if ((ret = compute_maxaggregate_bytes(ios, iodesc))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "iodesc->maxbytes = %d", iodesc->maxbytes)); + PLOG((3, "iodesc->maxbytes = %d", iodesc->maxbytes)); #ifdef TIMING if ((ret = pio_stop_timer("PIO:box_rearrange_create"))) @@ -1544,8 +1544,8 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, /* Check inputs. */ pioassert(ios && maplen >= 0 && compmap && gdimlen && ndims > 0 && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "box_rearrange_create maplen = %d ndims = %d ios->num_comptasks = %d " - "ios->num_iotasks = %d", maplen, ndims, ios->num_comptasks, ios->num_iotasks)); + PLOG((1, "box_rearrange_create maplen = %d ndims = %d ios->num_comptasks = %d " + "ios->num_iotasks = %d", maplen, ndims, ios->num_comptasks, ios->num_iotasks)); /* Allocate arrays needed for this function. */ int *dest_ioproc = NULL; /* Destination IO task for each data element on compute task. */ @@ -1603,8 +1603,8 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, * the IO task. For computation tasks, llen will remain at 0. Also * set up arrays for the allgather which will give every IO task a * complete list of llens for each IO task. */ - LOG((3, "ios->ioproc = %d ios->num_uniontasks = %d", ios->ioproc, - ios->num_uniontasks)); + PLOG((3, "ios->ioproc = %d ios->num_uniontasks = %d", ios->ioproc, + ios->num_uniontasks)); pioassert(iodesc->llen == 0, "error", __FILE__, __LINE__); if (ios->ioproc) { @@ -1622,17 +1622,17 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, for (int i = 0; i < ndims; i++) { iodesc->llen *= iodesc->firstregion->count[i]; - LOG((3, "iodesc->firstregion->start[%d] = %d iodesc->firstregion->count[%d] = %d", - i, iodesc->firstregion->start[i], i, iodesc->firstregion->count[i])); + PLOG((3, "iodesc->firstregion->start[%d] = %d iodesc->firstregion->count[%d] = %d", + i, iodesc->firstregion->start[i], i, iodesc->firstregion->count[i])); } - LOG((2, "iodesc->llen = %d", iodesc->llen)); + PLOG((2, "iodesc->llen = %d", iodesc->llen)); } /* Determine whether fill values will be needed. */ if ((ret = determine_fill(ios, iodesc, gdimlen, compmap))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((2, "iodesc->needsfill = %d ios->num_iotasks = %d", iodesc->needsfill, - ios->num_iotasks)); + PLOG((2, "iodesc->needsfill = %d ios->num_iotasks = %d", iodesc->needsfill, + ios->num_iotasks)); /* Set up receive counts and displacements to for an AllToAll * gather of llen. */ @@ -1640,32 +1640,32 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, { recvcounts[ios->ioranks[i]] = 1; rdispls[ios->ioranks[i]] = i * SIZEOF_MPI_OFFSET; - LOG((3, "i = %d ios->ioranks[%d] = %d recvcounts[%d] = %d rdispls[%d] = %d", - i, i, ios->ioranks[i], ios->ioranks[i], recvcounts[ios->ioranks[i]], - ios->ioranks[i], rdispls[ios->ioranks[i]])); + PLOG((3, "i = %d ios->ioranks[%d] = %d recvcounts[%d] = %d rdispls[%d] = %d", + i, i, ios->ioranks[i], ios->ioranks[i], recvcounts[ios->ioranks[i]], + ios->ioranks[i], rdispls[ios->ioranks[i]])); } /* All-gather the llen to all tasks into array iomaplen. */ - LOG((3, "calling pio_swapm to allgather llen into array iomaplen, ndims = %d dtypes[0] = %d", - ndims, dtypes)); + PLOG((3, "calling pio_swapm to allgather llen into array iomaplen, ndims = %d dtypes[0] = %d", + ndims, dtypes)); if ((ret = pio_swapm(&iodesc->llen, sendcounts, sdispls, dtypes, iomaplen, recvcounts, rdispls, dtypes, ios->union_comm, &iodesc->rearr_opts.io2comp))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "iodesc->llen = %d", iodesc->llen)); + PLOG((3, "iodesc->llen = %d", iodesc->llen)); #if PIO_ENABLE_LOGGING for (int i = 0; i < ios->num_iotasks; i++) - LOG((3, "iomaplen[%d] = %d", i, iomaplen[i])); + PLOG((3, "iomaplen[%d] = %d", i, iomaplen[i])); #endif /* PIO_ENABLE_LOGGING */ /* Convert a 1-D index into a global coordinate value for each data element */ for (int k = 0; k < maplen; k++) { /* The compmap array is 1 based but calculations are 0 based */ - LOG((3, "about to call idx_to_dim_list ndims = %d ", ndims)); + PLOG((3, "about to call idx_to_dim_list ndims = %d ", ndims)); idx_to_dim_list(ndims, gdimlen, compmap[k] - 1, gcoord_map[k]); #if PIO_ENABLE_LOGGING for (int d = 0; d < ndims; d++) - LOG((3, "gcoord_map[%d][%d] = %lld", k, d, gcoord_map[k][d])); + PLOG((3, "gcoord_map[%d][%d] = %lld", k, d, gcoord_map[k][d])); #endif /* PIO_ENABLE_LOGGING */ } @@ -1674,7 +1674,7 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, { /* The ipmaplen contains the llen (number of data elements) * for this IO task. */ - LOG((2, "iomaplen[%d] = %d", i, iomaplen[i])); + PLOG((2, "iomaplen[%d] = %d", i, iomaplen[i])); /* If there is data for this IO task, send start/count to all * compute tasks. */ @@ -1704,8 +1704,8 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, recvcounts[ios->ioranks[i]] = ndims * 2; /* The start/count array from iotask i is sent to all compute tasks. */ - LOG((3, "about to call pio_swapm with start/count from iotask %d ndims = %d", - i, ndims)); + PLOG((3, "about to call pio_swapm with start/count from iotask %d ndims = %d", + i, ndims)); if ((ret = pio_swapm(start_count_send, sendcounts, sdispls, dtypes, start_count_recv, recvcounts, rdispls, dtypes, ios->union_comm, &iodesc->rearr_opts.io2comp))) @@ -1717,7 +1717,7 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, #if PIO_ENABLE_LOGGING for (int d = 0; d < ndims; d++) - LOG((3, "start[%d] = %lld count[%d] = %lld", d, start[d], d, count[d])); + PLOG((3, "start[%d] = %lld count[%d] = %lld", d, start[d], d, count[d])); #endif /* PIO_ENABLE_LOGGING */ /* For each element of the data array on the compute task, @@ -1754,8 +1754,8 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, { dest_ioindex[k] = coord_to_lindex(ndims, lcoord, count); dest_ioproc[k] = i; - LOG((3, "found dest_ioindex[%d] = %d dest_ioproc[%d] = %d", k, dest_ioindex[k], - k, dest_ioproc[k])); + PLOG((3, "found dest_ioindex[%d] = %d dest_ioproc[%d] = %d", k, dest_ioindex[k], + k, dest_ioproc[k])); } } } @@ -1772,7 +1772,7 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); /* Completes the mapping for the box rearranger. */ - LOG((2, "calling compute_counts maplen = %d", maplen)); + PLOG((2, "calling compute_counts maplen = %d", maplen)); if ((ret = compute_counts(ios, iodesc, dest_ioproc, dest_ioindex))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); @@ -1786,14 +1786,14 @@ box_rearrange_create_with_holes(iosystem_desc_t *ios, int maplen, { if ((ret = compute_maxIObuffersize(ios->io_comm, iodesc))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); + PLOG((3, "iodesc->maxiobuflen = %d", iodesc->maxiobuflen)); } /* Using maxiobuflen compute the maximum number of bytes that the * io task buffer can handle. */ if ((ret = compute_maxaggregate_bytes(ios, iodesc))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "iodesc->maxbytes = %d", iodesc->maxbytes)); + PLOG((3, "iodesc->maxbytes = %d", iodesc->maxbytes)); #ifdef TIMING if ((ret = pio_stop_timer("PIO:box_rearrange_create_with_holes"))) @@ -1853,20 +1853,20 @@ get_regions(int ndims, const int *gdimlen, int maplen, const PIO_Offset *map, /* Check inputs. */ pioassert(ndims >= 0 && gdimlen && maplen >= 0 && maxregions && firstregion, "invalid input", __FILE__, __LINE__); - LOG((1, "get_regions ndims = %d maplen = %d", ndims, maplen)); + PLOG((1, "get_regions ndims = %d maplen = %d", ndims, maplen)); region = firstregion; if (map) { while (map[nmaplen++] <= 0) { - LOG((3, "map[%d] = %d", nmaplen, map[nmaplen])); + PLOG((3, "map[%d] = %d", nmaplen, map[nmaplen])); ; } nmaplen--; } region->loffset = nmaplen; - LOG((2, "region->loffset = %d", region->loffset)); + PLOG((2, "region->loffset = %d", region->loffset)); *maxregions = 1; @@ -1886,12 +1886,12 @@ get_regions(int ndims, const int *gdimlen, int maplen, const PIO_Offset *map, pioassert(region->start[0] >= 0, "failed to find region", __FILE__, __LINE__); nmaplen = nmaplen + regionlen; - LOG((2, "regionlen = %d nmaplen = %d", regionlen, nmaplen)); + PLOG((2, "regionlen = %d nmaplen = %d", regionlen, nmaplen)); /* If we need to, allocate the next region. */ if (region->next == NULL && nmaplen < maplen) { - LOG((2, "allocating next region")); + PLOG((2, "allocating next region")); if ((ret = alloc_region2(NULL, ndims, ®ion->next))) return ret; @@ -1905,7 +1905,7 @@ get_regions(int ndims, const int *gdimlen, int maplen, const PIO_Offset *map, maxregions will be the total number of regions on this task. */ (*maxregions)++; - LOG((2, "*maxregions = %d", *maxregions)); + PLOG((2, "*maxregions = %d", *maxregions)); } } @@ -1938,8 +1938,8 @@ default_subset_partition(iosystem_desc_t *ios, io_desc_t *iodesc) int mpierr; /* Return value from MPI functions. */ pioassert(ios && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "default_subset_partition ios->ioproc = %d ios->io_rank = %d " - "ios->comp_rank = %d", ios->ioproc, ios->io_rank, ios->comp_rank)); + PLOG((1, "default_subset_partition ios->ioproc = %d ios->io_rank = %d " + "ios->comp_rank = %d", ios->ioproc, ios->io_rank, ios->comp_rank)); /* Create a new comm for each subset group with the io task in rank 0 and only 1 io task per group */ @@ -1954,7 +1954,7 @@ default_subset_partition(iosystem_desc_t *ios, io_desc_t *iodesc) key = max(1, ios->comp_rank % taskratio + 1); color = min(ios->num_iotasks - 1, ios->comp_rank / taskratio); } - LOG((3, "key = %d color = %d", key, color)); + PLOG((3, "key = %d color = %d", key, color)); /* Create new communicators. */ if ((mpierr = MPI_Comm_split(ios->comp_comm, color, key, &iodesc->subset_comm))) @@ -2032,7 +2032,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, pioassert(ios && maplen >= 0 && compmap && gdimlen && ndims >= 0 && iodesc, "invalid input", __FILE__, __LINE__); - LOG((2, "subset_rearrange_create maplen = %d ndims = %d", maplen, ndims)); + PLOG((2, "subset_rearrange_create maplen = %d ndims = %d", maplen, ndims)); /* subset partitions each have exactly 1 io task which is task 0 * of that subset_comm */ @@ -2235,7 +2235,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, } /* Handle fill values if needed. */ - LOG((4, "ios->ioproc %d iodesc->needsfill %d", ios->ioproc, iodesc->needsfill)); + PLOG((4, "ios->ioproc %d iodesc->needsfill %d", ios->ioproc, iodesc->needsfill)); if (ios->ioproc && iodesc->needsfill) { /* we need the list of offsets which are not in the union of iomap */ @@ -2250,7 +2250,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, thisgridsize[0] = totalgridsize / ios->num_iotasks; thisgridmax[0] = thisgridsize[0]; int xtra = totalgridsize - thisgridsize[0] * ios->num_iotasks; - LOG((4, "xtra %d", xtra)); + PLOG((4, "xtra %d", xtra)); for (nio = 0; nio < ios->num_iotasks; nio++) { @@ -2263,8 +2263,8 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, thisgridsize[nio]++; thisgridmin[nio] = thisgridmax[nio - 1] + 1; thisgridmax[nio] = thisgridmin[nio] + thisgridsize[nio] - 1; - LOG((4, "nio %d thisgridsize[nio] %d thisgridmin[nio] %d thisgridmax[nio] %d", - nio, thisgridsize[nio], thisgridmin[nio], thisgridmax[nio])); + PLOG((4, "nio %d thisgridsize[nio] %d thisgridmin[nio] %d thisgridmax[nio] %d", + nio, thisgridsize[nio], thisgridmin[nio], thisgridmax[nio])); } for (int i = 0; i < iodesc->llen; i++) { @@ -2275,7 +2275,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, imin = i; } } - LOG((4, "cnt %d", cnt)); + PLOG((4, "cnt %d", cnt)); /* Gather cnt from all tasks in the IO communicator into array gcnt. */ if ((mpierr = MPI_Gather(&cnt, 1, MPI_INT, gcnt, 1, MPI_INT, nio, ios->io_comm))) @@ -2303,7 +2303,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, /* Allocate and initialize a grid to fill in missing values. ??? */ PIO_Offset grid[thisgridsize[ios->io_rank]]; - LOG((4, "thisgridsize[ios->io_rank] %d", thisgridsize[ios->io_rank])); + PLOG((4, "thisgridsize[ios->io_rank] %d", thisgridsize[ios->io_rank])); for (i = 0; i < thisgridsize[ios->io_rank]; i++) grid[i] = 0; @@ -2313,7 +2313,7 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, int j = myusegrid[i] - thisgridmin[ios->io_rank]; pioassert(j < thisgridsize[ios->io_rank], "out of bounds array index", __FILE__, __LINE__); - LOG((4, "i %d myusegrid[i] %d j %d", i, myusegrid[i], j)); + PLOG((4, "i %d myusegrid[i] %d j %d", i, myusegrid[i], j)); if (j >= 0) { grid[j] = 1; @@ -2324,8 +2324,8 @@ subset_rearrange_create(iosystem_desc_t *ios, int maplen, PIO_Offset *compmap, free(myusegrid); iodesc->holegridsize = thisgridsize[ios->io_rank] - cnt; - LOG((3, "iodesc->holegridsize %d thisgridsize[%d] %d cnt %d", iodesc->holegridsize, - ios->io_rank, thisgridsize[ios->io_rank], cnt)); + PLOG((3, "iodesc->holegridsize %d thisgridsize[%d] %d cnt %d", iodesc->holegridsize, + ios->io_rank, thisgridsize[ios->io_rank], cnt)); if (iodesc->holegridsize > 0) { /* Allocate space for the fillgrid. */ @@ -2530,8 +2530,8 @@ performance_tune_rearranger(iosystem_desc_t *ios, io_desc_t *iodesc) iodesc->isend = isend; iodesc->max_requests = maxreqs; - LOG((1, "spmd optimization: maxreqs: %d handshake:%d isend:%d mintime=%f\n", - maxreqs,handshake,isend,mintime)); + PLOG((1, "spmd optimization: maxreqs: %d handshake:%d isend:%d mintime=%f\n", + maxreqs,handshake,isend,mintime)); /* Free memory. */ brel(wall); diff --git a/src/clib/pio_spmd.c b/src/clib/pio_spmd.c index 9ab3cfb54f2..4d9418037e7 100644 --- a/src/clib/pio_spmd.c +++ b/src/clib/pio_spmd.c @@ -92,8 +92,8 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty MPI_Status status; /* Not actually used - replace with MPI_STATUSES_IGNORE. */ int mpierr; /* Return code from MPI functions. */ - LOG((2, "pio_swapm fc->hs = %d fc->isend = %d fc->max_pend_req = %d", fc->hs, - fc->isend, fc->max_pend_req)); + PLOG((2, "pio_swapm fc->hs = %d fc->isend = %d fc->max_pend_req = %d", fc->hs, + fc->isend, fc->max_pend_req)); /* Get my rank and size of communicator. */ if ((mpierr = MPI_Comm_size(comm, &ntasks))) @@ -101,7 +101,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty if ((mpierr = MPI_Comm_rank(comm, &my_rank))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "ntasks = %d my_rank = %d", ntasks, my_rank)); + PLOG((2, "ntasks = %d my_rank = %d", ntasks, my_rank)); /* Now we know the size of these arrays. */ int swapids[ntasks]; @@ -113,9 +113,9 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty #if PIO_ENABLE_LOGGING { for (int p = 0; p < ntasks; p++) - LOG((4, "sendcounts[%d] = %d sdispls[%d] = %d sendtypes[%d] = %d recvcounts[%d] = %d " - "rdispls[%d] = %d recvtypes[%d] = %d", p, sendcounts[p], p, sdispls[p], p, - sendtypes[p], p, recvcounts[p], p, rdispls[p], p, recvtypes[p])); + PLOG((4, "sendcounts[%d] = %d sdispls[%d] = %d sendtypes[%d] = %d recvcounts[%d] = %d " + "rdispls[%d] = %d recvtypes[%d] = %d", p, sendcounts[p], p, sdispls[p], p, + sendtypes[p], p, recvcounts[p], p, rdispls[p], p, recvtypes[p])); } #endif /* PIO_ENABLE_LOGGING */ @@ -124,7 +124,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty if (fc->max_pend_req == 0) { /* Call the MPI alltoall without flow control. */ - LOG((3, "Calling MPI_Alltoallw without flow control.")); + PLOG((3, "Calling MPI_Alltoallw without flow control.")); if ((mpierr = MPI_Alltoallw(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); @@ -169,7 +169,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty /* #endif */ } - LOG((2, "Done sending to self... sending to other procs")); + PLOG((2, "Done sending to self... sending to other procs")); /* When send to self is complete there is nothing left to do if * ntasks==1. */ @@ -198,7 +198,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty swapids[steps++] = p; } - LOG((3, "steps=%d", steps)); + PLOG((3, "steps=%d", steps)); if (steps == 0) return PIO_NOERR; @@ -233,7 +233,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty } } - LOG((2, "fc->max_pend_req=%d, maxreq=%d, maxreqh=%d", fc->max_pend_req, maxreq, maxreqh)); + PLOG((2, "fc->max_pend_req=%d, maxreq=%d, maxreqh=%d", fc->max_pend_req, maxreq, maxreqh)); /* If handshaking is in use, do a nonblocking recieve to listen * for it. */ @@ -362,7 +362,7 @@ int pio_swapm(void *sendbuf, int *sendcounts, int *sdispls, MPI_Datatype *sendty * them here. */ if (steps > 0) { - LOG((2, "Waiting for outstanding msgs")); + PLOG((2, "Waiting for outstanding msgs")); if ((mpierr = MPI_Waitall(steps, rcvids, MPI_STATUSES_IGNORE))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); if (fc->isend) diff --git a/src/clib/pioc.c b/src/clib/pioc.c index a3f2d8206b0..1f0c1ab2ff8 100644 --- a/src/clib/pioc.c +++ b/src/clib/pioc.c @@ -175,7 +175,7 @@ PIOc_advanceframe(int ncid, int varid) int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ret; - LOG((1, "PIOc_advanceframe ncid = %d varid = %d", ncid, varid)); + PLOG((1, "PIOc_advanceframe ncid = %d varid = %d", ncid, varid)); /* Get the file info. */ if ((ret = pio_get_file(ncid, &file))) @@ -236,8 +236,8 @@ PIOc_setframe(int ncid, int varid, int frame) int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ret; - LOG((1, "PIOc_setframe ncid = %d varid = %d frame = %d", ncid, - varid, frame)); + PLOG((1, "PIOc_setframe ncid = %d varid = %d frame = %d", ncid, + varid, frame)); /* Get file info. */ if ((ret = pio_get_file(ncid, &file))) @@ -372,8 +372,8 @@ PIOc_set_iosystem_error_handling(int iosysid, int method, int *old_method) iosystem_desc_t *ios = NULL; int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ - LOG((1, "PIOc_set_iosystem_error_handling iosysid = %d method = %d", iosysid, - method)); + PLOG((1, "PIOc_set_iosystem_error_handling iosysid = %d method = %d", iosysid, + method)); /* Find info about this iosystem. */ if (iosysid != PIO_DEFAULT) @@ -498,8 +498,8 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function calls. */ int ierr; /* Return code. */ - LOG((1, "PIOc_InitDecomp iosysid = %d pio_type = %d ndims = %d maplen = %d", - iosysid, pio_type, ndims, maplen)); + PLOG((1, "PIOc_InitDecomp iosysid = %d pio_type = %d ndims = %d maplen = %d", + iosysid, pio_type, ndims, maplen)); #ifdef USE_MPE pio_start_mpe_log(DECOMP); @@ -558,8 +558,8 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma mpierr = MPI_Bcast(&iocount_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm); if (iocount_present && !mpierr) mpierr = MPI_Bcast((PIO_Offset *)iocount, ndims, MPI_OFFSET, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_InitDecomp iosysid = %d pio_type = %d ndims = %d maplen = %d rearranger_present = %d iostart_present = %d " - "iocount_present = %d ", iosysid, pio_type, ndims, maplen, rearranger_present, iostart_present, iocount_present)); + PLOG((2, "PIOc_InitDecomp iosysid = %d pio_type = %d ndims = %d maplen = %d rearranger_present = %d iostart_present = %d " + "iocount_present = %d ", iosysid, pio_type, ndims, maplen, rearranger_present, iostart_present, iocount_present)); } /* Handle MPI errors. */ @@ -572,7 +572,7 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma /* Allocate space for the iodesc info. This also allocates the * first region and copies the rearranger opts into this * iodesc. */ - LOG((2, "allocating iodesc pio_type %d ndims %d", pio_type, ndims)); + PLOG((2, "allocating iodesc pio_type %d ndims %d", pio_type, ndims)); if ((ierr = malloc_iodesc(ios, pio_type, ndims, &iodesc))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); @@ -589,7 +589,7 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma if(m > 0 && compmap[m] > 0 && compmap[m] < compmap[m-1]) { iodesc->needssort = true; - LOG((2, "compmap[%d] = %ld compmap[%d]= %ld", m, compmap[m], m-1, compmap[m-1])); + PLOG((2, "compmap[%d] = %ld compmap[%d]= %ld", m, compmap[m], m-1, compmap[m-1])); break; } } @@ -636,14 +636,14 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma iodesc->rearranger = ios->default_rearranger; else iodesc->rearranger = *rearranger; - LOG((2, "iodesc->rearranger = %d", iodesc->rearranger)); + PLOG((2, "iodesc->rearranger = %d", iodesc->rearranger)); /* Is this the subset rearranger? */ if (iodesc->rearranger == PIO_REARR_SUBSET) { iodesc->num_aiotasks = ios->num_iotasks; - LOG((2, "creating subset rearranger iodesc->num_aiotasks = %d", - iodesc->num_aiotasks)); + PLOG((2, "creating subset rearranger iodesc->num_aiotasks = %d", + iodesc->num_aiotasks)); if ((ierr = subset_rearrange_create(ios, maplen, (PIO_Offset *)iodesc->map, gdimlen, ndims, iodesc))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); @@ -656,7 +656,7 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma * IO task compute it. */ if (iostart && iocount) { - LOG((3, "iostart and iocount provided")); + PLOG((3, "iostart and iocount provided")); for (int i = 0; i < ndims; i++) { iodesc->firstregion->start[i] = iostart[i]; @@ -667,7 +667,7 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma else { /* Compute start and count values for each io task. */ - LOG((2, "about to call CalcStartandCount pio_type = %d ndims = %d", pio_type, ndims)); + PLOG((2, "about to call CalcStartandCount pio_type = %d ndims = %d", pio_type, ndims)); if ((ierr = CalcStartandCount(pio_type, ndims, gdimlen, ios->num_iotasks, ios->io_rank, iodesc->firstregion->start, iodesc->firstregion->count, &iodesc->num_aiotasks))) @@ -677,8 +677,8 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma /* Compute the max io buffer size needed for an iodesc. */ if ((ierr = compute_maxIObuffersize(ios->io_comm, iodesc))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); - LOG((3, "compute_maxIObuffersize called iodesc->maxiobuflen = %d", - iodesc->maxiobuflen)); + PLOG((3, "compute_maxIObuffersize called iodesc->maxiobuflen = %d", + iodesc->maxiobuflen)); } /* Depending on array size and io-blocksize the actual number @@ -686,7 +686,7 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma if ((mpierr = MPI_Bcast(&(iodesc->num_aiotasks), 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "iodesc->num_aiotasks = %d", iodesc->num_aiotasks)); + PLOG((3, "iodesc->num_aiotasks = %d", iodesc->num_aiotasks)); /* Compute the communications pattern for this decomposition. */ if (iodesc->rearranger == PIO_REARR_BOX) @@ -697,10 +697,10 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma /* Broadcast next ioid to all tasks from io root.*/ if (ios->async) { - LOG((3, "createfile bcasting pio_next_ioid %d", pio_next_ioid)); + PLOG((3, "createfile bcasting pio_next_ioid %d", pio_next_ioid)); if ((mpierr = MPI_Bcast(&pio_next_ioid, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "createfile bcast pio_next_ioid %d", pio_next_ioid)); + PLOG((3, "createfile bcast pio_next_ioid %d", pio_next_ioid)); } /* Set the decomposition ID. */ @@ -714,13 +714,13 @@ PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int ma #if PIO_ENABLE_LOGGING /* Log results. */ - LOG((2, "iodesc ioid = %d nrecvs = %d ndof = %d ndims = %d num_aiotasks = %d " - "rearranger = %d maxregions = %d needsfill = %d llen = %d maxiobuflen = %d", - iodesc->ioid, iodesc->nrecvs, iodesc->ndof, iodesc->ndims, iodesc->num_aiotasks, - iodesc->rearranger, iodesc->maxregions, iodesc->needsfill, iodesc->llen, - iodesc->maxiobuflen)); + PLOG((2, "iodesc ioid = %d nrecvs = %d ndof = %d ndims = %d num_aiotasks = %d " + "rearranger = %d maxregions = %d needsfill = %d llen = %d maxiobuflen = %d", + iodesc->ioid, iodesc->nrecvs, iodesc->ndof, iodesc->ndims, iodesc->num_aiotasks, + iodesc->rearranger, iodesc->maxregions, iodesc->needsfill, iodesc->llen, + iodesc->maxiobuflen)); for (int j = 0; j < iodesc->llen; j++) - LOG((3, "rindex[%d] = %lld", j, iodesc->rindex[j])); + PLOG((3, "rindex[%d] = %lld", j, iodesc->rindex[j])); #endif /* PIO_ENABLE_LOGGING */ /* This function only does something if pre-processor macro @@ -770,8 +770,8 @@ PIOc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int m int *rearrangerp = NULL; int ret; - LOG((1, "PIOc_init_decomp iosysid = %d pio_type = %d ndims = %d maplen = %d", - iosysid, pio_type, ndims, maplen)); + PLOG((1, "PIOc_init_decomp iosysid = %d pio_type = %d ndims = %d maplen = %d", + iosysid, pio_type, ndims, maplen)); /* If the user specified a non-default rearranger, use it. */ if (rearranger) @@ -784,7 +784,7 @@ PIOc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int m /* Add 1 to all elements in compmap. */ for (int e = 0; e < maplen; e++) { - LOG((3, "zero-based compmap[%d] = %d", e, compmap[e])); + PLOG((3, "zero-based compmap[%d] = %d", e, compmap[e])); compmap_1_based[e] = compmap[e] + 1; } @@ -824,7 +824,7 @@ PIOc_InitDecomp_bc(int iosysid, int pio_type, int ndims, const int *gdimlen, PIO_Offset prod[ndims], loc[ndims]; int rearr = PIO_REARR_SUBSET; - LOG((1, "PIOc_InitDecomp_bc iosysid = %d pio_type = %d ndims = %d")); + PLOG((1, "PIOc_InitDecomp_bc iosysid = %d pio_type = %d ndims = %d")); /* Get the info about the io system. */ if (!(ios = pio_get_iosystem_from_id(iosysid))) @@ -946,8 +946,8 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, if (!iosysidp || num_iotasks < 1 || num_iotasks * stride > num_comptasks) return pio_err(NULL, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_Init_Intracomm comp_comm = %d num_iotasks = %d stride = %d base = %d " - "rearr = %d", comp_comm, num_iotasks, stride, base, rearr)); + PLOG((1, "PIOc_Init_Intracomm comp_comm = %d num_iotasks = %d stride = %d base = %d " + "rearr = %d", comp_comm, num_iotasks, stride, base, rearr)); /* Allocate memory for the iosystem info. */ if (!(ios = calloc(1, sizeof(iosystem_desc_t)))) @@ -974,7 +974,7 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, /* Copy the computation communicator into comp_comm. */ if ((mpierr = MPI_Comm_dup(comp_comm, &ios->comp_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "union_comm = %d comp_comm = %d", ios->union_comm, ios->comp_comm)); + PLOG((2, "union_comm = %d comp_comm = %d", ios->union_comm, ios->comp_comm)); ios->my_comm = ios->comp_comm; ustride = stride; @@ -996,7 +996,7 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, /* Is this the comp master? */ if (ios->comp_rank == 0) ios->compmaster = MPI_ROOT; - LOG((2, "comp_rank = %d num_comptasks = %d", ios->comp_rank, ios->num_comptasks)); + PLOG((2, "comp_rank = %d num_comptasks = %d", ios->comp_rank, ios->num_comptasks)); /* Create an array that holds the ranks of the tasks to be used * for IO. */ @@ -1007,7 +1007,7 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, ios->ioranks[i] = (base + i * ustride) % ios->num_comptasks; if (ios->ioranks[i] == ios->comp_rank) ios->ioproc = true; - LOG((3, "ios->ioranks[%d] = %d", i, ios->ioranks[i])); + PLOG((3, "ios->ioranks[%d] = %d", i, ios->ioranks[i])); } ios->ioroot = ios->ioranks[0]; @@ -1048,7 +1048,7 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, } else ios->io_rank = -1; - LOG((3, "ios->io_comm = %d ios->io_rank = %d", ios->io_comm, ios->io_rank)); + PLOG((3, "ios->io_comm = %d ios->io_rank = %d", ios->io_comm, ios->io_rank)); /* Rank in the union comm is the same as rank in the comp comm. */ ios->union_rank = ios->comp_rank; @@ -1063,7 +1063,7 @@ PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, #ifdef USE_MPE pio_stop_mpe_log(INIT, __func__); #endif /* USE_MPE */ - LOG((2, "Init_Intracomm complete iosysid = %d", *iosysidp)); + PLOG((2, "Init_Intracomm complete iosysid = %d", *iosysidp)); return PIO_NOERR; } @@ -1094,13 +1094,13 @@ PIOc_Init_Intracomm_from_F90(int f90_comp_comm, iosysidp); if (ret != PIO_NOERR) { - LOG((1, "PIOc_Init_Intracomm failed")); + PLOG((1, "PIOc_Init_Intracomm failed")); return ret; } if (rearr_opts) { - LOG((1, "Setting rearranger options, iosys=%d", *iosysidp)); + PLOG((1, "Setting rearranger options, iosys=%d", *iosysidp)); return PIOc_set_rearr_opts(*iosysidp, rearr_opts->comm_type, rearr_opts->fcd, rearr_opts->comp2io.hs, @@ -1137,7 +1137,7 @@ PIOc_set_hint(int iosysid, const char *hint, const char *hintval) if (!hint || !hintval) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_set_hint hint = %s hintval = %s", hint, hintval)); + PLOG((1, "PIOc_set_hint hint = %s hintval = %s", hint, hintval)); /* Make sure we have an info object. */ if (ios->info == MPI_INFO_NULL) @@ -1170,8 +1170,8 @@ PIOc_free_iosystem(int iosysid) int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function codes. */ int ierr = PIO_NOERR; - LOG((1, "PIOc_finalize iosysid = %d MPI_COMM_NULL = %d", iosysid, - MPI_COMM_NULL)); + PLOG((1, "PIOc_finalize iosysid = %d MPI_COMM_NULL = %d", iosysid, + MPI_COMM_NULL)); /* Find the IO system information. */ if (!(ios = pio_get_iosystem_from_id(iosysid))) @@ -1185,12 +1185,12 @@ PIOc_free_iosystem(int iosysid) { int msg = PIO_MSG_EXIT; - LOG((3, "found iosystem info comproot = %d union_comm = %d comp_idx = %d", - ios->comproot, ios->union_comm, ios->comp_idx)); + PLOG((3, "found iosystem info comproot = %d union_comm = %d comp_idx = %d", + ios->comproot, ios->union_comm, ios->comp_idx)); if (!ios->ioproc) { - LOG((2, "sending msg = %d ioroot = %d union_comm = %d", msg, - ios->ioroot, ios->union_comm)); + PLOG((2, "sending msg = %d ioroot = %d union_comm = %d", msg, + ios->ioroot, ios->union_comm)); /* Send the message to the message handler. */ if (ios->compmaster == MPI_ROOT) @@ -1202,32 +1202,32 @@ PIOc_free_iosystem(int iosysid) } /* Handle MPI errors. */ - LOG((3, "handling async errors mpierr = %d my_comm = %d", mpierr, ios->my_comm)); + PLOG((3, "handling async errors mpierr = %d my_comm = %d", mpierr, ios->my_comm)); if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm))) return check_mpi(ios, NULL, mpierr2, __FILE__, __LINE__); if (mpierr) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "async errors bcast")); + PLOG((3, "async errors bcast")); } /* Free this memory that was allocated in init_intracomm. */ if (ios->ioranks) free(ios->ioranks); - LOG((3, "Freed ioranks.")); + PLOG((3, "Freed ioranks.")); if (ios->compranks) free(ios->compranks); - LOG((3, "Freed compranks.")); + PLOG((3, "Freed compranks.")); /* Learn the number of open IO systems. */ if ((ierr = pio_num_iosystem(&niosysid))) return pio_err(ios, NULL, ierr, __FILE__, __LINE__); - LOG((2, "%d iosystems are still open.", niosysid)); + PLOG((2, "%d iosystems are still open.", niosysid)); /* Only free the buffer pool if this is the last open iosysid. */ if (niosysid == 1) { free_cn_buffer_pool(ios); - LOG((2, "Freed buffer pool.")); + PLOG((2, "Freed buffer pool.")); } /* Free the MPI communicators. my_comm is just a copy (but not an @@ -1251,17 +1251,17 @@ PIOc_free_iosystem(int iosysid) MPI_Info_free(&ios->info); /* Delete the iosystem_desc_t data associated with this id. */ - LOG((2, "About to delete iosysid %d.", iosysid)); + PLOG((2, "About to delete iosysid %d.", iosysid)); if ((ierr = pio_delete_iosystem_from_list(iosysid))) return pio_err(NULL, NULL, ierr, __FILE__, __LINE__); if (niosysid == 1) { - LOG((1, "about to finalize logging")); + PLOG((1, "about to finalize logging")); pio_finalize_logging(); } - LOG((2, "PIOc_finalize completed successfully")); + PLOG((2, "PIOc_finalize completed successfully")); return PIO_NOERR; } @@ -1444,8 +1444,8 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, /* Turn on the logging system for PIO. */ if ((ret = pio_init_logging())) return pio_err(NULL, NULL, ret, __FILE__, __LINE__); - LOG((1, "PIOc_init_async num_io_procs = %d component_count = %d", num_io_procs, - component_count)); + PLOG((1, "PIOc_init_async num_io_procs = %d component_count = %d", num_io_procs, + component_count)); #ifdef USE_MPE pio_start_mpe_log(INIT); @@ -1470,7 +1470,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, if (my_rank == my_io_proc_list[pidx]) break; int in_io = (pidx == num_io_procs) ? 0 : 1; - LOG((3, "in_io = %d", in_io)); + PLOG((3, "in_io = %d", in_io)); /* Allocate struct to hold io system info for each computation component. */ iosystem_desc_t *iosys[component_count], *my_iosys; @@ -1482,7 +1482,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, MPI_Group world_group; if ((ret = MPI_Comm_group(world, &world_group))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "world group created")); + PLOG((3, "world group created")); /* We will create a group for the IO component. */ MPI_Group io_group; @@ -1500,12 +1500,12 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, /* Create a group for the IO component. */ if ((ret = MPI_Group_incl(world_group, num_io_procs, my_io_proc_list, &io_group))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "created IO group - io_group = %d MPI_GROUP_EMPTY = %d", io_group, MPI_GROUP_EMPTY)); + PLOG((3, "created IO group - io_group = %d MPI_GROUP_EMPTY = %d", io_group, MPI_GROUP_EMPTY)); /* There is one shared IO comm. Create it. */ if ((ret = MPI_Comm_create(world, io_group, &io_comm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "created io comm io_comm = %d", io_comm)); + PLOG((3, "created io comm io_comm = %d", io_comm)); /* Does the user want a copy of the IO communicator? */ if (user_io_comm) @@ -1520,12 +1520,12 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, * communicator. */ if (in_io) { - LOG((3, "about to get io rank")); + PLOG((3, "about to get io rank")); if ((ret = MPI_Comm_rank(io_comm, &io_rank))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); iomaster = !io_rank ? MPI_ROOT : MPI_PROC_NULL; - LOG((3, "intracomm created for io_comm = %d io_rank = %d IO %s", - io_comm, io_rank, iomaster == MPI_ROOT ? "MASTER" : "SERVANT")); + PLOG((3, "intracomm created for io_comm = %d io_rank = %d IO %s", + io_comm, io_rank, iomaster == MPI_ROOT ? "MASTER" : "SERVANT")); } /* We will create a group for each computational component. */ @@ -1539,7 +1539,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, /* For each computation component. */ for (int cmp = 0; cmp < component_count; cmp++) { - LOG((3, "processing component %d", cmp)); + PLOG((3, "processing component %d", cmp)); /* Get pointer to current iosys. */ my_iosys = iosys[cmp]; @@ -1563,7 +1563,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, /* The rank of the computation leader in the union comm. */ my_iosys->comproot = num_io_procs; - LOG((3, "my_iosys->comproot = %d", my_iosys->comproot)); + PLOG((3, "my_iosys->comproot = %d", my_iosys->comproot)); /* We are not providing an info object. */ my_iosys->info = MPI_INFO_NULL; @@ -1572,7 +1572,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, if ((ret = MPI_Group_incl(world_group, num_procs_per_comp[cmp], my_proc_list[cmp], &group[cmp]))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "created component MPI group - group[%d] = %d", cmp, group[cmp])); + PLOG((3, "created component MPI group - group[%d] = %d", cmp, group[cmp])); /* For all the computation components create a union group * with their processors and the processors of the (shared) IO @@ -1593,8 +1593,8 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, for (int p = 0; p < num_procs_per_comp[cmp]; p++) { proc_list_union[p + num_io_procs] = my_proc_list[cmp][p]; - LOG((3, "p %d num_io_procs %d proc_list_union[p + num_io_procs] %d ", - p, num_io_procs, proc_list_union[p + num_io_procs])); + PLOG((3, "p %d num_io_procs %d proc_list_union[p + num_io_procs] %d ", + p, num_io_procs, proc_list_union[p + num_io_procs])); } /* Allocate space for computation task ranks. */ @@ -1619,19 +1619,19 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, if (my_rank == my_proc_list[cmp][pidx]) break; in_cmp = (pidx == num_procs_per_comp[cmp]) ? 0 : 1; - LOG((3, "pidx = %d num_procs_per_comp[%d] = %d in_cmp = %d", - pidx, cmp, num_procs_per_comp[cmp], in_cmp)); + PLOG((3, "pidx = %d num_procs_per_comp[%d] = %d in_cmp = %d", + pidx, cmp, num_procs_per_comp[cmp], in_cmp)); /* Create the union group. */ if ((ret = MPI_Group_incl(world_group, nprocs_union, proc_list_union, &union_group[cmp]))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "created union MPI_group - union_group[%d] = %d with %d procs", cmp, - union_group[cmp], nprocs_union)); + PLOG((3, "created union MPI_group - union_group[%d] = %d with %d procs", cmp, + union_group[cmp], nprocs_union)); /* Create an intracomm for this component. Only processes in * the component need to participate in the intracomm create * call. */ - LOG((3, "creating intracomm cmp = %d from group[%d] = %d", cmp, cmp, group[cmp])); + PLOG((3, "creating intracomm cmp = %d from group[%d] = %d", cmp, cmp, group[cmp])); if ((ret = MPI_Comm_create(world, group[cmp], &my_iosys->comp_comm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); @@ -1651,19 +1651,19 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, * setting of MPI_PROC_NULL. */ my_iosys->compmaster = my_iosys->comp_rank ? MPI_PROC_NULL : MPI_ROOT; - LOG((3, "intracomm created for cmp = %d comp_comm = %d comp_rank = %d comp %s", - cmp, my_iosys->comp_comm, my_iosys->comp_rank, - my_iosys->compmaster == MPI_ROOT ? "MASTER" : "SERVANT")); + PLOG((3, "intracomm created for cmp = %d comp_comm = %d comp_rank = %d comp %s", + cmp, my_iosys->comp_comm, my_iosys->comp_rank, + my_iosys->compmaster == MPI_ROOT ? "MASTER" : "SERVANT")); } /* If this is the IO component, make a copy of the IO comm for * each computational component. */ if (in_io) { - LOG((3, "making a dup of io_comm = %d io_rank = %d", io_comm, io_rank)); + PLOG((3, "making a dup of io_comm = %d io_rank = %d", io_comm, io_rank)); if ((ret = MPI_Comm_dup(io_comm, &my_iosys->io_comm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "dup of io_comm = %d io_rank = %d", my_iosys->io_comm, io_rank)); + PLOG((3, "dup of io_comm = %d io_rank = %d", my_iosys->io_comm, io_rank)); my_iosys->iomaster = iomaster; my_iosys->io_rank = io_rank; my_iosys->ioroot = 0; @@ -1680,28 +1680,28 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, /* All the processes in this component, and the IO component, * are part of the union_comm. */ - LOG((3, "before creating union_comm my_iosys->io_comm = %d group = %d", my_iosys->io_comm, union_group[cmp])); + PLOG((3, "before creating union_comm my_iosys->io_comm = %d group = %d", my_iosys->io_comm, union_group[cmp])); if ((ret = MPI_Comm_create(world, union_group[cmp], &my_iosys->union_comm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "created union comm for cmp %d my_iosys->union_comm %d", cmp, my_iosys->union_comm)); + PLOG((3, "created union comm for cmp %d my_iosys->union_comm %d", cmp, my_iosys->union_comm)); if (in_io || in_cmp) { if ((ret = MPI_Comm_rank(my_iosys->union_comm, &my_iosys->union_rank))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); - LOG((3, "my_iosys->union_rank %d", my_iosys->union_rank)); + PLOG((3, "my_iosys->union_rank %d", my_iosys->union_rank)); /* Set my_comm to union_comm for async. */ my_iosys->my_comm = my_iosys->union_comm; - LOG((3, "intracomm created for union cmp = %d union_rank = %d union_comm = %d", - cmp, my_iosys->union_rank, my_iosys->union_comm)); + PLOG((3, "intracomm created for union cmp = %d union_rank = %d union_comm = %d", + cmp, my_iosys->union_rank, my_iosys->union_comm)); if (in_io) { - LOG((3, "my_iosys->io_comm = %d", my_iosys->io_comm)); + PLOG((3, "my_iosys->io_comm = %d", my_iosys->io_comm)); /* Create the intercomm from IO to computation component. */ - LOG((3, "about to create intercomm for IO component to cmp = %d " - "my_iosys->io_comm = %d", cmp, my_iosys->io_comm)); + PLOG((3, "about to create intercomm for IO component to cmp = %d " + "my_iosys->io_comm = %d", cmp, my_iosys->io_comm)); if ((ret = MPI_Intercomm_create(my_iosys->io_comm, 0, my_iosys->union_comm, my_iosys->num_iotasks, cmp, &my_iosys->intercomm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); @@ -1709,18 +1709,18 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, else { /* Create the intercomm from computation component to IO component. */ - LOG((3, "about to create intercomm for cmp = %d my_iosys->comp_comm = %d", cmp, - my_iosys->comp_comm)); + PLOG((3, "about to create intercomm for cmp = %d my_iosys->comp_comm = %d", cmp, + my_iosys->comp_comm)); if ((ret = MPI_Intercomm_create(my_iosys->comp_comm, 0, my_iosys->union_comm, 0, cmp, &my_iosys->intercomm))) return check_mpi(NULL, NULL, ret, __FILE__, __LINE__); } - LOG((3, "intercomm created for cmp = %d", cmp)); + PLOG((3, "intercomm created for cmp = %d", cmp)); } /* Add this id to the list of PIO iosystem ids. */ iosysidp[cmp] = pio_add_to_iosystem_list(my_iosys); - LOG((2, "new iosys ID added to iosystem_list iosysidp[%d] = %d", cmp, iosysidp[cmp])); + PLOG((2, "new iosys ID added to iosystem_list iosysidp[%d] = %d", cmp, iosysidp[cmp])); } /* next computational component */ /* Now call the function from which the IO tasks will not return @@ -1728,17 +1728,17 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, * messages from all computation components. */ if (in_io) { - LOG((2, "Starting message handler io_rank = %d component_count = %d", - io_rank, component_count)); + PLOG((2, "Starting message handler io_rank = %d component_count = %d", + io_rank, component_count)); #ifdef USE_MPE - pio_stop_mpe_log(INIT, __func__); + pio_stop_mpe_log(INIT, __func__); #endif /* USE_MPE */ /* Start the message handler loop. This will not return until * an exit message is sent, or an error occurs. */ if ((ret = pio_msg_handler2(io_rank, component_count, iosys, io_comm))) return pio_err(NULL, NULL, ret, __FILE__, __LINE__); - LOG((2, "Returned from pio_msg_handler2() ret = %d", ret)); + PLOG((2, "Returned from pio_msg_handler2() ret = %d", ret)); } /* Free resources if needed. */ @@ -1772,7 +1772,7 @@ PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, pio_stop_mpe_log(INIT, __func__); #endif /* USE_MPE */ - LOG((2, "successfully done with PIOc_init_async")); + PLOG((2, "successfully done with PIOc_init_async")); return PIO_NOERR; } diff --git a/src/clib/pioc_sc.c b/src/clib/pioc_sc.c index e5c5db4840f..dbe2db59278 100644 --- a/src/clib/pioc_sc.c +++ b/src/clib/pioc_sc.c @@ -165,7 +165,7 @@ PIO_Offset GCDblocksize(int arrlen, const PIO_Offset *arr_in) bsize = lgcd(bsize, blk_len); if (bsize == 1) - return 1; + return 1; /* Continue to find next block. */ blk_len = 1; @@ -216,8 +216,8 @@ int CalcStartandCount(int pio_type, int ndims, const int *gdims, int num_io_proc /* Check inputs. */ pioassert(pio_type > 0 && ndims > 0 && gdims && num_io_procs > 0 && start && count, "invalid input", __FILE__, __LINE__); - LOG((1, "CalcStartandCount pio_type = %d ndims = %d num_io_procs = %d myiorank = %d", - pio_type, ndims, num_io_procs, myiorank)); + PLOG((1, "CalcStartandCount pio_type = %d ndims = %d num_io_procs = %d myiorank = %d", + pio_type, ndims, num_io_procs, myiorank)); /* We are trying to find start and count indices for each iotask * such that each task has approximately blocksize data to write diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index cd435f6c429..fe45275c9ae 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -84,7 +84,7 @@ pio_stop_timer(const char *name) int PIOc_strerror(int pioerr, char *errmsg) { - LOG((1, "PIOc_strerror pioerr = %d", pioerr)); + PLOG((1, "PIOc_strerror pioerr = %d", pioerr)); /* Caller must provide this. */ pioassert(errmsg, "pointer to errmsg string must be provided", __FILE__, __LINE__); @@ -179,7 +179,7 @@ int mpe_logging_initialized = 0; * * @param my_rank rank of processor in MPI_COMM_WORLD. * @author Ed Hartnett -*/ + */ int init_mpe(int my_rank) { @@ -337,8 +337,8 @@ pio_finalize_logging(void) LOG_FILE = NULL; } else - LOG((2, "pio_finalize_logging, postpone close, ref_cnt = %d", - pio_log_ref_cnt)); + PLOG((2, "pio_finalize_logging, postpone close, ref_cnt = %d", + pio_log_ref_cnt)); } #endif /* PIO_ENABLE_LOGGING */ } @@ -356,7 +356,7 @@ pio_finalize_logging(void) * This function is heavily based on the function in section 15.5 of * the C FAQ. * - * In code this functions should be wrapped in the LOG(()) macro. + * In code this functions should be wrapped in the PLOG(()) macro. * * @param severity the severity of the message, 0 for error messages, * then increasing levels of verbosity. @@ -598,7 +598,7 @@ check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, MPI_Reduce(&status, &rbuf, 1, MPI_INT, MPI_MIN, 0, file->iosystem->io_comm); } - LOG((1, "check_netcdf2 status = %d fname = %s line = %d", status, fname, line)); + PLOG((1, "check_netcdf2 status = %d fname = %s line = %d", status, fname, line)); /* Pick an error handler. */ if (ios) @@ -607,7 +607,7 @@ check_netcdf2(iosystem_desc_t *ios, file_desc_t *file, int status, eh = file->iosystem->error_handler; pioassert(eh == PIO_INTERNAL_ERROR || eh == PIO_BCAST_ERROR || eh == PIO_RETURN_ERROR, "invalid error handler", __FILE__, __LINE__); - LOG((2, "check_netcdf2 chose error handler = %d", eh)); + PLOG((2, "check_netcdf2 chose error handler = %d", eh)); /* Decide what to do based on the error handler. */ if (eh == PIO_INTERNAL_ERROR && status != PIO_NOERR) @@ -670,7 +670,7 @@ pio_err(iosystem_desc_t *ios, file_desc_t *file, int err_num, const char *fname, return ret; /* If logging is in use, log an error message. */ - LOG((0, "%s err_num = %d fname = %s line = %d", err_msg, err_num, fname ? fname : '\0', line)); + PLOG((0, "%s err_num = %d fname = %s line = %d", err_msg, err_num, fname ? fname : '\0', line)); /* What error handler should we use? */ if (file) @@ -678,7 +678,7 @@ pio_err(iosystem_desc_t *ios, file_desc_t *file, int err_num, const char *fname, else if (ios) err_handler = ios->error_handler; - LOG((2, "pio_err chose error handler = %d", err_handler)); + PLOG((2, "pio_err chose error handler = %d", err_handler)); /* Should we abort? */ if (err_handler == PIO_INTERNAL_ERROR) @@ -716,8 +716,8 @@ alloc_region2(iosystem_desc_t *ios, int ndims, io_region **regionp) /* Check inputs. */ pioassert(ndims >= 0 && regionp, "invalid input", __FILE__, __LINE__); - LOG((1, "alloc_region2 ndims = %d sizeof(io_region) = %d", ndims, - sizeof(io_region))); + PLOG((1, "alloc_region2 ndims = %d sizeof(io_region) = %d", ndims, + sizeof(io_region))); /* Allocate memory for the io_region struct. */ if (!(region = calloc(1, sizeof(io_region)))) @@ -846,7 +846,7 @@ malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims, pioassert(ios && piotype > 0 && ndims >= 0 && iodesc, "invalid input", __FILE__, __LINE__); - LOG((1, "malloc_iodesc piotype = %d ndims = %d", piotype, ndims)); + PLOG((1, "malloc_iodesc piotype = %d ndims = %d", piotype, ndims)); /* Get the MPI type corresponding with the PIO type. */ if ((ret = find_mpi_type(piotype, &mpi_type, NULL))) @@ -929,7 +929,7 @@ PIOc_freedecomp(int iosysid, int ioid) io_desc_t *iodesc; int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI function calls. */ - LOG((1, "PIOc_freedecomp iosysid = %d ioid = %d", iosysid, ioid)); + PLOG((1, "PIOc_freedecomp iosysid = %d ioid = %d", iosysid, ioid)); if (!(ios = pio_get_iosystem_from_id(iosysid))) return pio_err(NULL, NULL, PIO_EBADID, __FILE__, __LINE__); @@ -951,19 +951,19 @@ PIOc_freedecomp(int iosysid, int ioid) mpierr = MPI_Bcast(&iosysid, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&ioid, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((2, "PIOc_freedecomp iosysid = %d ioid = %d", iosysid, ioid)); + PLOG((2, "PIOc_freedecomp iosysid = %d ioid = %d", iosysid, ioid)); } /* Handle MPI errors. */ - LOG((3, "handline error mpierr %d ios->comproot %d", mpierr, ios->comproot)); + PLOG((3, "handline error mpierr %d ios->comproot %d", mpierr, ios->comproot)); if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm))) return check_mpi(NULL, NULL, mpierr2, __FILE__, __LINE__); - LOG((3, "handline error mpierr2 %d", mpierr2)); + PLOG((3, "handline error mpierr2 %d", mpierr2)); if (mpierr) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); } - LOG((3, "freeing map, dimlen")); + PLOG((3, "freeing map, dimlen")); /* Free the map. */ free(iodesc->map); @@ -973,7 +973,7 @@ PIOc_freedecomp(int iosysid, int ioid) if (iodesc->remap) free(iodesc->remap); - LOG((3, "freeing rfrom, rtype")); + PLOG((3, "freeing rfrom, rtype")); if (iodesc->rfrom) free(iodesc->rfrom); @@ -987,7 +987,7 @@ PIOc_freedecomp(int iosysid, int ioid) free(iodesc->rtype); } - LOG((3, "freeing stype, scount")); + PLOG((3, "freeing stype, scount")); if (iodesc->stype) { for (int i = 0; i < iodesc->num_stypes; i++) @@ -1011,7 +1011,7 @@ PIOc_freedecomp(int iosysid, int ioid) if (iodesc->rindex) free(iodesc->rindex); - LOG((3, "freeing regions")); + PLOG((3, "freeing regions")); if (iodesc->firstregion) free_region_list(iodesc->firstregion); @@ -1209,8 +1209,8 @@ PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, if (strlen(history) > PIO_MAX_NAME) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_write_nc_decomp filename = %s iosysid = %d ioid = %d " - "ios->num_comptasks = %d", filename, iosysid, ioid, ios->num_comptasks)); + PLOG((1, "PIOc_write_nc_decomp filename = %s iosysid = %d ioid = %d " + "ios->num_comptasks = %d", filename, iosysid, ioid, ios->num_comptasks)); /* Get the IO desc, which describes the decomposition. */ if (!(iodesc = pio_get_iodesc_from_id(ioid))) @@ -1219,7 +1219,7 @@ PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, /* Allocate memory for array which will contain the length of the * map on each task, for all computation tasks. */ int task_maplen[ios->num_comptasks]; - LOG((3, "ios->num_comptasks = %d", ios->num_comptasks)); + PLOG((3, "ios->num_comptasks = %d", ios->num_comptasks)); /* Gather maplens from all computation tasks and fill the * task_maplen array on all tasks. */ @@ -1231,7 +1231,7 @@ PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, if ((mpierr = MPI_Allreduce(&iodesc->maplen, &max_maplen, 1, MPI_INT, MPI_MAX, ios->comp_comm))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((3, "max_maplen = %d", max_maplen)); + PLOG((3, "max_maplen = %d", max_maplen)); if (!(full_map = malloc(sizeof(int) * ios->num_comptasks * max_maplen))) return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); @@ -1245,7 +1245,7 @@ PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, for (int e = 0; e < max_maplen; e++) { my_map[e] = e < iodesc->maplen ? iodesc->map[e] - 1 : NC_FILL_INT; - LOG((3, "my_map[%d] = %d", e, my_map[e])); + PLOG((3, "my_map[%d] = %d", e, my_map[e])); } /* Gather my_map from all computation tasks and fill the full_map array. */ @@ -1257,7 +1257,7 @@ PIOc_write_nc_decomp(int iosysid, const char *filename, int cmode, int ioid, for (int p = 0; p < ios->num_comptasks; p++) for (int e = 0; e < max_maplen; e++) - LOG((3, "full_map[%d][%d] = %d", p, e, full_map[p * max_maplen + e])); + PLOG((3, "full_map[%d][%d] = %d", p, e, full_map[p * max_maplen + e])); /* Write the netCDF decomp file. */ if ((ret = pioc_write_nc_decomp_int(ios, filename, cmode, iodesc->ndims, iodesc->dimlen, @@ -1316,15 +1316,15 @@ PIOc_read_nc_decomp(int iosysid, const char *filename, int *ioidp, MPI_Comm comm if (!filename || !ioidp) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_read_nc_decomp filename = %s iosysid = %d pio_type = %d", - filename, iosysid, pio_type)); + PLOG((1, "PIOc_read_nc_decomp filename = %s iosysid = %d pio_type = %d", + filename, iosysid, pio_type)); /* Get the communicator size and task rank. */ if ((mpierr = MPI_Comm_size(comm, &size))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Comm_rank(comm, &my_rank))) return check_mpi(ios, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "size = %d my_rank = %d", size, my_rank)); + PLOG((2, "size = %d my_rank = %d", size, my_rank)); /* Read the file. This allocates three arrays that we have to * free. */ @@ -1332,8 +1332,8 @@ PIOc_read_nc_decomp(int iosysid, const char *filename, int *ioidp, MPI_Comm comm &task_maplen, &max_maplen, &full_map, title, history, source_in, version_in, fortran_order))) return ret; - LOG((2, "ndims = %d num_tasks_decomp = %d max_maplen = %d", ndims, num_tasks_decomp, - max_maplen)); + PLOG((2, "ndims = %d num_tasks_decomp = %d max_maplen = %d", ndims, num_tasks_decomp, + max_maplen)); /* If the size does not match the number of tasks in the decomp, * that's an error. */ @@ -1408,14 +1408,14 @@ pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode, (!history || strlen(history) <= PIO_MAX_NAME), "invalid input", __FILE__, __LINE__); - LOG((2, "pioc_write_nc_decomp_int filename = %s ndims = %d num_tasks = %d", filename, - ndims, num_tasks)); + PLOG((2, "pioc_write_nc_decomp_int filename = %s ndims = %d num_tasks = %d", filename, + ndims, num_tasks)); /* Find the maximum maplen. */ for (int t = 0; t < num_tasks; t++) if (task_maplen[t] > max_maplen) max_maplen = task_maplen[t]; - LOG((3, "max_maplen = %d", max_maplen)); + PLOG((3, "max_maplen = %d", max_maplen)); /* Create the netCDF decomp file. */ if ((ret = PIOc_create(ios->iosysid, filename, cmode | NC_WRITE, &ncid))) @@ -1609,7 +1609,7 @@ pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **glo if (!filename) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "pioc_read_nc_decomp_int iosysid = %d filename = %s", iosysid, filename)); + PLOG((1, "pioc_read_nc_decomp_int iosysid = %d filename = %s", iosysid, filename)); /* Open the netCDF decomp file. */ if ((ret = PIOc_open(iosysid, filename, NC_WRITE, &ncid))) @@ -1619,7 +1619,7 @@ pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **glo char version_in[PIO_MAX_NAME + 1]; if ((ret = PIOc_get_att_text(ncid, NC_GLOBAL, DECOMP_VERSION_ATT_NAME, version_in))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "version_in = %s", version_in)); + PLOG((3, "version_in = %s", version_in)); if (version) strncpy(version, version_in, PIO_MAX_NAME + 1); @@ -1627,7 +1627,7 @@ pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **glo char order_in[PIO_MAX_NAME + 1]; if ((ret = PIOc_get_att_text(ncid, NC_GLOBAL, DECOMP_ORDER_ATT_NAME, order_in))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "order_in = %s", order_in)); + PLOG((3, "order_in = %s", order_in)); if (fortran_order) { if (!strncmp(order_in, DECOMP_C_ORDER_STR, PIO_MAX_NAME + 1)) @@ -1642,7 +1642,7 @@ pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **glo int max_maplen_in; if ((ret = PIOc_get_att_int(ncid, NC_GLOBAL, DECOMP_MAX_MAPLEN_ATT_NAME, &max_maplen_in))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((3, "max_maplen_in = %d", max_maplen_in)); + PLOG((3, "max_maplen_in = %d", max_maplen_in)); if (max_maplen) *max_maplen = max_maplen_in; @@ -1764,10 +1764,10 @@ pioc_read_nc_decomp_int(int iosysid, const char *filename, int *ndims, int **glo free(map_in); /* Close the netCDF decomp file. */ - LOG((2, "pioc_read_nc_decomp_int about to close file ncid = %d", ncid)); + PLOG((2, "pioc_read_nc_decomp_int about to close file ncid = %d", ncid)); if ((ret = PIOc_closefile(ncid))) return pio_err(ios, NULL, ret, __FILE__, __LINE__); - LOG((2, "pioc_read_nc_decomp_int closed file")); + PLOG((2, "pioc_read_nc_decomp_int closed file")); return PIO_NOERR; } @@ -1788,7 +1788,7 @@ PIOc_write_decomp(const char *file, int iosysid, int ioid, MPI_Comm comm) iosystem_desc_t *ios; io_desc_t *iodesc; - LOG((1, "PIOc_write_decomp file = %s iosysid = %d ioid = %d", file, iosysid, ioid)); + PLOG((1, "PIOc_write_decomp file = %s iosysid = %d ioid = %d", file, iosysid, ioid)); if (!(ios = pio_get_iosystem_from_id(iosysid))) return pio_err(NULL, NULL, PIO_EBADID, __FILE__, __LINE__); @@ -1823,13 +1823,13 @@ PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, PIO_Offset *nmap; int mpierr; /* Return code for MPI calls. */ - LOG((1, "PIOc_writemap file = %s ndims = %d maplen = %d", file, ndims, maplen)); + PLOG((1, "PIOc_writemap file = %s ndims = %d maplen = %d", file, ndims, maplen)); if ((mpierr = MPI_Comm_size(comm, &npes))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Comm_rank(comm, &myrank))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2, "npes = %d myrank = %d", npes, myrank)); + PLOG((2, "npes = %d myrank = %d", npes, myrank)); /* Allocate memory for the nmaplen. */ if (myrank == 0) @@ -1862,14 +1862,14 @@ PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, for (i = 1; i < npes; i++) { - LOG((2, "creating nmap for i = %d", i)); + PLOG((2, "creating nmap for i = %d", i)); nmap = (PIO_Offset *)malloc(nmaplen[i] * sizeof(PIO_Offset)); if ((mpierr = MPI_Send(&i, 1, MPI_INT, i, npes + i, comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); if ((mpierr = MPI_Recv(nmap, nmaplen[i], PIO_OFFSET, i, i, comm, &status))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"MPI_Recv map complete")); + PLOG((2,"MPI_Recv map complete")); fprintf(fp, "%d %lld\n", i, nmaplen[i]); for (int j = 0; j < nmaplen[i]; j++) @@ -1885,17 +1885,17 @@ PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, /* Close the file. */ fclose(fp); - LOG((2,"decomp file closed.")); + PLOG((2,"decomp file closed.")); } else { - LOG((2,"ready to MPI_Recv...")); + PLOG((2,"ready to MPI_Recv...")); if ((mpierr = MPI_Recv(&i, 1, MPI_INT, 0, npes+myrank, comm, &status))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"MPI_Recv got %d", i)); + PLOG((2,"MPI_Recv got %d", i)); if ((mpierr = MPI_Send(map, maplen, PIO_OFFSET, 0, myrank, comm))) return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); - LOG((2,"MPI_Send map complete")); + PLOG((2,"MPI_Send map complete")); } return PIO_NOERR; @@ -1964,8 +1964,8 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, if (!iotype_is_valid(*iotype)) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((1, "PIOc_createfile_int iosysid = %d iotype = %d filename = %s mode = %d", - iosysid, *iotype, filename, mode)); + PLOG((1, "PIOc_createfile_int iosysid = %d iotype = %d filename = %s mode = %d", + iosysid, *iotype, filename, mode)); /* Allocate space for the file info. */ if (!(file = calloc(sizeof(file_desc_t), 1))) @@ -1984,7 +1984,7 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, ios->io_rank == 0) file->do_io = 1; - LOG((2, "file->do_io = %d ios->async = %d", file->do_io, ios->async)); + PLOG((2, "file->do_io = %d ios->async = %d", file->do_io, ios->async)); /* If async is in use, and this is not an IO task, bcast the * parameters. */ @@ -1996,7 +1996,7 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, size_t len = strlen(filename); /* Send the message to the message handler. */ - LOG((3, "msg %d ios->union_comm %d MPI_COMM_NULL %d", msg, ios->union_comm, MPI_COMM_NULL)); + PLOG((3, "msg %d ios->union_comm %d MPI_COMM_NULL %d", msg, ios->union_comm, MPI_COMM_NULL)); if (ios->compmaster == MPI_ROOT) mpierr = MPI_Send(&msg, 1, MPI_INT, ios->ioroot, 1, ios->union_comm); @@ -2009,12 +2009,12 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, mpierr = MPI_Bcast(&file->iotype, 1, MPI_INT, ios->compmaster, ios->intercomm); if (!mpierr) mpierr = MPI_Bcast(&mode, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((2, "len = %d filename = %s iotype = %d mode = %d", len, filename, - file->iotype, mode)); + PLOG((2, "len = %d filename = %s iotype = %d mode = %d", len, filename, + file->iotype, mode)); } /* Handle MPI errors. */ - LOG((2, "handling mpi errors mpierr = %d", mpierr)); + PLOG((2, "handling mpi errors mpierr = %d", mpierr)); if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm))) return check_mpi(NULL, file, mpierr2, __FILE__, __LINE__); if (mpierr) @@ -2029,10 +2029,10 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, #ifdef _NETCDF4 case PIO_IOTYPE_NETCDF4P: mode = mode | NC_MPIIO | NC_NETCDF4; - LOG((2, "Calling nc_create_par io_comm = %d mode = %d fh = %d", - ios->io_comm, mode, file->fh)); + PLOG((2, "Calling nc_create_par io_comm = %d mode = %d fh = %d", + ios->io_comm, mode, file->fh)); ierr = nc_create_par(filename, mode, ios->io_comm, ios->info, &file->fh); - LOG((2, "nc_create_par returned %d file->fh = %d", ierr, file->fh)); + PLOG((2, "nc_create_par returned %d file->fh = %d", ierr, file->fh)); break; case PIO_IOTYPE_NETCDF4C: mode = mode | NC_NETCDF4; @@ -2040,13 +2040,13 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, case PIO_IOTYPE_NETCDF: if (!ios->io_rank) { - LOG((2, "Calling nc_create mode = %d", mode)); + PLOG((2, "Calling nc_create mode = %d", mode)); ierr = nc_create(filename, mode, &file->fh); } break; #ifdef _PNETCDF case PIO_IOTYPE_PNETCDF: - LOG((2, "Calling ncmpi_create mode = %d", mode)); + PLOG((2, "Calling ncmpi_create mode = %d", mode)); ierr = ncmpi_create(ios->io_comm, filename, mode, ios->info, &file->fh); if (!ierr) ierr = ncmpi_buffer_attach(file->fh, pio_buffer_size_limit); @@ -2076,15 +2076,15 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, * ensues. */ if (ios->async) { - LOG((3, "createfile bcasting pio_next_ncid %d", pio_next_ncid)); + PLOG((3, "createfile bcasting pio_next_ncid %d", pio_next_ncid)); if ((mpierr = MPI_Bcast(&pio_next_ncid, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((3, "createfile bcast pio_next_ncid %d", pio_next_ncid)); + PLOG((3, "createfile bcast pio_next_ncid %d", pio_next_ncid)); } /* Assign the PIO ncid. */ file->pio_ncid = pio_next_ncid++; - LOG((2, "file->fh = %d file->pio_ncid = %d", file->fh, file->pio_ncid)); + PLOG((2, "file->fh = %d file->pio_ncid = %d", file->fh, file->pio_ncid)); /* Return the ncid to the caller. */ *ncidp = file->pio_ncid; @@ -2096,8 +2096,8 @@ PIOc_createfile_int(int iosysid, int *ncidp, int *iotype, const char *filename, #ifdef USE_MPE pio_stop_mpe_log(CREATE, __func__); #endif /* USE_MPE */ - LOG((2, "Created file %s file->fh = %d file->pio_ncid = %d", filename, - file->fh, file->pio_ncid)); + PLOG((2, "Created file %s file->fh = %d file->pio_ncid = %d", filename, + file->fh, file->pio_ncid)); return ierr; } @@ -2419,8 +2419,8 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, if (*iotype < PIO_IOTYPE_PNETCDF || *iotype > PIO_IOTYPE_NETCDF4P) return pio_err(ios, NULL, PIO_EINVAL, __FILE__, __LINE__); - LOG((2, "PIOc_openfile_retry iosysid = %d iotype = %d filename = %s mode = %d retry = %d", - iosysid, *iotype, filename, mode, retry)); + PLOG((2, "PIOc_openfile_retry iosysid = %d iotype = %d filename = %s mode = %d retry = %d", + iosysid, *iotype, filename, mode, retry)); /* Allocate space for the file info. */ if (!(file = calloc(sizeof(*file), 1))) @@ -2490,8 +2490,8 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, if ((ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF4P, &nvars, &rec_var, &pio_type, &pio_type_size, &mpi_type, &mpi_type_size))) break; - LOG((2, "PIOc_openfile_retry:nc_open_par filename = %s mode = %d imode = %d ierr = %d", - filename, mode, imode, ierr)); + PLOG((2, "PIOc_openfile_retry:nc_open_par filename = %s mode = %d imode = %d ierr = %d", + filename, mode, imode, ierr)); #endif break; @@ -2527,10 +2527,10 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, if (ierr == PIO_NOERR && (mode & PIO_WRITE)) { if (ios->iomaster == MPI_ROOT) - LOG((2, "%d Setting IO buffer %ld", __LINE__, pio_buffer_size_limit)); + PLOG((2, "%d Setting IO buffer %ld", __LINE__, pio_buffer_size_limit)); ierr = ncmpi_buffer_attach(file->fh, pio_buffer_size_limit); } - LOG((2, "ncmpi_open(%s) : fd = %d", filename, file->fh)); + PLOG((2, "ncmpi_open(%s) : fd = %d", filename, file->fh)); if (!ierr) ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_PNETCDF, &nvars, &rec_var, &pio_type, @@ -2547,7 +2547,7 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, with just plain old basic NetCDF. */ if (retry) { - LOG((2, "retry error code ierr = %d io_rank %d", ierr, ios->io_rank)); + PLOG((2, "retry error code ierr = %d io_rank %d", ierr, ios->io_rank)); if ((ierr == NC_ENOTNC || ierr == NC_EINVAL) && (file->iotype != PIO_IOTYPE_NETCDF)) { if (ios->iomaster == MPI_ROOT) @@ -2570,18 +2570,18 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, else file->do_io = 0; } - LOG((2, "retry nc_open(%s) : fd = %d, iotype = %d, do_io = %d, ierr = %d", - filename, file->fh, file->iotype, file->do_io, ierr)); + PLOG((2, "retry nc_open(%s) : fd = %d, iotype = %d, do_io = %d, ierr = %d", + filename, file->fh, file->iotype, file->do_io, ierr)); } } /* Broadcast and check the return code. */ if (ios->ioroot == ios->union_rank) - LOG((2, "Bcasting error code ierr %d ios->ioroot %d ios->my_comm %d", - ierr, ios->ioroot, ios->my_comm)); + PLOG((2, "Bcasting error code ierr %d ios->ioroot %d ios->my_comm %d", + ierr, ios->ioroot, ios->my_comm)); if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); - LOG((2, "Bcast openfile_retry error code ierr = %d", ierr)); + PLOG((2, "Bcast openfile_retry error code ierr = %d", ierr)); /* If there was an error, free allocated memory and deal with the error. */ if (ierr) @@ -2597,7 +2597,7 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, /* Broadcast some values to all tasks from io root. */ if (ios->async) { - LOG((3, "open bcasting pio_next_ncid %d ios->ioroot %d", pio_next_ncid, ios->ioroot)); + PLOG((3, "open bcasting pio_next_ncid %d ios->ioroot %d", pio_next_ncid, ios->ioroot)); if ((mpierr = MPI_Bcast(&pio_next_ncid, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); } @@ -2669,8 +2669,8 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename, #ifdef USE_MPE pio_stop_mpe_log(OPEN, __func__); #endif /* USE_MPE */ - LOG((2, "Opened file %s file->pio_ncid = %d file->fh = %d ierr = %d", - filename, file->pio_ncid, file->fh, ierr)); + PLOG((2, "Opened file %s file->pio_ncid = %d file->fh = %d ierr = %d", + filename, file->pio_ncid, file->fh, ierr)); return ierr; } @@ -2743,7 +2743,7 @@ pioc_change_def(int ncid, int is_enddef) int ierr = PIO_NOERR; /* Return code from function calls. */ int mpierr = MPI_SUCCESS, mpierr2; /* Return code from MPI functions. */ - LOG((2, "pioc_change_def ncid = %d is_enddef = %d", ncid, is_enddef)); + PLOG((2, "pioc_change_def ncid = %d is_enddef = %d", ncid, is_enddef)); /* Find the info about this file. When I check the return code * here, some tests fail. ???*/ @@ -2762,11 +2762,11 @@ pioc_change_def(int ncid, int is_enddef) if (!mpierr) mpierr = MPI_Bcast(&ncid, 1, MPI_INT, ios->compmaster, ios->intercomm); - LOG((3, "pioc_change_def ncid = %d mpierr = %d", ncid, mpierr)); + PLOG((3, "pioc_change_def ncid = %d mpierr = %d", ncid, mpierr)); } /* Handle MPI errors. */ - LOG((3, "pioc_change_def handling MPI errors")); + PLOG((3, "pioc_change_def handling MPI errors")); if ((mpierr2 = MPI_Bcast(&mpierr, 1, MPI_INT, ios->comproot, ios->my_comm))) check_mpi(NULL, file, mpierr2, __FILE__, __LINE__); if (mpierr) @@ -2774,11 +2774,11 @@ pioc_change_def(int ncid, int is_enddef) } /* If this is an IO task, then call the netCDF function. */ - LOG((3, "pioc_change_def ios->ioproc = %d", ios->ioproc)); + PLOG((3, "pioc_change_def ios->ioproc = %d", ios->ioproc)); if (ios->ioproc) { - LOG((3, "pioc_change_def calling netcdf function file->fh = %d file->do_io = %d iotype = %d", - file->fh, file->do_io, file->iotype)); + PLOG((3, "pioc_change_def calling netcdf function file->fh = %d file->do_io = %d iotype = %d", + file->fh, file->do_io, file->iotype)); #ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) { @@ -2792,7 +2792,7 @@ pioc_change_def(int ncid, int is_enddef) { if (is_enddef) { - LOG((3, "pioc_change_def calling nc_enddef file->fh = %d", file->fh)); + PLOG((3, "pioc_change_def calling nc_enddef file->fh = %d", file->fh)); ierr = nc_enddef(file->fh); } else @@ -2801,12 +2801,12 @@ pioc_change_def(int ncid, int is_enddef) } /* Broadcast and check the return code. */ - LOG((3, "pioc_change_def bcasting return code ierr = %d", ierr)); + PLOG((3, "pioc_change_def bcasting return code ierr = %d", ierr)); if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm))) return check_mpi(NULL, file, mpierr, __FILE__, __LINE__); if (ierr) return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3, "pioc_change_def succeeded")); + PLOG((3, "pioc_change_def succeeded")); return ierr; } @@ -2948,8 +2948,8 @@ determine_procs(int num_io_procs, int component_count, int *num_procs_per_comp, /* Fill the array of arrays. */ for (int cmp = 0; cmp < component_count; cmp++) { - LOG((3, "calculating processors for component %d num_procs_per_comp[cmp] = %d", - cmp, num_procs_per_comp[cmp])); + PLOG((3, "calculating processors for component %d num_procs_per_comp[cmp] = %d", + cmp, num_procs_per_comp[cmp])); /* Allocate space for each array. */ if (!(my_proc_list[cmp] = malloc(num_procs_per_comp[cmp] * sizeof(int)))) @@ -2959,7 +2959,7 @@ determine_procs(int num_io_procs, int component_count, int *num_procs_per_comp, for (proc = last_proc; proc < num_procs_per_comp[cmp] + last_proc; proc++) { my_proc_list[cmp][proc - last_proc] = proc; - LOG((3, "my_proc_list[%d][%d] = %d", cmp, proc - last_proc, proc)); + PLOG((3, "my_proc_list[%d][%d] = %d", cmp, proc - last_proc, proc)); } last_proc = proc; } diff --git a/tests/cunit/test_async_perf.c b/tests/cunit/test_async_perf.c index 63f6fda8070..313c5eb6045 100644 --- a/tests/cunit/test_async_perf.c +++ b/tests/cunit/test_async_perf.c @@ -155,7 +155,7 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask int d, t; if (!(my_data_int = malloc(elements_per_pe2 * sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (d = 0; d < elements_per_pe2; d++) my_data_int[d] = my_rank; @@ -170,7 +170,7 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask sprintf(data_filename, "data_%s.nc", TEST_NAME); if ((ret = PIOc_createfile(iosysid, &ncid, &flavor[fmt], data_filename, NC_CLOBBER))) - BAIL(ret); + PBAIL(ret); #ifdef USE_MPE { @@ -182,20 +182,20 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask /* Find the size of the type. */ if ((ret = PIOc_inq_type(ncid, piotype, NULL, &type_size))) - BAIL(ret); + PBAIL(ret); /* Define dimensions. */ for (int d = 0; d < NDIM4; d++) if ((ret = PIOc_def_dim(ncid, dim_name[d], dim_len[d], &dimid[d]))) - BAIL(ret); + PBAIL(ret); /* Define variables. */ if ((ret = PIOc_def_var(ncid, REC_VAR_NAME, piotype, NDIM4, dimid, &varid))) - BAIL(ret); + PBAIL(ret); /* End define mode. */ if ((ret = PIOc_enddef(ncid))) - BAIL(ret); + PBAIL(ret); for (t = 0; t < NUM_TIMESTEPS; t++) { @@ -205,12 +205,12 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask /* Set the record number for the record vars. */ if ((ret = PIOc_setframe(ncid, varid, t))) - BAIL(ret); + PBAIL(ret); /* Write some data to the record vars. */ if ((ret = PIOc_write_darray(ncid, varid, ioid3, elements_per_pe2, my_data_int, NULL))) - BAIL(ret); + PBAIL(ret); #ifdef USE_MPE { @@ -239,14 +239,14 @@ run_darray_async_test(int iosysid, int fmt, int my_rank, int ntasks, int niotask /* Close the file. */ if ((ret = PIOc_closefile(ncid))) - BAIL(ret); + PBAIL(ret); free(my_data_int); } /* Free the decomposition. */ if ((ret = PIOc_freedecomp(iosysid, ioid3))) - BAIL(ret); + PBAIL(ret); exit: return ret; } diff --git a/tests/cunit/test_darray_async.c b/tests/cunit/test_darray_async.c index d08da44442a..6181b21c1ab 100644 --- a/tests/cunit/test_darray_async.c +++ b/tests/cunit/test_darray_async.c @@ -68,17 +68,17 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, /* Reopen the file. */ if ((ret = PIOc_openfile(iosysid, &ncid, &iotype, data_filename, NC_NOWRITE))) - BAIL(ret); + PBAIL(ret); /* Get the size of the type. */ if ((ret = PIOc_inq_type(ncid, piotype, NULL, &type_size))) - BAIL(ret); + PBAIL(ret); /* Allocate memory to read data. */ if (!(data_in = malloc(LAT_LEN * LON_LEN * type_size * NREC))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(data_in_norec = malloc(LAT_LEN * LON_LEN * type_size))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* We have two sets of variables, those with unlimted, and those * without unlimited dimension. */ @@ -90,12 +90,12 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, /* Read the record data. The values we expect are: 10, 11, 20, 21, 30, * 31, in each of three records. */ if ((ret = PIOc_get_var(ncid, rec_varid, data_in))) - BAIL(ret); + PBAIL(ret); /* Read the non-record data. The values we expect are: 10, 11, 20, 21, 30, * 31. */ if ((ret = PIOc_get_var(ncid, norec_varid, data_in_norec))) - BAIL(ret); + PBAIL(ret); /* Check the results. */ for (int r = 0; r < LAT_LEN * LON_LEN * NREC; r++) @@ -105,52 +105,52 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, { case PIO_BYTE: if (((signed char *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_CHAR: if (((char *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_SHORT: if (((short *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_INT: if (((int *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_FLOAT: if (((float *)data_in)[r] != (tmp_r/2 + 1) * 10.0 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_DOUBLE: if (((double *)data_in)[r] != (tmp_r/2 + 1) * 10.0 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; #ifdef _NETCDF4 case PIO_UBYTE: if (((unsigned char *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_USHORT: if (((unsigned short *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_UINT: if (((unsigned int *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_INT64: if (((long long *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; case PIO_UINT64: if (((unsigned long long *)data_in)[r] != (tmp_r/2 + 1) * 10 + tmp_r % 2) - BAIL(ret); + PBAIL(ret); break; #endif /* _NETCDF4 */ default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } } @@ -161,59 +161,59 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, { case PIO_BYTE: if (((signed char *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_CHAR: if (((char *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_SHORT: if (((short *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_INT: if (((int *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_FLOAT: if (((float *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_DOUBLE: if (((double *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; #ifdef _NETCDF4 case PIO_UBYTE: if (((unsigned char *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_USHORT: if (((unsigned short *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_UINT: if (((unsigned int *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_INT64: if (((long long *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; case PIO_UINT64: if (((unsigned long long *)data_in_norec)[r] != (r/2 + 1) * 20.0 + r%2) - BAIL(ret); + PBAIL(ret); break; #endif /* _NETCDF4 */ default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } } } /* next var set */ /* Close the file. */ if ((ret = PIOc_closefile(ncid))) - BAIL(ret); + PBAIL(ret); exit: /* Free resources. */ @@ -242,7 +242,7 @@ int run_darray_async_test(int iosysid, int my_rank, MPI_Comm test_comm, MPI_Comm /* Create the PIO decomposition for this test. */ if ((ret = PIOc_init_decomp(iosysid, piotype, NDIM2, &dim_len[1], elements_per_pe, compdof, &ioid, PIO_REARR_BOX, NULL, NULL))) - BAIL(ret); + PBAIL(ret); /* Write the decomp file (on appropriate tasks). */ if ((ret = PIOc_write_nc_decomp(iosysid, decomp_filename, 0, ioid, NULL, NULL, 0))) @@ -256,7 +256,7 @@ int run_darray_async_test(int iosysid, int my_rank, MPI_Comm test_comm, MPI_Comm /* Free the decomposition. */ if ((ret = PIOc_freedecomp(iosysid, ioid2))) - BAIL(ret); + PBAIL(ret); /* Test each available iotype. */ for (int fmt = 0; fmt < num_flavors; fmt++) @@ -353,7 +353,7 @@ int run_darray_async_test(int iosysid, int my_rank, MPI_Comm test_comm, MPI_Comm break; #endif /* _NETCDF4 */ default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } /* Create sample output file. */ @@ -361,104 +361,104 @@ int run_darray_async_test(int iosysid, int my_rank, MPI_Comm test_comm, MPI_Comm piotype); if ((ret = PIOc_createfile(iosysid, &ncid, &flavor[fmt], data_filename, NC_CLOBBER))) - BAIL(ret); + PBAIL(ret); /* Find the size of the type. */ if ((ret = PIOc_inq_type(ncid, piotype, NULL, &type_size))) - BAIL(ret); + PBAIL(ret); /* Create the data for the darray_multi call by making two * copies of the data. */ if (!(my_data_multi = malloc(2 * type_size * elements_per_pe))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); memcpy(my_data_multi, my_data, type_size * elements_per_pe); memcpy((char *)my_data_multi + type_size * elements_per_pe, my_data, type_size * elements_per_pe); /* Define dimensions. */ for (int d = 0; d < NDIM3; d++) if ((ret = PIOc_def_dim(ncid, dim_name[d], dim_len[d], &dimid[d]))) - BAIL(ret); + PBAIL(ret); /* Define variables. */ if ((ret = PIOc_def_var(ncid, REC_VAR_NAME, piotype, NDIM3, dimid, &varid[0]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_def_var(ncid, REC_VAR_NAME2, piotype, NDIM3, dimid, &varid[1]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_def_var(ncid, NOREC_VAR_NAME, piotype, NDIM2, &dimid[1], &varid[2]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_def_var(ncid, NOREC_VAR_NAME2, piotype, NDIM2, &dimid[1], &varid[3]))) - BAIL(ret); + PBAIL(ret); /* End define mode. */ if ((ret = PIOc_enddef(ncid))) - BAIL(ret); + PBAIL(ret); /* Set the record number for the record vars. */ if ((ret = PIOc_setframe(ncid, varid[0], 0))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_setframe(ncid, varid[1], 0))) - BAIL(ret); + PBAIL(ret); /* Write some data to the record vars. */ if ((ret = PIOc_write_darray(ncid, varid[0], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_write_darray(ncid, varid[1], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); /* Write some data to the non-record vars. */ if ((ret = PIOc_write_darray(ncid, varid[2], ioid, elements_per_pe, my_data_norec, NULL))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_write_darray(ncid, varid[3], ioid, elements_per_pe, my_data_norec, NULL))) - BAIL(ret); + PBAIL(ret); /* Sync the file. */ if ((ret = PIOc_sync(ncid))) - BAIL(ret); + PBAIL(ret); /* Increment the record number for the record vars. */ if ((ret = PIOc_advanceframe(ncid, varid[0]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_advanceframe(ncid, varid[1]))) - BAIL(ret); + PBAIL(ret); /* Write another record. */ if ((ret = PIOc_write_darray(ncid, varid[0], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_write_darray(ncid, varid[1], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); /* Sync the file. */ if ((ret = PIOc_sync(ncid))) - BAIL(ret); + PBAIL(ret); /* Increment the record number for the record var. */ if ((ret = PIOc_advanceframe(ncid, varid[0]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_advanceframe(ncid, varid[1]))) - BAIL(ret); + PBAIL(ret); /* Write a third record. */ if ((ret = PIOc_write_darray(ncid, varid[0], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_write_darray(ncid, varid[1], ioid, elements_per_pe, my_data, NULL))) - BAIL(ret); + PBAIL(ret); /* Increment the record number for the record var. */ if ((ret = PIOc_advanceframe(ncid, varid[0]))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_advanceframe(ncid, varid[1]))) - BAIL(ret); + PBAIL(ret); /* Write a forth record, using darray_multi(). */ int frame[2] = {3, 3}; if ((ret = PIOc_write_darray_multi(ncid, varid, ioid, 2, elements_per_pe, my_data_multi, frame, NULL, 0))) - BAIL(ret); + PBAIL(ret); /* Close the file. */ if ((ret = PIOc_closefile(ncid))) - BAIL(ret); + PBAIL(ret); /* Free resources. */ free(my_data_multi); @@ -466,13 +466,13 @@ int run_darray_async_test(int iosysid, int my_rank, MPI_Comm test_comm, MPI_Comm /* Check the file for correctness. */ if ((ret = check_darray_file(iosysid, data_filename, PIO_IOTYPE_NETCDF, my_rank, piotype))) - BAIL(ret); + PBAIL(ret); } /* next iotype */ /* Free the decomposition. */ if ((ret = PIOc_freedecomp(iosysid, ioid))) - BAIL(ret); + PBAIL(ret); exit: if (my_data_multi) diff --git a/tests/cunit/test_darray_async_many.c b/tests/cunit/test_darray_async_many.c index 9af212ce81d..8d2181dbfca 100644 --- a/tests/cunit/test_darray_async_many.c +++ b/tests/cunit/test_darray_async_many.c @@ -77,19 +77,19 @@ check_4d_vars(int my_rank, int ncid, int *varid_4d) /* Get the type of the 4d var. */ if ((ret = PIOc_inq_vartype(ncid, varid_4d[v], &xtype))) - BAIL(ret); + PBAIL(ret); /* Get the size of this type. */ if ((ret = PIOc_inq_type(ncid, xtype, NULL, &size))) - BAIL(ret); + PBAIL(ret); /* Allocate memory for data. */ if (!(data_in2 = malloc(size * VERT_LEN * LAT_LEN * LON_LEN * NREC))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Read the data. */ if ((ret = PIOc_get_var(ncid, varid_4d[v], data_in2))) - BAIL(ret); + PBAIL(ret); /* Check each element of data. */ for (int r = 0; r < LAT_LEN * LON_LEN * NREC; r++) @@ -98,14 +98,14 @@ check_4d_vars(int my_rank, int ncid, int *varid_4d) { case PIO_INT: if (((int *)data_in2)[r] != expected_int_4d[r % (VERT_LEN * LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_FLOAT: if (((float *)data_in2)[r] != expected_float_4d[r % (VERT_LEN * LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } } free(data_in2); @@ -150,14 +150,14 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, /* Reopen the file. */ if ((ret = PIOc_openfile(iosysid, &ncid, &iotype, data_filename, NC_NOWRITE))) - BAIL(ret); + PBAIL(ret); /* Check metadata. */ int ndims_in, nvars_in, ngatts_in, unlimdimid_in; if ((ret = PIOc_inq(ncid, &ndims_in, &nvars_in, &ngatts_in, &unlimdimid_in))) - BAIL(ret); + PBAIL(ret); if (ndims_in != NDIM4 || nvars_in != num_types * 2 + NUM_4D_VARS || ngatts_in != 0 || unlimdimid_in != 0) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); /* Check the vars. */ for (int t = 0; t < num_types; t++) @@ -166,19 +166,19 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, /* Find size of type. */ if ((ret = PIOc_inq_type(ncid, my_type[t], NULL, &type_size))) - BAIL(ret); + PBAIL(ret); /* Allocate buffers to hold data. */ if (!(data_in = malloc(LAT_LEN * LON_LEN * NREC * type_size))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(norec_data_in = malloc(LAT_LEN * LON_LEN * type_size))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Read record and non-record vars for this type. */ if ((ret = PIOc_get_var(ncid, rec_varid[t], data_in))) - BAIL(ret); + PBAIL(ret); if ((ret = PIOc_get_var(ncid, norec_varid[t], norec_data_in))) - BAIL(ret); + PBAIL(ret); /* Check each value of non-record data. */ for (int r = 0; r < LAT_LEN * LON_LEN; r++) @@ -187,52 +187,52 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, { case PIO_BYTE: if (((signed char *)norec_data_in)[r] != expected_byte[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_CHAR: if (((char *)norec_data_in)[r] != expected_char[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_SHORT: if (((short *)norec_data_in)[r] != expected_short[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_INT: if (((int *)norec_data_in)[r] != expected_int[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_FLOAT: if (((float *)norec_data_in)[r] != expected_float[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_DOUBLE: if (((double *)norec_data_in)[r] != expected_double[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; #ifdef _NETCDF4 case PIO_UBYTE: if (((unsigned char *)norec_data_in)[r] != expected_ubyte[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_USHORT: if (((unsigned short *)norec_data_in)[r] != expected_ushort[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_UINT: if (((unsigned int *)norec_data_in)[r] != expected_uint[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_INT64: if (((long long *)norec_data_in)[r] != expected_int64[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_UINT64: if (((unsigned long long *)norec_data_in)[r] != expected_uint64[r]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; #endif /* _NETCDF4 */ default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } } @@ -243,52 +243,52 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, { case PIO_BYTE: if (((signed char *)data_in)[r] != expected_byte[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_CHAR: if (((char *)data_in)[r] != expected_char[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_SHORT: if (((short *)data_in)[r] != expected_short[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_INT: if (((int *)data_in)[r] != expected_int[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_FLOAT: if (((float *)data_in)[r] != expected_float[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_DOUBLE: if (((double *)data_in)[r] != expected_double[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; #ifdef _NETCDF4 case PIO_UBYTE: if (((unsigned char *)data_in)[r] != expected_ubyte[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_USHORT: if (((unsigned short *)data_in)[r] != expected_ushort[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_UINT: if (((unsigned int *)data_in)[r] != expected_uint[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_INT64: if (((long long *)data_in)[r] != expected_int64[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; case PIO_UINT64: if (((unsigned long long *)data_in)[r] != expected_uint64[r % (LAT_LEN * LON_LEN)]) - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); break; #endif /* _NETCDF4 */ default: - BAIL(ERR_WRONG); + PBAIL(ERR_WRONG); } } @@ -300,7 +300,7 @@ int check_darray_file(int iosysid, char *data_filename, int iotype, int my_rank, /* Check the 4D vars. */ if ((ret = check_4d_vars(my_rank, ncid, varid_4d))) - BAIL(ret); + PBAIL(ret); } /* Close the file. */ diff --git a/tests/cunit/test_rearr.c b/tests/cunit/test_rearr.c index 9c653bfdd84..e471787e5a7 100644 --- a/tests/cunit/test_rearr.c +++ b/tests/cunit/test_rearr.c @@ -512,11 +512,11 @@ int test_define_iodesc_datatypes(int my_rank) /* Allocate space for arrays in iodesc that will be filled in * define_iodesc_datatypes(). */ if (!(iodesc.rcount = malloc(iodesc.nrecvs * sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(iodesc.rfrom = malloc(iodesc.nrecvs * sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(iodesc.rindex = malloc(1 * sizeof(PIO_Offset)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); iodesc.rindex[0] = 0; iodesc.rcount[0] = 1; @@ -526,9 +526,9 @@ int test_define_iodesc_datatypes(int my_rank) int num_send_types = iodesc.rearranger == PIO_REARR_BOX ? ios.num_iotasks : 1; if (!(iodesc.sindex = malloc(num_send_types * sizeof(PIO_Offset)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(iodesc.scount = malloc(num_send_types * sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (int st = 0; st < num_send_types; st++) { iodesc.sindex[st] = 0; @@ -976,17 +976,17 @@ int test_rearrange_comp2io(MPI_Comm test_comm, int my_rank) /* Allocate some space for data. */ if (!(sbuf = calloc(4, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(rbuf = calloc(4, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Allocate IO system info struct for this test. */ if (!(ios = calloc(1, sizeof(iosystem_desc_t)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Allocate IO desc struct for this test. */ if (!(iodesc = calloc(1, sizeof(io_desc_t)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); ios->ioproc = 1; ios->compproc = 1; @@ -1022,17 +1022,17 @@ int test_rearrange_comp2io(MPI_Comm test_comm, int my_rank) ios->union_rank = my_rank; ios->num_comptasks = 4; if (!(ios->ioranks = calloc(ios->num_iotasks, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (int i = 0; i < TARGET_NTASKS; i++) ios->ioranks[i] = i; if (!(ios->compranks = calloc(ios->num_comptasks, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (int i = 0; i < TARGET_NTASKS; i++) ios->compranks[i] = i; /* This is how we allocate a region. */ if ((ret = alloc_region2(NULL, NDIM1, &ior1))) - BAIL(ret); + PBAIL(ret); ior1->next = NULL; if (my_rank == 0) ior1->count[0] = 8; @@ -1041,11 +1041,11 @@ int test_rearrange_comp2io(MPI_Comm test_comm, int my_rank) /* Create the box rearranger. */ if ((ret = box_rearrange_create(ios, maplen, compmap, gdimlen, ndims, iodesc))) - BAIL(ret); + PBAIL(ret); /* Run the function to test. */ if ((ret = rearrange_comp2io(ios, iodesc, sbuf, rbuf, nvars))) - BAIL(ret); + PBAIL(ret); /* We created send types, so free them. */ for (int st = 0; st < num_send_types; st++) @@ -1117,17 +1117,17 @@ int test_rearrange_io2comp(MPI_Comm test_comm, int my_rank) /* Allocate some space for data. */ if (!(sbuf = calloc(4, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); if (!(rbuf = calloc(4, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Allocate IO system info struct for this test. */ if (!(ios = calloc(1, sizeof(iosystem_desc_t)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); /* Allocate IO desc struct for this test. */ if (!(iodesc = calloc(1, sizeof(io_desc_t)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); ios->ioproc = 1; ios->io_rank = my_rank; @@ -1167,17 +1167,17 @@ int test_rearrange_io2comp(MPI_Comm test_comm, int my_rank) ios->num_comptasks = 4; ios->num_uniontasks = 4; if (!(ios->ioranks = calloc(ios->num_iotasks, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (int i = 0; i < TARGET_NTASKS; i++) ios->ioranks[i] = i; if (!(ios->compranks = calloc(ios->num_comptasks, sizeof(int)))) - BAIL(PIO_ENOMEM); + PBAIL(PIO_ENOMEM); for (int i = 0; i < TARGET_NTASKS; i++) ios->compranks[i] = i; /* This is how we allocate a region. */ if ((ret = alloc_region2(NULL, NDIM1, &ior1))) - BAIL(ret); + PBAIL(ret); ior1->next = NULL; if (my_rank == 0) ior1->count[0] = 8; @@ -1190,7 +1190,7 @@ int test_rearrange_io2comp(MPI_Comm test_comm, int my_rank) /* Run the function to test. */ if ((ret = rearrange_io2comp(ios, iodesc, sbuf, rbuf))) - BAIL(ret); + PBAIL(ret); /* We created send types, so free them. */ for (int st = 0; st < num_send_types; st++)