diff --git a/configure.ac b/configure.ac index ada0f9466ed..1375a782594 100644 --- a/configure.ac +++ b/configure.ac @@ -128,12 +128,16 @@ fi if test "x$enable_docs" = xyes; then AC_SUBST([CMAKE_CURRENT_SOURCE_DIR], ["."]) AC_SUBST([CMAKE_BINARY_DIR], [".."]) + if test "x$enable_fortran" = xno; then + AC_MSG_ERROR([--enable-fortran is required for documentation builds.]) + fi if test "x$enable_developer_docs" = xyes; then - AC_SUBST([C_SRC_FILES], ["../src/clib"]) - AC_SUBST([FORTRAN_SRC_FILES], ["../src/flib"]) + AC_SUBST([C_SRC_FILES], ["../src/clib"]) + AC_SUBST([FORTRAN_SRC_FILES], ["../src/flib"]) else - AC_SUBST([C_SRC_FILES], ["../src/clib/pio_nc4.c ../src/clib/pio_darray.c ../src/clib/pio_get_nc.c ../src/clib/pio_put_nc.c"]) - AC_SUBST([FORTRAN_SRC_FILES], ["../src/flib/piodarray.F90 ../src/flib/piolib_mod.F90 ../src/flib/pio_nf.F90"]) + AC_SUBST([C_SRC_FILES], ["../src/clib/pio_nc.c ../src/clib/pio_nc4.c ../src/clib/pio_darray.c ../src/clib/pio_get_nc.c ../src/clib/pio_put_nc.c ../src/clib/pioc_support.c ../src/clib/pioc.c ../src/clib/pio_file.c ../src/clib/pio.h"]) + AC_SUBST([FORTRAN_SRC_FILES], ["../src/flib"]) +# AC_SUBST([FORTRAN_SRC_FILES], ["../src/flib/pio_types.F90 ../src/flib/piodarray.F90 ../src/flib/piolib_mod.F90 ../src/flib/pio_nf.F90"]) fi AC_CONFIG_FILES([doc/Doxyfile]) fi diff --git a/doc/source/contributing_code.txt b/doc/source/contributing_code.txt index 264484f2951..faca49aab08 100644 --- a/doc/source/contributing_code.txt +++ b/doc/source/contributing_code.txt @@ -50,7 +50,7 @@ add to it, carefully.
  • Use spaces not tabs.
  • 4 spaces is the unit of intendation.
  • Indentation as defined by the "linux" style in emacs (see below). -
  • Use spaces around most operators (=+-*/) not pointer or prefix/postfile (*++--) +
  • Use spaces around most operators (= + - * /) not pointer or prefix/postfile (* ++ --)
  • Spaces after most keywords (if, for, while, etc.)
  • No spaces after function name. @@ -227,14 +227,14 @@ int PIOc_inq_attname(int ncid, int varid, int attnum, char *name) /* If this is an IO task, then call the netCDF function. */ if (ios->ioproc) { -#ifdef _PNETCDF +\#ifdef _PNETCDF if (file->iotype == PIO_IOTYPE_PNETCDF) ierr = ncmpi_inq_attname(file->fh, varid, attnum, name); -#endif /* _PNETCDF */ -#ifdef _NETCDF +\#endif /* _PNETCDF */ +\#ifdef _NETCDF if (file->iotype != PIO_IOTYPE_PNETCDF && file->do_io) ierr = nc_inq_attname(file->fh, varid, attnum, name); -#endif /* _NETCDF */ +\#endif /* _NETCDF */ LOG((2, "PIOc_inq_attname netcdf call returned %d", ierr)); } diff --git a/doc/source/mach_walkthrough.txt b/doc/source/mach_walkthrough.txt index 05cd8776d65..a63e287704d 100644 --- a/doc/source/mach_walkthrough.txt +++ b/doc/source/mach_walkthrough.txt @@ -170,7 +170,7 @@ Download a copy of the PIO source into a sub-directory of your working directory It is not necessary to edit your .soft file on Mira inorder to build PIO. Execute the following commands to temporarily load packages into your softenv. These packages use the IBM/XL compiler.
    %> soft add +mpiwrapper-xl (or switch from the default in your softenv)
    - %> soft add @ibm-compilers-2015-02
    + %> soft add \@ibm-compilers-2015-02
    %> soft add +cmake
    %> soft add +git
    @@ -374,7 +374,7 @@ found.
    cd hdf5-1.10.1
     CC=mpicc ./configure --with-zlib=/usr/local/zlib-1.2.11_mpich-3.2 --with-szlib=/usr/local/szip-2.1_mpich-3.2 --prefix=/usr/local/hdf5-1.10.1_mpich-3.2 --enable-parallel
     make all check
    -sudo PATH=$PATH:/usr/local/bin make install
    +sudo PATH=$PATH:/usr/local/bin make install
  • Installing NetCDF-4 C Library diff --git a/src/clib/pio_nc.c b/src/clib/pio_nc.c index 81ce3d7b7d5..71371d24a94 100644 --- a/src/clib/pio_nc.c +++ b/src/clib/pio_nc.c @@ -691,6 +691,7 @@ PIOc_inq_dimlen(int ncid, int dimid, PIO_Offset *lenp) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). + * @param name pointer taht gets the name of the dimension. * @param idp a pointer that will get the id of the variable or attribute. * @return PIO_NOERR for success, error code otherwise. See PIOc_Set_File_Error_Handling * @author Jim Edwards, Ed Hartnett @@ -1974,6 +1975,8 @@ PIOc_redef(int ncid) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). + * @param name name of the dimension. + * @param len length of the dimension. * @param idp a pointer that will get the id of the variable or attribute. * @return PIO_NOERR for success, error code otherwise. * @author Jim Edwards, Ed Hartnett @@ -2064,8 +2067,11 @@ PIOc_def_dim(int ncid, const char *name, PIO_Offset len, int *idp) * * @param ncid the ncid of the open file, obtained from * PIOc_openfile() or PIOc_createfile(). - * @param varid the variable ID. - * @param varidp a pointer that will get the variable id + * @param name the variable name. + * @param xtype the PIO_TYPE of the variable. + * @param ndims the number of dimensions. + * @param dimidsp pointer to array of dimension IDs. + * @param varidp a pointer that will get the variable ID. * @return PIO_NOERR for success, error code otherwise. * @ingroup PIO_def_var * @author Jim Edwards, Ed Hartnett @@ -3123,7 +3129,6 @@ PIOc_put_att_ushort(int ncid, int varid, const char *name, nc_type xtype, * PIOc_openfile() or PIOc_createfile(). * @param varid the variable ID. * @param name the name of the attribute. - * @param xtype the nc_type of the attribute. * @param len the length of the attribute array. * @param op a pointer with the attribute data. * @return PIO_NOERR for success, error code otherwise. diff --git a/src/clib/pio_nc4.c b/src/clib/pio_nc4.c index f48c9fa5577..b2b4e6e1996 100644 --- a/src/clib/pio_nc4.c +++ b/src/clib/pio_nc4.c @@ -31,8 +31,9 @@ * @ingroup PIO_def_var * @author Ed Hartnett */ -int PIOc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, - int deflate_level) +int +PIOc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, + int deflate_level) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -121,8 +122,9 @@ int PIOc_def_var_deflate(int ncid, int varid, int shuffle, int deflate, * @ingroup PIO_inq_var * @author Ed Hartnett */ -int PIOc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, - int *deflate_levelp) +int +PIOc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, + int *deflate_levelp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -231,7 +233,8 @@ int PIOc_inq_var_deflate(int ncid, int varid, int *shufflep, int *deflatep, * @return PIO_NOERR for success, otherwise an error code. * @author Ed Hartnett */ -int PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunksizesp) +int +PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *chunksizesp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -353,7 +356,8 @@ int PIOc_def_var_chunking(int ncid, int varid, int storage, const PIO_Offset *ch * @ingroup PIO_inq_var * @author Ed Hartnett */ -int PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizesp) +int +PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunksizesp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -485,7 +489,8 @@ int PIOc_inq_var_chunking(int ncid, int varid, int *storagep, PIO_Offset *chunks * @ingroup PIO_def_var * @author Ed Hartnett */ -int PIOc_def_var_endian(int ncid, int varid, int endian) +int +PIOc_def_var_endian(int ncid, int varid, int endian) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -561,7 +566,8 @@ int PIOc_def_var_endian(int ncid, int varid, int endian) * @ingroup PIO_inq_var * @author Ed Hartnett */ -int PIOc_inq_var_endian(int ncid, int varid, int *endianp) +int +PIOc_inq_var_endian(int ncid, int varid, int *endianp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -653,8 +659,9 @@ int PIOc_inq_var_endian(int ncid, int varid, int *endianp) * @ingroup PIO_def_var * @author Ed Hartnett */ -int PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset nelems, - float preemption) +int +PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset nelems, + float preemption) { iosystem_desc_t *ios; /* Pointer to io system information. */ int ierr; /* Return code from function calls. */ @@ -753,8 +760,9 @@ int PIOc_set_chunk_cache(int iosysid, int iotype, PIO_Offset size, PIO_Offset ne * @ingroup PIO_def_var * @author Ed Hartnett */ -int PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset *nelemsp, - float *preemptionp) +int +PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset *nelemsp, + float *preemptionp) { iosystem_desc_t *ios; /* Pointer to io system information. */ int ierr; /* Return code from function calls. */ @@ -872,8 +880,9 @@ int PIOc_get_chunk_cache(int iosysid, int iotype, PIO_Offset *sizep, PIO_Offset * @ingroup PIO_def_var * @author Ed Hartnett */ -int PIOc_set_var_chunk_cache(int ncid, int varid, PIO_Offset size, PIO_Offset nelems, - float preemption) +int +PIOc_set_var_chunk_cache(int ncid, int varid, PIO_Offset size, PIO_Offset nelems, + float preemption) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -958,8 +967,9 @@ int PIOc_set_var_chunk_cache(int ncid, int varid, PIO_Offset size, PIO_Offset ne * @ingroup PIO_inq_var * @author Ed Hartnett */ -int PIOc_get_var_chunk_cache(int ncid, int varid, PIO_Offset *sizep, PIO_Offset *nelemsp, - float *preemptionp) +int +PIOc_get_var_chunk_cache(int ncid, int varid, PIO_Offset *sizep, PIO_Offset *nelemsp, + float *preemptionp) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ diff --git a/src/clib/pioc.c b/src/clib/pioc.c index 3f05065e3cc..267d6fa46b9 100644 --- a/src/clib/pioc.c +++ b/src/clib/pioc.c @@ -4,9 +4,8 @@ * @author Jim Edwards * @date 2014 * - * @see http://code.google.com/p/parallelio/ + * @see https://github.com/NCAR/ParallelIO */ - #include #include #include @@ -18,15 +17,15 @@ int default_error_handler = PIO_INTERNAL_ERROR; * used (see pio_sc.c). */ extern int blocksize; -/* Used when assiging decomposition IDs. */ +/** Used when assiging decomposition IDs. */ int pio_next_ioid = 512; -struct sort_map{ +/** Sort map. */ +struct sort_map { int remap; PIO_Offset map; }; - /** * Check to see if PIO has been initialized. * @@ -36,7 +35,8 @@ struct sort_map{ * @returns 0 on success, error code otherwise * @author Jim Edwards */ -int PIOc_iosystem_is_active(int iosysid, bool *active) +int +PIOc_iosystem_is_active(int iosysid, bool *active) { iosystem_desc_t *ios; @@ -61,7 +61,8 @@ int PIOc_iosystem_is_active(int iosysid, bool *active) * @returns 1 if file is open, 0 otherwise. * @author Jim Edwards */ -int PIOc_File_is_Open(int ncid) +int +PIOc_File_is_Open(int ncid) { file_desc_t *file; @@ -88,7 +89,8 @@ int PIOc_File_is_Open(int ncid) * @ingroup PIO_error_method * @author Jim Edwards */ -int PIOc_Set_File_Error_Handling(int ncid, int method) +int +PIOc_Set_File_Error_Handling(int ncid, int method) { file_desc_t *file; int oldmethod; @@ -119,7 +121,8 @@ int PIOc_Set_File_Error_Handling(int ncid, int method) * @returns 0 on success, error code otherwise * @author Jim Edwards, Ed Hartnett */ -int PIOc_advanceframe(int ncid, int varid) +int +PIOc_advanceframe(int ncid, int varid) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -179,7 +182,8 @@ int PIOc_advanceframe(int ncid, int varid) * @ingroup PIO_setframe * @author Jim Edwards, Ed Hartnett */ -int PIOc_setframe(int ncid, int varid, int frame) +int +PIOc_setframe(int ncid, int varid, int frame) { iosystem_desc_t *ios; /* Pointer to io system information. */ file_desc_t *file; /* Pointer to file information. */ @@ -240,7 +244,8 @@ int PIOc_setframe(int ncid, int varid, int frame) * @returns 0 on success, error code otherwise * @author Ed Hartnett */ -int PIOc_get_numiotasks(int iosysid, int *numiotasks) +int +PIOc_get_numiotasks(int iosysid, int *numiotasks) { iosystem_desc_t *ios; @@ -260,7 +265,8 @@ int PIOc_get_numiotasks(int iosysid, int *numiotasks) * @returns the size of the array. * @author Jim Edwards */ -int PIOc_get_local_array_size(int ioid) +int +PIOc_get_local_array_size(int ioid) { io_desc_t *iodesc; @@ -282,7 +288,8 @@ int PIOc_get_local_array_size(int ioid) * @ingroup PIO_error_method * @author Jim Edwards */ -int PIOc_Set_IOSystem_Error_Handling(int iosysid, int method) +int +PIOc_Set_IOSystem_Error_Handling(int iosysid, int method) { iosystem_desc_t *ios; int oldmethod; @@ -312,7 +319,8 @@ int PIOc_Set_IOSystem_Error_Handling(int iosysid, int method) * @ingroup PIO_error_method * @author Jim Edwards, Ed Hartnett */ -int PIOc_set_iosystem_error_handling(int iosysid, int method, int *old_method) +int +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. */ @@ -368,16 +376,25 @@ int PIOc_set_iosystem_error_handling(int iosysid, int method, int *old_method) return PIO_NOERR; } -int compare( const void* a, const void* b) +/** + * Compare. + * + * @param a pointer to a + * @param b pointer to b + * @return -1 if a.map < b.map, 1 if a.map > b.map, 0 if equal + * @author Jim Edwards + */ +int +compare( const void* a, const void* b) { - struct sort_map l_a = * ( (struct sort_map *) a ); - struct sort_map l_b = * ( (struct sort_map *) b ); - - if ( l_a.map < l_b.map ) - return -1; - else if ( l_a.map > l_b.map ) - return 1; - return 0; + struct sort_map l_a = * ( (struct sort_map *) a ); + struct sort_map l_b = * ( (struct sort_map *) b ); + + if ( l_a.map < l_b.map ) + return -1; + else if ( l_a.map > l_b.map ) + return 1; + return 0; } @@ -426,9 +443,10 @@ int compare( const void* a, const void* b) * @ingroup PIO_initdecomp * @author Jim Edwards, Ed Hartnett */ -int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen, - const PIO_Offset *compmap, int *ioidp, const int *rearranger, - const PIO_Offset *iostart, const PIO_Offset *iocount) +int +PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen, + const PIO_Offset *compmap, int *ioidp, const int *rearranger, + const PIO_Offset *iostart, const PIO_Offset *iocount) { iosystem_desc_t *ios; /* Pointer to io system information. */ io_desc_t *iodesc; /* The IO description. */ @@ -519,43 +537,43 @@ int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, in iodesc->remap = NULL; for (int m = 0; m < maplen; m++) { - if(m > 0 && compmap[m] > 0 && compmap[m] < compmap[m-1]) - { - iodesc->needssort = true; + 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])); - break; - } + break; + } } if (iodesc->needssort) { - struct sort_map *tmpsort; + struct sort_map *tmpsort; - if (!(tmpsort = malloc(sizeof(struct sort_map) * maplen))) - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); - if (!(iodesc->remap = malloc(sizeof(int) * maplen))) + if (!(tmpsort = malloc(sizeof(struct sort_map) * maplen))) + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + if (!(iodesc->remap = malloc(sizeof(int) * maplen))) { free(tmpsort); - return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + return pio_err(ios, NULL, PIO_ENOMEM, __FILE__, __LINE__); + } + for (int m=0; m < maplen; m++) + { + tmpsort[m].remap = m; + tmpsort[m].map = compmap[m]; } - for (int m=0; m < maplen; m++) - { - tmpsort[m].remap = m; - tmpsort[m].map = compmap[m]; - } - qsort( tmpsort, maplen, sizeof(struct sort_map), compare ); - for (int m=0; m < maplen; m++) - { - iodesc->map[m] = compmap[tmpsort[m].remap]; - iodesc->remap[m] = tmpsort[m].remap; - } - free(tmpsort); + qsort( tmpsort, maplen, sizeof(struct sort_map), compare ); + for (int m=0; m < maplen; m++) + { + iodesc->map[m] = compmap[tmpsort[m].remap]; + iodesc->remap[m] = tmpsort[m].remap; + } + free(tmpsort); } else { - for (int m=0; m < maplen; m++) - { - iodesc->map[m] = compmap[m]; - } + for (int m=0; m < maplen; m++) + { + iodesc->map[m] = compmap[m]; + } } /* Remember the dim sizes. */ if (!(iodesc->dimlen = malloc(sizeof(int) * ndims))) @@ -689,9 +707,10 @@ int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, in * @ingroup PIO_initdecomp * @author Jim Edwards, Ed Hartnett */ -int PIOc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen, - const PIO_Offset *compmap, int *ioidp, int rearranger, - const PIO_Offset *iostart, const PIO_Offset *iocount) +int +PIOc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen, int maplen, + const PIO_Offset *compmap, int *ioidp, int rearranger, + const PIO_Offset *iostart, const PIO_Offset *iocount) { PIO_Offset *compmap_1_based; int *rearrangerp = NULL; @@ -741,8 +760,9 @@ int PIOc_init_decomp(int iosysid, int pio_type, int ndims, const int *gdimlen, i * @ingroup PIO_initdecomp * @author Jim Edwards */ -int PIOc_InitDecomp_bc(int iosysid, int pio_type, int ndims, const int *gdimlen, - const long int *start, const long int *count, int *ioidp) +int +PIOc_InitDecomp_bc(int iosysid, int pio_type, int ndims, const int *gdimlen, + const long int *start, const long int *count, int *ioidp) { iosystem_desc_t *ios; @@ -844,8 +864,9 @@ int PIOc_InitDecomp_bc(int iosysid, int pio_type, int ndims, const int *gdimlen, * @ingroup PIO_init * @author Jim Edwards, Ed Hartnett */ -int PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, - int rearr, int *iosysidp) +int +PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int base, + int rearr, int *iosysidp) { iosystem_desc_t *ios; int ustride; @@ -998,10 +1019,11 @@ int PIOc_Init_Intracomm(MPI_Comm comp_comm, int num_iotasks, int stride, int bas * @returns 0 for success, error code otherwise * @author Jim Edwards */ -int PIOc_Init_Intracomm_from_F90(int f90_comp_comm, - const int num_iotasks, const int stride, - const int base, const int rearr, - rearr_opt_t *rearr_opts, int *iosysidp) +int +PIOc_Init_Intracomm_from_F90(int f90_comp_comm, + const int num_iotasks, const int stride, + const int base, const int rearr, + rearr_opt_t *rearr_opts, int *iosysidp) { int ret = PIO_NOERR; ret = PIOc_Init_Intracomm(MPI_Comm_f2c(f90_comp_comm), num_iotasks, @@ -1037,7 +1059,8 @@ int PIOc_Init_Intracomm_from_F90(int f90_comp_comm, * @returns 0 for success, or PIO_BADID if iosysid can't be found. * @author Jim Edwards, Ed Hartnett */ -int PIOc_set_hint(int iosysid, const char *hint, const char *hintval) +int +PIOc_set_hint(int iosysid, const char *hint, const char *hintval) { iosystem_desc_t *ios; int mpierr; /* Return value for MPI calls. */ @@ -1074,7 +1097,8 @@ int PIOc_set_hint(int iosysid, const char *hint, const char *hintval) * @ingroup PIO_finalize * @author Jim Edwards, Ed Hartnett */ -int PIOc_finalize(int iosysid) +int +PIOc_finalize(int iosysid) { iosystem_desc_t *ios; int niosysid; /* The number of currently open IO systems. */ @@ -1184,7 +1208,8 @@ int PIOc_finalize(int iosysid) * @returns 0 for success, or PIO_BADID if iosysid can't be found. * @author Jim Edwards */ -int PIOc_iam_iotask(int iosysid, bool *ioproc) +int +PIOc_iam_iotask(int iosysid, bool *ioproc) { iosystem_desc_t *ios; @@ -1207,7 +1232,8 @@ int PIOc_iam_iotask(int iosysid, bool *ioproc) * @returns 0 for success, or PIO_BADID if iosysid can't be found. * @author Jim Edwards */ -int PIOc_iotask_rank(int iosysid, int *iorank) +int +PIOc_iotask_rank(int iosysid, int *iorank) { iosystem_desc_t *ios; @@ -1227,7 +1253,8 @@ int PIOc_iotask_rank(int iosysid, int *iorank) * @returns 1 if iotype is in build, 0 if not. * @author Jim Edwards */ -int PIOc_iotype_available(int iotype) +int +PIOc_iotype_available(int iotype) { switch(iotype) { @@ -1327,10 +1354,11 @@ int PIOc_iotype_available(int iotype) * @ingroup PIO_init * @author Ed Hartnett */ -int PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, - int component_count, int *num_procs_per_comp, int **proc_list, - MPI_Comm *user_io_comm, MPI_Comm *user_comp_comm, int rearranger, - int *iosysidp) +int +PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, + int component_count, int *num_procs_per_comp, int **proc_list, + MPI_Comm *user_io_comm, MPI_Comm *user_comp_comm, int rearranger, + int *iosysidp) { int my_rank; /* Rank of this task. */ int **my_proc_list; /* Array of arrays of procs for comp components. */ @@ -1672,7 +1700,8 @@ int PIOc_init_async(MPI_Comm world, int num_io_procs, int *io_proc_list, * @ingroup PIO_set_blocksize * @author Jim Edwards */ -int PIOc_set_blocksize(int newblocksize) +int +PIOc_set_blocksize(int newblocksize) { if (newblocksize > 0) blocksize = newblocksize; diff --git a/src/clib/pioc_support.c b/src/clib/pioc_support.c index 9358ea9848c..ebebe1f0e3e 100644 --- a/src/clib/pioc_support.c +++ b/src/clib/pioc_support.c @@ -11,8 +11,13 @@ #include +/** This is used with text decomposition files. */ #define VERSNO 2001 +/** In decomposition files, backtraces are included. This is the max + * number of trace levels that will be used. */ +#define MAX_BACKTRACE 10 + /* Some logging constants. */ #if PIO_ENABLE_LOGGING #define MAX_LOG_MSG 1024 @@ -1293,7 +1298,6 @@ pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode, /* Write an attribute with the stack trace. This can be helpful * for debugging. */ -#define MAX_BACKTRACE 10 void *bt[MAX_BACKTRACE]; size_t bt_size; char **bt_strings; diff --git a/src/flib/pio_kinds.F90 b/src/flib/pio_kinds.F90 index 98006f4eada..856eb420213 100644 --- a/src/flib/pio_kinds.F90 +++ b/src/flib/pio_kinds.F90 @@ -30,18 +30,18 @@ module pio_kinds ! !DEFINED PARAMETERS: integer, parameter, public :: & - char_len = 360 ,& - log_kind = kind(.true.) ,& - int_kind = kind(1) ,& - i4 = selected_int_kind(6) ,& - i8 = selected_int_kind(13) ,& - r4 = selected_real_kind(6) ,& - r8 = selected_real_kind(13) + char_len = 360 ,& !< char len + log_kind = kind(.true.) ,& !< logical kind + int_kind = kind(1) ,& !< int kind + i4 = selected_int_kind(6) ,& !< i4 kind + i8 = selected_int_kind(13) ,& !< i8 kind + r4 = selected_real_kind(6) ,& !< r4 kind + r8 = selected_real_kind(13) !< r8 kind ! ! MPI defines MPI_OFFSET_KIND as the byte size of the ! type, which is not nessasarily the type kind ! - +!> Byte size of the MPI_OFFSET type. integer, parameter, public :: PIO_OFFSET_KIND=MPI_OFFSET_KIND !EOP diff --git a/src/flib/pio_nf.F90 b/src/flib/pio_nf.F90 index 1b19beec4b9..e7f19acb00d 100644 --- a/src/flib/pio_nf.F90 +++ b/src/flib/pio_nf.F90 @@ -281,7 +281,7 @@ end function inq_dimid_id !! @ingroup PIO_inquire_dimension !! @brief Get information about a particular dimension in netcdf file !! @details -!! @param ncid : A netcdf file descriptor returned by \ref PIO_openfile or \ref PIO_createfile. +!! @param file : A netcdf file descriptor returned by \ref PIO_openfile or \ref PIO_createfile. !! @param dimid : The netcdf dimension ID. !! @param name : The name of the dimension. !! @param len : The length of the dimesions name. @@ -390,7 +390,7 @@ end function inq_dimlen_id_long !! @details !! @param File @copydoc file_desc_t !! @param dimid : The netcdf dimension ID. -!! @param len : The length of the dimesion. +!! @param name : The name of the dimesion. !! @retval ierr @copydoc error_return !< integer function inq_dimname_desc(File , dimid, name) result(ierr) @@ -813,7 +813,7 @@ end function def_dim_id !! @ingroup PIO_inquire_variable !! @brief Inquires if a NetCDF variable is present and returns its attributes !! @details -!! @param ncid : A netcdf file descriptor returned by \ref PIO_openfile or \ref PIO_createfile. +!! @param file : A netcdf file descriptor returned by \ref PIO_openfile or \ref PIO_createfile. !! @param vardesc @copydoc var_desc_t !! @param name : The name of the variable !! @param xtype : The type of the variable diff --git a/src/flib/pio_support.F90 b/src/flib/pio_support.F90 index fe0fde0b59e..22ea9d4d875 100644 --- a/src/flib/pio_support.F90 +++ b/src/flib/pio_support.F90 @@ -20,9 +20,9 @@ module pio_support public :: pio_writedof public :: replace_c_null - logical, public :: Debug=.FALSE. - logical, public :: DebugIO=.FALSE. - logical, public :: DebugAsync=.FALSE. + logical, public :: Debug=.FALSE. !< debug mode + logical, public :: DebugIO=.FALSE. !< IO debug mode + logical, public :: DebugAsync=.FALSE. !< async debug mode integer,private,parameter :: versno = 1001 character(len=*), parameter :: modName='pio_support' diff --git a/src/flib/pio_types.F90 b/src/flib/pio_types.F90 index 1e8fb9532e4..27d0f1bb1ca 100644 --- a/src/flib/pio_types.F90 +++ b/src/flib/pio_types.F90 @@ -102,16 +102,16 @@ module pio_types !! - PIO_iotype_netcdf4p : parallel read/write of NETCDF4 (HDF5) files !> integer(i4), public, parameter :: & - PIO_iotype_pnetcdf = 1, & ! parallel read/write of pNetCDF files - PIO_iotype_netcdf = 2, & ! serial read/write of NetCDF file using 'base_node' - PIO_iotype_netcdf4c = 3, & ! netcdf4 (hdf5 format) file opened for compression (serial write access only) - PIO_iotype_netcdf4p = 4 ! netcdf4 (hdf5 format) file opened in parallel (all netcdf4 files for read will be opened this way) + PIO_iotype_pnetcdf = 1, & !< parallel read/write of pNetCDF files + PIO_iotype_netcdf = 2, & !< serial read/write of NetCDF file using 'base_node' + PIO_iotype_netcdf4c = 3, & !< netcdf4 (hdf5 format) file opened for compression (serial write access only) + PIO_iotype_netcdf4p = 4 !< netcdf4 (hdf5 format) file opened in parallel (all netcdf4 files for read will be opened this way) ! These are for backward compatability and should not be used or expanded upon integer(i4), public, parameter :: & - iotype_pnetcdf = PIO_iotype_pnetcdf, & - iotype_netcdf = PIO_iotype_netcdf + iotype_pnetcdf = PIO_iotype_pnetcdf, & !< pnetcdf iotype + iotype_netcdf = PIO_iotype_netcdf !< netcdf iotype !> @@ -124,8 +124,8 @@ module pio_types !! - PIO_rearr_subset : Use a PIO internal subsetting rearrangement !> - integer(i4), public, parameter :: PIO_rearr_box = 1 - integer(i4), public, parameter :: PIO_rearr_subset = 2 + integer(i4), public, parameter :: PIO_rearr_box = 1 !< box rearranger + integer(i4), public, parameter :: PIO_rearr_subset = 2 !< subset rearranger !> !! @public @@ -136,9 +136,9 @@ module pio_types !! - PIO_BCAST_ERROR : broadcast an error from io_rank 0 to all tasks in comm !! - PIO_RETURN_ERROR : do nothing - allow the user to handle it !< - integer(i4), public, parameter :: PIO_INTERNAL_ERROR = -51 - integer(i4), public, parameter :: PIO_BCAST_ERROR = -52 - integer(i4), public, parameter :: PIO_RETURN_ERROR = -53 + integer(i4), public, parameter :: PIO_INTERNAL_ERROR = -51 !< abort on error from any task + integer(i4), public, parameter :: PIO_BCAST_ERROR = -52 !< broadcast an error + integer(i4), public, parameter :: PIO_RETURN_ERROR = -53 !< do nothing !> !! @public @@ -146,7 +146,7 @@ module pio_types !! @details !! Use this instead of ios to set error handling for the library. !< - integer(i4), public, parameter :: PIO_DEFAULT = -1 + integer(i4), public, parameter :: PIO_DEFAULT = -1 !< default error handler !> !! @public @@ -173,69 +173,69 @@ module pio_types !< #ifdef _PNETCDF #include /* _EXTERNAL */ - integer, public, parameter :: PIO_global = nf_global - integer, public, parameter :: PIO_unlimited = nf_unlimited - integer, public, parameter :: PIO_double = nf_double - integer, public, parameter :: PIO_real = nf_real - integer, public, parameter :: PIO_int = nf_int - integer, public, parameter :: PIO_char = nf_char - integer, public, parameter :: PIO_noerr = nf_noerr - integer, public, parameter :: PIO_WRITE = nf_write - integer, public, parameter :: PIO_nowrite = nf_nowrite - integer, public, parameter :: PIO_CLOBBER = nf_clobber - integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber - integer, public, parameter :: PIO_NOFILL = nf_nofill - integer, public, parameter :: PIO_MAX_NAME = nf_max_name - integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) - integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset - integer, public, parameter :: PIO_64BIT_DATA = nf_64bit_data - integer, public, parameter :: PIO_FILL_INT = nf_fill_int; - real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; - double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; + integer, public, parameter :: PIO_global = nf_global !< global atts + integer, public, parameter :: PIO_unlimited = nf_unlimited !< unlimited dimension + integer, public, parameter :: PIO_double = nf_double !< double type + integer, public, parameter :: PIO_real = nf_real !< real type + integer, public, parameter :: PIO_int = nf_int !< int type + integer, public, parameter :: PIO_char = nf_char !< char type + integer, public, parameter :: PIO_noerr = nf_noerr !< no error + integer, public, parameter :: PIO_WRITE = nf_write !< read-write + integer, public, parameter :: PIO_nowrite = nf_nowrite !< read-only + integer, public, parameter :: PIO_CLOBBER = nf_clobber !< clobber existing file + integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber !< do not clobber existing file + integer, public, parameter :: PIO_NOFILL = nf_nofill !< do not use fill values + integer, public, parameter :: PIO_MAX_NAME = nf_max_name !< max name len + integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) !< max dims for a var + integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset !< 64bit offset format + integer, public, parameter :: PIO_64BIT_DATA = nf_64bit_data !< CDF5 format + integer, public, parameter :: PIO_FILL_INT = nf_fill_int; !< int fill value + real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; !< float fill value + double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; !< double fill value #else #ifdef _NETCDF #include /* _EXTERNAL */ - integer, public, parameter :: PIO_global = nf_global - integer, public, parameter :: PIO_unlimited = nf_unlimited - integer, public, parameter :: PIO_double = nf_double - integer, public, parameter :: PIO_real = nf_real - integer, public, parameter :: PIO_int = nf_int - integer, public, parameter :: PIO_char = nf_char - integer, public, parameter :: PIO_noerr = nf_noerr - integer, public, parameter :: PIO_WRITE = nf_write - integer, public, parameter :: PIO_nowrite = nf_nowrite - integer, public, parameter :: PIO_CLOBBER = nf_clobber - integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber - integer, public, parameter :: PIO_NOFILL = nf_nofill - integer, public, parameter :: PIO_MAX_NAME = nf_max_name - integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) - integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset - integer, public, parameter :: PIO_64BIT_DATA = 0 - integer, public, parameter :: PIO_FILL_INT = nf_fill_int; - real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; - double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; + integer, public, parameter :: PIO_global = nf_global !< global atts + integer, public, parameter :: PIO_unlimited = nf_unlimited !< unlimited dimension + integer, public, parameter :: PIO_double = nf_double !< double type + integer, public, parameter :: PIO_real = nf_real !< real type + integer, public, parameter :: PIO_int = nf_int !< int type + integer, public, parameter :: PIO_char = nf_char !< char type + integer, public, parameter :: PIO_noerr = nf_noerr !< no error + integer, public, parameter :: PIO_WRITE = nf_write !< read-write + integer, public, parameter :: PIO_nowrite = nf_nowrite !< read-only + integer, public, parameter :: PIO_CLOBBER = nf_clobber !< clobber existing file + integer, public, parameter :: PIO_NOCLOBBER = nf_NOclobber !< do not clobber existing file + integer, public, parameter :: PIO_NOFILL = nf_nofill !< do not use fill values + integer, public, parameter :: PIO_MAX_NAME = nf_max_name !< max name len + integer, public, parameter :: PIO_MAX_VAR_DIMS = min(6,nf_max_var_dims) !< max dims for a var + integer, public, parameter :: PIO_64BIT_OFFSET = nf_64bit_offset !< 64bit offset format + integer, public, parameter :: PIO_64BIT_DATA = 0 !< CDF5 format + integer, public, parameter :: PIO_FILL_INT = nf_fill_int; !< int fill value + real, public, parameter :: PIO_FILL_FLOAT = nf_fill_float; !< float fill value + double precision, public, parameter :: PIO_FILL_DOUBLE = nf_fill_double; !< double fill value #else - integer, public, parameter :: PIO_global = 0 - integer, public, parameter :: PIO_double = 6 - integer, public, parameter :: PIO_real = 5 - integer, public, parameter :: PIO_int = 4 - integer, public, parameter :: PIO_char = 2 - integer, public, parameter :: PIO_noerr = 0 - integer, public, parameter :: PIO_MAX_NAME = 25 - integer, public, parameter :: PIO_MAX_VAR_DIMS = 6 - integer, public, parameter :: PIO_CLOBBER = 10 - integer, public, parameter :: PIO_NOCLOBBER = 11 - integer, public, parameter :: PIO_WRITE = 20 - integer, public, parameter :: PIO_NOWRITE = 21 - integer, public, parameter :: PIO_64BIT_OFFSET = 0 - integer, public, parameter :: PIO_64BIT_DATA = 0 - integer, public, parameter :: PIO_FILL_INT = -2147483647; - real, public, parameter :: PIO_FILL_FLOAT = 9.9692099683868690e+36; - double precision, public, parameter :: PIO_FILL_DOUBLE = 9.9692099683868690e+36; + integer, public, parameter :: PIO_global = 0 !< global atts + integer, public, parameter :: PIO_double = 6 !< double type + integer, public, parameter :: PIO_real = 5 !< real type + integer, public, parameter :: PIO_int = 4 !< int type + integer, public, parameter :: PIO_char = 2 !< char type + integer, public, parameter :: PIO_noerr = 0 !< no error + integer, public, parameter :: PIO_MAX_NAME = 25 !< max name len + integer, public, parameter :: PIO_MAX_VAR_DIMS = 6 !< max dims for a var + integer, public, parameter :: PIO_CLOBBER = 10 !< clobber existing file + integer, public, parameter :: PIO_NOCLOBBER = 11 !< do not clobber existing file + integer, public, parameter :: PIO_WRITE = 20 !< read-write + integer, public, parameter :: PIO_NOWRITE = 21 !< read-only + integer, public, parameter :: PIO_64BIT_OFFSET = 0 !< 64bit offset format + integer, public, parameter :: PIO_64BIT_DATA = 0 !< CDF5 format + integer, public, parameter :: PIO_FILL_INT = -2147483647; !< int fill value + real, public, parameter :: PIO_FILL_FLOAT = 9.9692099683868690e+36; !< float fill value + double precision, public, parameter :: PIO_FILL_DOUBLE = 9.9692099683868690e+36; !< double fill value #endif #endif - integer, public, parameter :: PIO_num_OST = 16 + integer, public, parameter :: PIO_num_OST = 16 !< num ost !> !! @defgroup PIO_rearr_comm_t PIO_rearr_comm_t @@ -282,7 +282,7 @@ module pio_types integer(c_int) :: max_pend_req ! Maximum pending requests end type PIO_rearr_comm_fc_opt_t - integer, public, parameter :: PIO_REARR_COMM_UNLIMITED_PEND_REQ = -1 + integer, public, parameter :: PIO_REARR_COMM_UNLIMITED_PEND_REQ = -1 !< unlimited requests !> !! @defgroup PIO_rearr_options PIO_rearr_options !! @brief Type that defines the PIO rearranger options diff --git a/src/flib/piodarray.F90.in b/src/flib/piodarray.F90.in index ef49be8be57..c03f85529ca 100644 --- a/src/flib/piodarray.F90.in +++ b/src/flib/piodarray.F90.in @@ -2,7 +2,6 @@ !> !! @file !! @brief Read and write routines for decomposed data. -!< module piodarray use pio_types, only : file_desc_t, io_desc_t, var_desc_t use pio_kinds, only : i4, r4, r8, pio_offset_kind @@ -88,7 +87,7 @@ end interface contains - + !> Set buffer size limit. subroutine pio_set_buffer_size_limit(limit) integer(PIO_OFFSET_KIND), intent(in) :: limit integer(PIO_OFFSET_KIND) :: oldval @@ -107,6 +106,7 @@ contains end subroutine pio_set_buffer_size_limit ! TYPE real,int,double + !> 1D write_darray for type {TYPE}. subroutine write_darray_1d_cinterface_{TYPE} (File,varDesc,ioDesc, arraylen, array, iostat, fillval) use iso_c_binding ! !DESCRIPTION: @@ -151,6 +151,7 @@ contains end subroutine write_darray_1d_cinterface_{TYPE} ! TYPE real,int,double + !> 1D write_darray_multi for type {TYPE}. subroutine write_darray_multi_1d_cinterface_{TYPE} (File,varDesc,ioDesc,nvars,arraylen, array, iostat, fillval) use iso_c_binding ! !DESCRIPTION: @@ -373,7 +374,7 @@ contains end subroutine read_darray_{DIMS}d_{TYPE} ! TYPE real,int,double - + !> Internal read_darray for type {TYPE} subroutine read_darray_internal_{TYPE} (ncid, varid, ioid, alen, array, iostat) use iso_c_binding ! !DESCRIPTION: diff --git a/src/flib/piolib_mod.F90 b/src/flib/piolib_mod.F90 index e6bb1a07d0c..248d54ff763 100644 --- a/src/flib/piolib_mod.F90 +++ b/src/flib/piolib_mod.F90 @@ -277,7 +277,8 @@ end function PIO_get_local_array_size !! @brief advances the record dimension of a variable in a netcdf format file !! or the block address in a binary file !! @details -!! @param[in,out] vardesc @copybrief var_desc_t +!! @param File @copydoc file_desc_t +!! @param vardesc @copybrief var_desc_t !< subroutine advanceframe(file, vardesc) type(file_desc_t), intent(in) :: file @@ -301,6 +302,7 @@ end subroutine advanceframe !! @brief sets the record dimension of a variable in a netcdf format file !! or the block address in a binary file !! @details +!! @param File @copydoc file_desc_t !! @param vardesc @copydoc var_desc_t !! @param frame : frame number to set !< @@ -731,10 +733,11 @@ end subroutine initdecomp_1dof_nf_i8 !! @param dims An array of the global length of each dimesion of the variable(s) !! @param compdof Mapping of the storage order for the computational decomposition to its memory order !! @param iodesc @copydoc iodesc_generate +!! @param rearr rearranger !! @param iostart The start index for the block-cyclic io decomposition !! @param iocount The count for the block-cyclic io decomposition !< - subroutine PIO_initdecomp_dof_i4(iosystem,basepiotype,dims,compdof, iodesc, rearr, iostart, iocount) + subroutine PIO_initdecomp_dof_i4(iosystem, basepiotype, dims, compdof, iodesc, rearr, iostart, iocount) type (iosystem_desc_t), intent(inout) :: iosystem integer(i4), intent(in) :: basepiotype integer(i4), intent(in) :: compdof(:) ! global degrees of freedom for computational decomposition @@ -825,6 +828,7 @@ end function PIOc_InitDecomp end subroutine PIO_initdecomp_internal +!> I8 version of PIO_initdecomp_dof_i4. subroutine PIO_initdecomp_dof_i8(iosystem,basepiotype,dims,compdof, iodesc, rearr, iostart, iocount) type (iosystem_desc_t), intent(in) :: iosystem integer(i4), intent(in) :: basepiotype @@ -865,6 +869,7 @@ end subroutine PIO_initdecomp_dof_i8 !! @param rearr @copydoc PIO_rearr_method !! @param iosystem a derived type which can be used in subsequent pio operations (defined in PIO_types). !! @param base @em optional argument can be used to offset the first io task - default base is task 1. +!! @param rearr_opts the rearranger options. !< subroutine init_intracom(comp_rank, comp_comm, num_iotasks, num_aggregator, stride, rearr, iosystem,base, rearr_opts) use pio_types, only : pio_internal_error, pio_rearr_opt_t @@ -1150,7 +1155,6 @@ end subroutine init_intercom !! @param hint the string name of the hint to define !! @param hintval the string value to set the hint to !! @retval ierr @copydoc error_return -!< subroutine PIO_set_hint(iosystem, hint, hintval) type (iosystem_desc_t), intent(inout) :: iosystem ! io descriptor to initalize character(len=*), intent(in) :: hint, hintval @@ -1220,6 +1224,7 @@ end function PIOc_get_numiotasks end subroutine getnumiotasks + !> Is an iotype available? logical function pio_iotype_available( iotype) result(available) integer, intent(in) :: iotype interface @@ -1444,10 +1449,7 @@ end function PIOc_closefile end subroutine closefile - !****************************** - ! read_ascii - ! - + !> read_ascii subroutine read_ascii(rank,iobuf,size) integer, intent(in) :: rank