diff --git a/src/clib/pio_darray.c b/src/clib/pio_darray.c index 8b5fc55afd2..e221f2c237d 100644 --- a/src/clib/pio_darray.c +++ b/src/clib/pio_darray.c @@ -12,18 +12,22 @@ #include #include #include -/* 10MB default limit. */ + +/** 10MB default limit. */ PIO_Offset pio_buffer_size_limit = PIO_BUFFER_SIZE; -/* Global buffer pool pointer. */ +/** Global buffer pool pointer. */ void *CN_bpool = NULL; -/* Maximum buffer usage. */ +/** Maximum buffer usage. */ PIO_Offset maxusage = 0; -/* For write_darray_multi_serial() and write_darray_multi_par() to - * indicate whether fill or data are being written. */ +/** For write_darray_multi_serial() and write_darray_multi_par() to + * indicate that fill is being written. */ #define DARRAY_FILL 1 + +/** For write_darray_multi_serial() and write_darray_multi_par() to + * indicate that data are being written. */ #define DARRAY_DATA 0 /** @@ -36,7 +40,8 @@ PIO_Offset maxusage = 0; * @return The previous limit setting. * @author Jim Edwards */ -PIO_Offset PIOc_set_buffer_size_limit(PIO_Offset limit) +PIO_Offset +PIOc_set_buffer_size_limit(PIO_Offset limit) { PIO_Offset oldsize = pio_buffer_size_limit; @@ -101,9 +106,10 @@ PIO_Offset PIOc_set_buffer_size_limit(PIO_Offset limit) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, - PIO_Offset arraylen, void *array, const int *frame, - void **fillvalue, bool flushtodisk) +int +PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, + PIO_Offset arraylen, void *array, const int *frame, + void **fillvalue, bool flushtodisk) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -145,8 +151,8 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, var_desc_t *vdesc; if ((ierr = get_var_desc(varids[v], &file->varlist, &vdesc))) return pio_err(ios, file, ierr, __FILE__, __LINE__); -// if (vdesc->pio_type != iodesc->piotype) -// return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); + /* if (vdesc->pio_type != iodesc->piotype) + return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__);*/ } /* Get a pointer to the variable info for the first variable. */ @@ -162,16 +168,17 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, 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)); - 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__); - if(fndims != fndims2) - return pio_err(ios, file, PIO_EVARDIMMISMATCH, __FILE__, __LINE__); - } + 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__); + if(fndims != fndims2) + return pio_err(ios, file, PIO_EVARDIMMISMATCH, __FILE__, __LINE__); + } } - /* If async is in use, and this is not an IO task, bcast the parameters. */ + /* If async is in use, and this is not an IO task, bcast the + * parameters. */ if (ios->async) { if (!ios->ioproc) @@ -265,7 +272,7 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } else if (file->iotype == PIO_IOTYPE_PNETCDF && ios->ioproc) { - /* this assures that iobuf is allocated on all iotasks thus + /* this assures that iobuf is allocated on all iotasks thus assuring that the flush_output_buffer call above is called collectively (from all iotasks) */ if (!(file->iobuf = bget(1))) @@ -274,13 +281,13 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } if (iodesc->needssort) { - if (!(tmparray = malloc(arraylen*nvars*iodesc->piotype_size))) - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - pio_sorted_copy(array, tmparray, iodesc, nvars, 0); + if (!(tmparray = malloc(arraylen*nvars*iodesc->piotype_size))) + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + pio_sorted_copy(array, tmparray, iodesc, nvars, 0); } else { - tmparray = array; + tmparray = array; } /* Move data from compute to IO tasks. */ @@ -314,7 +321,7 @@ int 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")); + LOG((3,"freeing variable buffer in pio_darray")); brel(file->iobuf); file->iobuf = NULL; } @@ -335,22 +342,22 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, LOG((2, "nvars = %d holegridsize = %ld iodesc->needsfill = %d\n", nvars, iodesc->holegridsize, iodesc->needsfill)); - pioassert(!vdesc0->fillbuf, "buffer overwrite",__FILE__, __LINE__); + pioassert(!vdesc0->fillbuf, "buffer overwrite",__FILE__, __LINE__); /* Get a buffer. */ - if (ios->io_rank == 0) - vdesc0->fillbuf = bget(iodesc->maxholegridsize * iodesc->mpitype_size * nvars); - else if (iodesc->holegridsize > 0) - vdesc0->fillbuf = bget(iodesc->holegridsize * iodesc->mpitype_size * nvars); + if (ios->io_rank == 0) + vdesc0->fillbuf = bget(iodesc->maxholegridsize * iodesc->mpitype_size * nvars); + else if (iodesc->holegridsize > 0) + vdesc0->fillbuf = bget(iodesc->holegridsize * iodesc->mpitype_size * nvars); /* copying the fill value into the data buffer for the box * rearranger. This will be overwritten with data where * provided. */ - if(fillvalue) - for (int nv = 0; nv < nvars; nv++) - for (int i = 0; i < iodesc->holegridsize; i++) - memcpy(&((char *)vdesc0->fillbuf)[iodesc->mpitype_size * (i + nv * iodesc->holegridsize)], - &((char *)fillvalue)[iodesc->mpitype_size * nv], iodesc->mpitype_size); + if(fillvalue) + for (int nv = 0; nv < nvars; nv++) + for (int i = 0; i < iodesc->holegridsize; i++) + memcpy(&((char *)vdesc0->fillbuf)[iodesc->mpitype_size * (i + nv * iodesc->holegridsize)], + &((char *)fillvalue)[iodesc->mpitype_size * nv], iodesc->mpitype_size); /* Write the darray based on the iotype. */ switch (file->iotype) @@ -384,7 +391,7 @@ int PIOc_write_darray_multi(int ncid, const int *varids, int ioid, int nvars, } if(iodesc->needssort && tmparray != NULL) - free(tmparray); + free(tmparray); /* Flush data to disk for pnetcdf. */ if (ios->ioproc && file->iotype == PIO_IOTYPE_PNETCDF) @@ -510,7 +517,8 @@ pio_inq_var_fill_expected(int ncid, int varid, int pio_type, PIO_Offset type_siz * @ingroup PIO_write_darray * @author Ed Hartnett */ -int find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) +int +find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) { iosystem_desc_t *ios; /* Pointer to io system information. */ int pio_type; @@ -603,8 +611,9 @@ int find_var_fillvalue(file_desc_t *file, int varid, var_desc_t *vdesc) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *array, - void *fillvalue) +int +PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void *array, + void *fillvalue) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Info about file we are writing to. */ @@ -656,10 +665,10 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * /* If the type of the var doesn't match the type of the * decomposition, return an error. */ -// if (iodesc->piotype != vdesc->pio_type) -// return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); -// pioassert(iodesc->mpitype_size == vdesc->mpi_type_size, "wrong mpi info", -// __FILE__, __LINE__); + /* if (iodesc->piotype != vdesc->pio_type) */ + /* return pio_err(ios, file, PIO_EINVAL, __FILE__, __LINE__); */ + /* pioassert(iodesc->mpitype_size == vdesc->mpi_type_size, "wrong mpi info", */ + /* __FILE__, __LINE__); */ /* If we don't know the fill value for this var, get it. */ if (!vdesc->fillvalue) @@ -677,7 +686,7 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * 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)); + LOG((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) @@ -695,8 +704,8 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * wmb->data = NULL; wmb->frame = NULL; wmb->fillvalue = NULL; - wmb->htid = hashid; - HASH_ADD_INT( file->buffer, htid, wmb ); + 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)); @@ -732,7 +741,7 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * https://github.com/pmodels/mpich/pull/2888 */ io_data_size = (1 + wmb->num_arrays) * iodesc->maxiobuflen * iodesc->mpitype_size; if(io_data_size > INT_MAX) - needsflush = 2; + needsflush = 2; /* Tell all tasks on the computation communicator whether we need * to flush data. */ @@ -848,8 +857,9 @@ int PIOc_write_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, void * * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, - void *array) +int +PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, + void *array) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -899,13 +909,13 @@ int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, if (iodesc->needssort) { - if (!(tmparray = malloc(iodesc->piotype_size*iodesc->maplen))) - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - for(int m=0; mmaplen;m++) - ((int *) array)[m] = -1; + if (!(tmparray = malloc(iodesc->piotype_size*iodesc->maplen))) + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + for(int m=0; mmaplen;m++) + ((int *) array)[m] = -1; } else - tmparray = array; + tmparray = array; /* Rearrange the data. */ if ((ierr = rearrange_io2comp(ios, iodesc, iobuf, tmparray))) @@ -913,8 +923,8 @@ int PIOc_read_darray(int ncid, int varid, int ioid, PIO_Offset arraylen, if (iodesc->needssort) { - pio_sorted_copy(tmparray, array, iodesc, 1, 1); - free(tmparray); + pio_sorted_copy(tmparray, array, iodesc, 1, 1); + free(tmparray); } /* Free the buffer. */ diff --git a/src/clib/pio_darray_int.c b/src/clib/pio_darray_int.c index 3e30aa45029..8f770ee3bbf 100644 --- a/src/clib/pio_darray_int.c +++ b/src/clib/pio_darray_int.c @@ -18,20 +18,26 @@ #define USE_VARD_WRITE 1 #endif -/* 10MB default limit. */ +/** 10MB default limit. */ extern PIO_Offset pio_buffer_size_limit; -/* Initial size of compute buffer. */ +/** Initial size of compute buffer. */ bufsize pio_cnbuffer_limit = 33554432; -/* Global buffer pool pointer. */ +/** Global buffer pool pointer. */ extern void *CN_bpool; -/* Maximum buffer usage. */ +/** Maximum buffer usage. */ extern PIO_Offset maxusage; -/* handler for freeing the memory buffer pool */ -void bpool_free(void *p) +/** + * Handler for freeing the memory buffer pool. + * + * @param p pointer to the memory buffer pool. + * @author Jim Edwards + */ +void +bpool_free(void *p) { free(p); if(p == CN_bpool){ @@ -51,7 +57,8 @@ void bpool_free(void *p) * @returns 0 for success, error code otherwise. * @author Jim Edwards */ -int compute_buffer_init(iosystem_desc_t *ios) +int +compute_buffer_init(iosystem_desc_t *ios) { #if !PIO_USE_MALLOC @@ -73,37 +80,72 @@ int compute_buffer_init(iosystem_desc_t *ios) } #if USE_VARD -int get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, MPI_Offset *gdim0) +/** + * Get the length of dimension 0. + * + * @param file pointer to the file descriptor. + * @param iosdesc pointer to the iosystem descriptor. + * @param varid variable ID. + * @param fndims number of dimensions in the file. + * @param gdim0 pointer that gets gdim0. + * @returns 0 for success, error code otherwise. + * @author Jim Edwards + */ +int +get_gdim0(file_desc_t *file,io_desc_t *iodesc, int varid, int fndims, + MPI_Offset *gdim0) { - int ierr=PIO_NOERR; + int ierr = PIO_NOERR; + *gdim0 = 0; - if(file->iotype == PIO_IOTYPE_PNETCDF && iodesc->ndims < fndims) + if (file->iotype == PIO_IOTYPE_PNETCDF && iodesc->ndims < fndims) { - int numunlimdims; - /* 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")); - if ((ierr = PIOc_inq_unlimdims(file->pio_ncid, &numunlimdims, NULL))) - return check_netcdf(file, ierr, __FILE__, __LINE__); - LOG((3,"numunlimdims = %d", numunlimdims)); - if (numunlimdims <= 0) - { - int dimids[fndims]; - if ((ierr = PIOc_inq_vardimid(file->pio_ncid, varid, dimids))) - return check_netcdf(file, ierr, __FILE__, __LINE__); - if ((ierr = PIOc_inq_dimlen(file->pio_ncid, dimids[0], gdim0))) - return check_netcdf(file, ierr, __FILE__, __LINE__); + int numunlimdims; + + /* 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")); + if ((ierr = PIOc_inq_unlimdims(file->pio_ncid, &numunlimdims, NULL))) + return check_netcdf(file, ierr, __FILE__, __LINE__); + LOG((3,"numunlimdims = %d", numunlimdims)); + if (numunlimdims <= 0) + { + int dimids[fndims]; + if ((ierr = PIOc_inq_vardimid(file->pio_ncid, varid, dimids))) + return check_netcdf(file, ierr, __FILE__, __LINE__); + if ((ierr = PIOc_inq_dimlen(file->pio_ncid, dimids[0], gdim0))) + return check_netcdf(file, ierr, __FILE__, __LINE__); } } LOG((3,"gdim0 = %d",*gdim0)); return ierr; } + +/** + * Get the MPI data type of vard. + * + * @param iosdesc pointer to the iosystem descriptor. + * @param gdim0 + * @param unlimdimoffset + * @param rrcnt + * @param ndims the number of dimensions in the decomposition. + * @param fndims the number of dimensions in the file. + * @param varid variable ID. + * @param fndims number of dimensions in the file. + * @param frame the record number. + * @param startlist + * @param countlist + * @param filetype a pointer that gets the MPI data type. + * @returns 0 for success, error code otherwise. + * @author Jim Edwards + */ static int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdimoffset, - int rrcnt, int ndims, int fndims, - int frame, PIO_Offset **startlist, PIO_Offset **countlist, - MPI_Datatype *filetype) + int rrcnt, int ndims, int fndims, + int frame, PIO_Offset **startlist, PIO_Offset **countlist, + MPI_Datatype *filetype) { int sa_ndims; @@ -120,46 +162,46 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi *filetype = MPI_DATATYPE_NULL; if(rrcnt == 0) - return PIO_NOERR; + return PIO_NOERR; for ( int rc=0; rc ndims) { - if ( gdim0 > 0) - { - gdims[0] = gdim0; - sa_ndims = fndims; - dim_offset = 0; - for (int i=1; i < fndims; i++) - gdims[i] = iodesc->dimlen[i-1]; - } - else - { - sa_ndims = ndims; - dim_offset = 1; - for (int i=0; i < ndims; i++) - gdims[i] = iodesc->dimlen[i]; - } + if ( gdim0 > 0) + { + gdims[0] = gdim0; + sa_ndims = fndims; + dim_offset = 0; + for (int i=1; i < fndims; i++) + gdims[i] = iodesc->dimlen[i-1]; + } + else + { + sa_ndims = ndims; + dim_offset = 1; + for (int i=0; i < ndims; i++) + gdims[i] = iodesc->dimlen[i]; + } } else { - sa_ndims = fndims; - dim_offset = 0; - for (int i=0; i < fndims; i++) - gdims[i] = iodesc->dimlen[i]; + sa_ndims = fndims; + dim_offset = 0; + for (int i=0; i < fndims; i++) + gdims[i] = iodesc->dimlen[i]; } int true_rrcnt=-1; /* true number of contiguous requests */ MPI_Aint prev_end=-1; /* end offset of rc-1 request */ for( int rc=0; rcmpitype && @@ -279,9 +321,10 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi * @ingroup PIO_write_darray * @author Ed Hartnett */ -int find_start_count(int ndims, int fndims, var_desc_t *vdesc, - io_region *region, const int *frame, size_t *start, - size_t *count) +int +find_start_count(int ndims, int fndims, var_desc_t *vdesc, + io_region *region, const int *frame, size_t *start, + size_t *count) { /* Init start/count arrays to zero. */ for (int i = 0; i < fndims; i++) @@ -312,7 +355,7 @@ int find_start_count(int ndims, int fndims, var_desc_t *vdesc, else if (fndims == ndims) { /* In some cases the unlimited dim is not treated as - the pio record dim */ + the pio record dim */ start[0] += vdesc->record; } } @@ -354,8 +397,9 @@ int find_start_count(int ndims, int fndims, var_desc_t *vdesc, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *varids, - io_desc_t *iodesc, int fill, const int *frame) +int +write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *varids, + io_desc_t *iodesc, int fill, const int *frame) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Pointer to var info struct. */ @@ -395,8 +439,8 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * #if USE_VARD_WRITE if (!ios->async || !ios->ioproc) { - if ((ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); + if ((ierr = get_gdim0(file, iodesc, varids[0], fndims, &gdim0))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); } #endif @@ -519,12 +563,12 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * { #if USE_VARD_WRITE /* PnetCDF 1.10.0 and later support type conversion in - * vard APIs. However, it requires all variables - * accessed by the filetype are of the same NC data - * type. + * vard APIs. However, it requires all variables + * accessed by the filetype are of the same NC data + * type. */ - /* obtain file offset of variable nv */ + /* obtain file offset of variable nv */ if ((ierr = ncmpi_inq_varoffset(file->fh, varids[nv], &vari_offset))) return pio_err(NULL, file, ierr, __FILE__, __LINE__); @@ -537,26 +581,26 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * blocklens[nv] = 1; /* 1 for each vartypes[nv] */ /* If this is the first variable or the frame has changed between variables (this should be rare) */ - if(nv==0 || (nv > 0 && frame != NULL && frame[nv] != frame[nv-1])){ - int thisframe; - PIO_Offset unlimdimoffset; - if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ - { - 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)); - }else - unlimdimoffset = gdim0; - if (frame) - thisframe = frame[nv]; - else - thisframe = 0; - - ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, - rrcnt, ndims, fndims, - thisframe, startlist, countlist, - &vartypes[numReqs]); - } + if(nv==0 || (nv > 0 && frame != NULL && frame[nv] != frame[nv-1])){ + int thisframe; + PIO_Offset unlimdimoffset; + if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ + { + 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)); + }else + unlimdimoffset = gdim0; + if (frame) + thisframe = frame[nv]; + else + thisframe = 0; + + ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, + rrcnt, ndims, fndims, + thisframe, startlist, countlist, + &vartypes[numReqs]); + } else /* reuse the previous variable's datatype */ vartypes[numReqs] = vartypes[numReqs-1]; #else @@ -619,7 +663,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * if(filetype != MPI_DATATYPE_NULL) { if((mpierr = MPI_Type_free(&filetype))) - return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); + return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); } vard_llen = 0; /* reset request size to 0 */ numReqs = 0; @@ -640,7 +684,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * /* 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)); - ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist, + ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist, bufptr, llen, iodesc->mpitype, &vdesc->request[vdesc->nreqs]); /* keeps wait calls in sync */ @@ -649,7 +693,7 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * vdesc->nreqs++; #endif - } + } /* Free resources. */ for (int i = 0; i < rrcnt; i++) @@ -704,9 +748,10 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett **/ -int find_all_start_count(io_region *region, int maxregions, int fndims, - int iodesc_ndims, var_desc_t *vdesc, size_t *tmp_start, - size_t *tmp_count) +int +find_all_start_count(io_region *region, int maxregions, int fndims, + int iodesc_ndims, var_desc_t *vdesc, size_t *tmp_start, + size_t *tmp_count) { /* Check inputs. */ pioassert(maxregions >= 0 && fndims > 0 && iodesc_ndims >= 0 && vdesc && @@ -771,9 +816,10 @@ int find_all_start_count(io_region *region, int maxregions, int fndims, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, - int maxregions, int nvars, int fndims, size_t *tmp_start, - size_t *tmp_count, void *iobuf) +int +send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset llen, + int maxregions, int nvars, int fndims, size_t *tmp_start, + size_t *tmp_count, void *iobuf) { MPI_Status status; /* Recv status for MPI. */ int mpierr; /* Return code from MPI function codes. */ @@ -850,9 +896,10 @@ int send_all_start_count(iosystem_desc_t *ios, io_desc_t *iodesc, PIO_Offset lle * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, - io_desc_t *iodesc, PIO_Offset llen, int maxregions, int nvars, - int fndims, size_t *tmp_start, size_t *tmp_count, void *iobuf) +int +recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, + io_desc_t *iodesc, PIO_Offset llen, int maxregions, int nvars, + int fndims, size_t *tmp_start, size_t *tmp_count, void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ size_t rlen; /* Length of IO buffer on this task. */ @@ -1009,8 +1056,9 @@ int recv_and_write_data(file_desc_t *file, const int *varids, const int *frame, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *varids, - io_desc_t *iodesc, int fill, const int *frame) +int +write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const int *varids, + io_desc_t *iodesc, int fill, const int *frame) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Contains info about the variable. */ @@ -1101,7 +1149,8 @@ int write_darray_multi_serial(file_desc_t *file, int nvars, int fndims, const in * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) +int +pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Information about the variable. */ @@ -1138,7 +1187,7 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu return pio_err(ios, file, ierr, __FILE__, __LINE__); #if USE_VARD_READ if(!ios->async || !ios->ioproc) - ierr = get_gdim0(file, iodesc, vid, fndims, &gdim0); + ierr = get_gdim0(file, iodesc, vid, fndims, &gdim0); #endif /* LOG((4, "fndims %d ndims %d", fndims, ndims)); */ @@ -1298,23 +1347,23 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu if (regioncnt == iodesc->maxregions - 1) { #if USE_VARD_READ - MPI_Datatype filetype; - PIO_Offset unlimdimoffset; - int mpierr; - if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ - { - if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) - return pio_err(NULL, file, ierr, __FILE__, __LINE__); - } - else - unlimdimoffset = gdim0; - - ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, - rrlen, ndims, fndims, - vdesc->record, startlist, countlist, &filetype); - ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); - if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype))) - return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); + MPI_Datatype filetype; + PIO_Offset unlimdimoffset; + int mpierr; + if (gdim0 == 0) /* if there is an unlimited dimension get the offset between records of a variable */ + { + if((ierr = ncmpi_inq_recsize(file->fh, &unlimdimoffset))) + return pio_err(NULL, file, ierr, __FILE__, __LINE__); + } + else + unlimdimoffset = gdim0; + + ierr = get_vard_mpidatatype(iodesc, gdim0, unlimdimoffset, + rrlen, ndims, fndims, + vdesc->record, startlist, countlist, &filetype); + ierr = ncmpi_get_vard_all(file->fh, vid, filetype, iobuf, iodesc->llen, iodesc->mpitype); + if(filetype != MPI_DATATYPE_NULL && (mpierr = MPI_Type_free(&filetype))) + return check_mpi(NULL, NULL, mpierr, __FILE__, __LINE__); #else /* Read a list of subarrays. */ @@ -1373,8 +1422,9 @@ int pio_read_darray_nc(file_desc_t *file, io_desc_t *iodesc, int vid, void *iobu * @ingroup PIO_read_darray * @author Jim Edwards, Ed Hartnett */ -int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, - void *iobuf) +int +pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, + void *iobuf) { iosystem_desc_t *ios; /* Pointer to io system information. */ var_desc_t *vdesc; /* Information about the variable. */ @@ -1669,7 +1719,8 @@ int pio_read_darray_nc_serial(file_desc_t *file, io_desc_t *iodesc, int vid, * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) +int +flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) { int mpierr; /* Return code from MPI functions. */ int ierr = PIO_NOERR; @@ -1683,9 +1734,9 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) LOG((1, "flush_output_buffer")); /* Find out the buffer usage. */ if ((ierr = ncmpi_inq_buffer_usage(file->fh, &usage))) - /* allow the buffer to be undefined */ - if (ierr != NC_ENULLABUF) - return pio_err(NULL, file, PIO_EBADID, __FILE__, __LINE__); + /* allow the buffer to be undefined */ + if (ierr != NC_ENULLABUF) + return pio_err(NULL, file, PIO_EBADID, __FILE__, __LINE__); /* If we are not forcing a flush, spread the usage to all IO * tasks. */ @@ -1789,7 +1840,8 @@ int flush_output_buffer(file_desc_t *file, bool force, PIO_Offset addsize) * @ingroup PIO_write_darray * @author Jim Edwards */ -void cn_buffer_report(iosystem_desc_t *ios, bool collective) +void +cn_buffer_report(iosystem_desc_t *ios, bool collective) { int mpierr; /* Return code from MPI functions. */ @@ -1838,7 +1890,8 @@ void cn_buffer_report(iosystem_desc_t *ios, bool collective) * @ingroup PIO_write_darray * @author Jim Edwards */ -void free_cn_buffer_pool(iosystem_desc_t *ios) +void +free_cn_buffer_pool(iosystem_desc_t *ios) { #if !PIO_USE_MALLOC LOG((2, "free_cn_buffer_pool CN_bpool = %d", CN_bpool)); @@ -1864,7 +1917,8 @@ void free_cn_buffer_pool(iosystem_desc_t *ios) * @ingroup PIO_write_darray * @author Jim Edwards, Ed Hartnett */ -int flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) +int +flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) { file_desc_t *file; int ret; @@ -1914,242 +1968,256 @@ int flush_buffer(int ncid, wmulti_buffer *wmb, bool flushtodisk) return PIO_NOERR; } -int pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, int nvars,int direction) +/** + * Sort the contents of an array. + * + * @param array pointer to the array + * @param sortedarray pointer that gets the sorted array. + * @param iodesc pointer to the iodesc. + * @param nvars number of variables. + * @param direction sort direction. + * @returns 0 for success, error code otherwise. + * @ingroup PIO_write_darray + * @author Jim Edwards + */ +int +pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, + int nvars, int direction) { int maplen = iodesc->maplen; if (direction == 0){ - switch (iodesc->piotype) - { - case PIO_BYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((signed char *)sortedarray)[m+maplen*v] = ((signed char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_CHAR: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char *)sortedarray)[m+maplen*v] = ((char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_SHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((short *)sortedarray)[m+maplen*v] = ((short *)array)[iodesc->remap[m]+maplen*v]; - } - } - - break; - case PIO_INT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((int *)sortedarray)[m+maplen*v] = ((int *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_FLOAT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((float *)sortedarray)[m+maplen*v] = ((float *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_DOUBLE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((double *)sortedarray)[m+maplen*v] = ((double *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UBYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned char *)sortedarray)[m+maplen*v] = ((unsigned char *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_USHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned short *)sortedarray)[m+maplen*v] = ((unsigned short *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UINT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned int *)sortedarray)[m+maplen*v] = ((unsigned int *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_INT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((long long *)sortedarray)[m+maplen*v] = ((long long *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_UINT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned long long *)sortedarray)[m+maplen*v] = ((unsigned long long *)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - case PIO_STRING: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char **)sortedarray)[m+maplen*v] = ((char **)array)[iodesc->remap[m]+maplen*v]; - } - } - break; - default: - return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); - } + switch (iodesc->piotype) + { + case PIO_BYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((signed char *)sortedarray)[m+maplen*v] = ((signed char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_CHAR: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char *)sortedarray)[m+maplen*v] = ((char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_SHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((short *)sortedarray)[m+maplen*v] = ((short *)array)[iodesc->remap[m]+maplen*v]; + } + } + + break; + case PIO_INT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((int *)sortedarray)[m+maplen*v] = ((int *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_FLOAT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((float *)sortedarray)[m+maplen*v] = ((float *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_DOUBLE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((double *)sortedarray)[m+maplen*v] = ((double *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UBYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned char *)sortedarray)[m+maplen*v] = ((unsigned char *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_USHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned short *)sortedarray)[m+maplen*v] = ((unsigned short *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UINT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned int *)sortedarray)[m+maplen*v] = ((unsigned int *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_INT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((long long *)sortedarray)[m+maplen*v] = ((long long *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_UINT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned long long *)sortedarray)[m+maplen*v] = ((unsigned long long *)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + case PIO_STRING: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char **)sortedarray)[m+maplen*v] = ((char **)array)[iodesc->remap[m]+maplen*v]; + } + } + break; + default: + return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); + } } else { - switch (iodesc->piotype) - { - case PIO_BYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((signed char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((signed char *)array)[m+maplen*v]; - } - } - break; - case PIO_CHAR: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((char *)array)[m+maplen*v]; - } - } - break; - case PIO_SHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((short *)array)[m+maplen*v]; - } - } - - break; - case PIO_INT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((int *)array)[m+maplen*v]; - } - } - break; - case PIO_FLOAT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((float *)sortedarray)[iodesc->remap[m]+maplen*v] = ((float *)array)[m+maplen*v]; - } - } - break; - case PIO_DOUBLE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((double *)sortedarray)[iodesc->remap[m]+maplen*v] = ((double *)array)[m+maplen*v]; - } - } - break; - case PIO_UBYTE: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned char *)array)[m+maplen*v]; - } - } - break; - case PIO_USHORT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned short *)array)[m+maplen*v]; - } - } - break; - case PIO_UINT: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned int *)array)[m+maplen*v]; - } - } - break; - case PIO_INT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((long long *)array)[m+maplen*v]; - } - } - break; - case PIO_UINT64: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((unsigned long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned long long *)array)[m+maplen*v]; - } - } - break; - case PIO_STRING: - for (int v=0; v < nvars; v++) - { - for (int m=0; m < maplen; m++) - { - ((char **)sortedarray)[iodesc->remap[m]+maplen*v] = ((char **)array)[m+maplen*v]; - } - } - break; - default: - return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); - } + switch (iodesc->piotype) + { + case PIO_BYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((signed char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((signed char *)array)[m+maplen*v]; + } + } + break; + case PIO_CHAR: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((char *)array)[m+maplen*v]; + } + } + break; + case PIO_SHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((short *)array)[m+maplen*v]; + } + } + + break; + case PIO_INT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((int *)array)[m+maplen*v]; + } + } + break; + case PIO_FLOAT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((float *)sortedarray)[iodesc->remap[m]+maplen*v] = ((float *)array)[m+maplen*v]; + } + } + break; + case PIO_DOUBLE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((double *)sortedarray)[iodesc->remap[m]+maplen*v] = ((double *)array)[m+maplen*v]; + } + } + break; + case PIO_UBYTE: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned char *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned char *)array)[m+maplen*v]; + } + } + break; + case PIO_USHORT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned short *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned short *)array)[m+maplen*v]; + } + } + break; + case PIO_UINT: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned int *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned int *)array)[m+maplen*v]; + } + } + break; + case PIO_INT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((long long *)array)[m+maplen*v]; + } + } + break; + case PIO_UINT64: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((unsigned long long *)sortedarray)[iodesc->remap[m]+maplen*v] = ((unsigned long long *)array)[m+maplen*v]; + } + } + break; + case PIO_STRING: + for (int v=0; v < nvars; v++) + { + for (int m=0; m < maplen; m++) + { + ((char **)sortedarray)[iodesc->remap[m]+maplen*v] = ((char **)array)[m+maplen*v]; + } + } + break; + default: + return pio_err(NULL, NULL, PIO_EBADTYPE, __FILE__, __LINE__); + } } return PIO_NOERR; } @@ -2163,7 +2231,8 @@ int pio_sorted_copy(const void *array, void *sortedarray, io_desc_t *iodesc, int * @returns 0 for success, error code otherwise. * @author Jim Edwards */ -int compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) +int +compute_maxaggregate_bytes(iosystem_desc_t *ios, io_desc_t *iodesc) { int maxbytesoniotask = INT_MAX; int maxbytesoncomputetask = INT_MAX; diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index c356bac4799..81ce3d7b7d5 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -1484,7 +1484,10 @@ PIOc_inq_attid(int ncid, int varid, const char *name, int *idp) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). - * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling + * @param dimid the dimension ID. + * @param name the new name for the dimension. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int @@ -1571,7 +1574,9 @@ PIOc_rename_dim(int ncid, int dimid, const char *name) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling + * @param name the new name for the variable. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int @@ -1658,8 +1663,10 @@ PIOc_rename_var(int ncid, int varid, const char *name) * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. - * @return PIO_NOERR for success, error code otherwise. See - * PIOc_Set_File_Error_Handling + * @param name the name of the attribute. + * @param newname the new name for the attribute. + * @return PIO_NOERR for success, error code otherwise. See + * PIOc_Set_File_Error_Handling(). * @author Jim Edwards, Ed Hartnett */ int diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index ffcd12310d4..3ae2a4b1b95 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -1740,7 +1740,7 @@ PIOc_writemap(const char *file, int ndims, const int *gdims, PIO_Offset maplen, * @param gdims an array of dimension ids * @param maplen the length of the map * @param map the map array - * @param comm an MPI communicator. + * @param f90_comm an MPI communicator. * @returns 0 for success, error code otherwise. * @author Jim Edwards */ @@ -2201,12 +2201,12 @@ inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int **rec * * Input parameters are read on comp task 0 and ignored elsewhere. * - * @param iosysid: A defined pio system descriptor (input) - * @param ncidp: A pio file descriptor (output) - * @param iotype: A pio output format (input) - * @param filename: The filename to open - * @param mode: The netcdf mode for the open operation - * @param retry: non-zero to automatically retry with netCDF serial + * @param iosysid a defined pio system descriptor. + * @param ncidp a pio file descriptor. + * @param iotype a pio output format. + * @param filename the filename to open + * @param mode the netcdf mode for the open operation + * @param retry non-zero to automatically retry with netCDF serial * classic. * * @return 0 for success, error code otherwise. @@ -2663,6 +2663,7 @@ iotype_is_valid(int iotype) /** * Set the rearranger options associated with an iosystem * + * @param iosysid a defined pio system descriptor. * @param comm_type Type of communication (pt2pt/coll) used * by the rearranger. See PIO_REARR_COMM_TYPE for more detail. * Possible values are : @@ -2691,7 +2692,6 @@ iotype_is_valid(int iotype) * data, from io to compute processes * @param max_pend_req_i2c Maximum pending requests during * data rearragment from io processes to compute processes - * @param iosysidp index of the defined system descriptor * @return 0 on success, otherwise a PIO error code. * @author Jayesh Krishna */