Fortran intent bug and API documentation errors
Brian Taylor
spam.brian.taylor at gmail.com
Tue Mar 14 14:18:03 CDT 2017
Hello,
The following code does not compile with parallel-netcdf 1.8.1:
$cat bug.f90
subroutine sub(iarg)
use pnetcdf
implicit none
integer, intent(in ) :: iarg
integer :: ncid, varid, ierr
ierr = nf90mpi_put_var(ncid, varid, iarg)
end subroutine
$mpif90 -c bug.f90
bug.f90:9:9:
ierr = nf90mpi_put_var(ncid, varid, iarg)
1
Error: There is no specific function for the generic 'nf90mpi_put_var' at
(1)
If the fifth line is changed to "integer, intent(inout) :: iarg", the code
compiles successfully. I assume this is a bug with the declared intent of
the "values" argument to nf90mpi_put_var in the pnetcdf module, which is
documented to be intent(in) according to <
http://cucis.ece.northwestern.edu/projects/PnetCDF/doc/pnetcdf-c/Summary-of-Fortran-90-Interface.html#Summary-of-Fortran-90-Interface>
but in the current parallel-netcdf library it appears to be intent(inout).
If "values" is actually supposed to be intent(inout), then the API
documentation should be updated to reflect this.
By the way, the API documentation referenced above has several other
errors. Most notably, several of the arguments are documented to be
default integers, but in current code they are actually
integer(kind=mpi_offset_kind). For example, the "start" and "count"
arguments to nf90mpi_put_var have this problem. It would be nice if the
documentation could be fixed.
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20170314/e349e824/attachment.html>
More information about the parallel-netcdf
mailing list