Parallel netCDF F90 bindings

Robert Latham robl at mcs.anl.gov
Wed Mar 12 10:33:02 CDT 2008


Hi Brian

I know you sent this to me a month ago, but I've been pretty busy and
haven't had a chance to look at this yet.  Let's see if the wider
parallel-netcdf mailing list has some feedback for you.


On Tue, Feb 12, 2008 at 09:27:50PM -0600, bdtaylo1 at uiuc.edu wrote:
> Mr. Latham,
> 
> Hello!  I am using the parallel netCDF library in a couple of
> Fortran 90 CFD codes I've written for my research.  I wrote a F90
> module that wraps a large portion of the F77 API provided by
> parallel netCDF library.  I have done my best to follow the serial
> netCDF F90 API in putting together this module.  I thought this
> might be of interest to you.
> 
> There are a good number of issues that need to be addressed, such as
> how to define the required constants (I just copied them out of
> "pnetcdf.inc"), the non- standard but widely supported usage of
> byte-storage variable specification (integer*1, integer*2, real*4,
> etc), and how to obtain the MPI_OFFSET_TYPE constant (either via
> configure/preprocessor tricks, via the "use mpi" statement as I have
> done, or via "include 'mpif.h'").  If you're interested, I can give
> you a complete rundown of the issues I've found.
> 
> Feel free to contact me if you have any questions or if I can be of
> further assistance.
> 
> Thanks, Brian Taylor

Thanks for the starting point.  Let's see if we can address the
remaining issues.  Has anybody else on this list roled their own f90
bindings?

==rob


-- 
Rob Latham
Mathematics and Computer Science Division    A215 0178 EA2D B059 8CDF
Argonne National Lab, IL USA                 B29D F333 664A 4280 315B
-------------- next part --------------
      module pnetcdf
      use mpi
      implicit none
      public
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! External netcdf data types:
      integer, parameter :: nf90mpi_byte = 1
      integer, parameter :: nf90mpi_int1 = nf90mpi_byte
      integer, parameter :: nf90mpi_char = 2
      integer, parameter :: nf90mpi_short = 3
      integer, parameter :: nf90mpi_int2 = nf90mpi_short
      integer, parameter :: nf90mpi_int = 4
      integer, parameter :: nf90mpi_float = 5
      integer, parameter :: nf90mpi_real = nf90mpi_float
      integer, parameter :: nf90mpi_double = 6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Default fill values:
      integer, parameter :: nf90mpi_fill_byte = -127
      integer, parameter :: nf90mpi_fill_int1 = nf90mpi_fill_byte
      integer, parameter :: nf90mpi_fill_char = 0
      integer, parameter :: nf90mpi_fill_short = -32767
      integer, parameter :: nf90mpi_fill_int2 = nf90mpi_fill_short
      integer, parameter :: nf90mpi_fill_int = -2147483647
      real, parameter :: nf90mpi_fill_float = 9.9692099683868690e+36
      real, parameter :: nf90mpi_fill_real = nf90mpi_fill_float
      double precision, parameter :: nf90mpi_fill_double =              &
     &    9.9692099683868690e+36
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Mode flags for opening and creating a netCDF dataset:
      integer, parameter :: nf90mpi_nowrite = 0
      integer, parameter :: nf90mpi_write = 1
      integer, parameter :: nf90mpi_clobber = 0
      integer, parameter :: nf90mpi_noclobber = 4
      integer, parameter :: nf90mpi_fill = 0
      integer, parameter :: nf90mpi_nofill = 256
      integer, parameter :: nf90mpi_lock = 1024
      integer, parameter :: nf90mpi_share = 2048
      integer, parameter :: nf90mpi_64bit_offset = 512
      integer, parameter :: nf90mpi_sizehint_default = 0
      integer, parameter :: nf90mpi_align_chunk = -1
      integer, parameter :: nf90mpi_format_classic = 1
      integer, parameter :: nf90mpi_format_64bit = 2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Size argument for defining an unlimited dimension:
      integer, parameter :: nf90mpi_unlimited = 0_MPI_OFFSET_KIND

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Global attribute id:
      integer, parameter :: nf90mpi_global = 0
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Implementation limits:
      integer, parameter :: nf90mpi_max_dims = 512
      integer, parameter :: nf90mpi_max_attrs = 4092
      integer, parameter :: nf90mpi_max_vars = 4096
      integer, parameter :: nf90mpi_max_name = 128
      integer, parameter :: nf90mpi_max_var_dims = nf90mpi_max_dims
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Error codes:
      integer, parameter :: nf90mpi_noerr = 0
      integer, parameter :: nf90mpi_esmall = -25
      integer, parameter :: nf90mpi_enotindep = -26
      integer, parameter :: nf90mpi_eindep = -27
      integer, parameter :: nf90mpi_efile = -28
      integer, parameter :: nf90mpi_eread = -29
      integer, parameter :: nf90mpi_ewrite = -30
      integer, parameter :: nf90mpi_emultidefine = -31
      integer, parameter :: nf90mpi_eofile = -32
      integer, parameter :: nf90mpi_ebadid = -33
      integer, parameter :: nf90mpi_enfile = -34
      integer, parameter :: nf90mpi_eexist = -35
      integer, parameter :: nf90mpi_einval = -36
      integer, parameter :: nf90mpi_eperm = -37
      integer, parameter :: nf90mpi_enotindefine = -38
      integer, parameter :: nf90mpi_eindefine = -39
      integer, parameter :: nf90mpi_einvalcoords = -40
      integer, parameter :: nf90mpi_emaxdims = -41
      integer, parameter :: nf90mpi_enameinuse = -42
      integer, parameter :: nf90mpi_enotatt = -43
      integer, parameter :: nf90mpi_emaxatts = -44
      integer, parameter :: nf90mpi_ebadtype = -45
      integer, parameter :: nf90mpi_ebaddim = -46
      integer, parameter :: nf90mpi_eunlimpos = -47
      integer, parameter :: nf90mpi_emaxvars = -48
      integer, parameter :: nf90mpi_enotvar = -49
      integer, parameter :: nf90mpi_eglobal = -50
      integer, parameter :: nf90mpi_enotnc = -51
      integer, parameter :: nf90mpi_ests = -52
      integer, parameter :: nf90mpi_emaxname = -53
      integer, parameter :: nf90mpi_eunlimit = -54
      integer, parameter :: nf90mpi_enorecvars = -55
      integer, parameter :: nf90mpi_echar = -56
      integer, parameter :: nf90mpi_eedge = -57
      integer, parameter :: nf90mpi_estride = -58
      integer, parameter :: nf90mpi_ebadname = -59
      integer, parameter :: nf90mpi_erange = -60
      integer, parameter :: nf90mpi_enomem = -61
      integer, parameter :: nf90mpi_evarsize = -62
      integer, parameter :: nf90mpi_edimsize = -63
      integer, parameter :: nf90mpi_emultitypes = -70
      integer, parameter :: nf90mpi_eiomismatch = -71
      integer, parameter :: nf90mpi_enegativecnt = -72
      integer, parameter :: nf90mpi_eunsptetype = -73
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Error handling modes:
      integer, parameter :: nf90mpi_fatal = 1
      integer, parameter :: nf90mpi_verbose = 2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Declare explicit interfaces for the Fortran 77 API and map them
! directly to the Fortran 90 API where possible. The goal is to
! provide as nearly a complete match to the netCDF Fortran 90
! interface as possible. Differences between the serial and parallel
! Fortran 90 interfaces are noted with each interface definition.
!
! Section numbers below correspond to the netCDF 3.6 documentation for
! the Fortran 90 interface.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.3
      interface nf90mpi_strerror
        function nfmpi_strerror(ncerr)
        integer, intent(in) :: ncerr
        character(len = 80) :: nfmpi_strerror
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.4
      interface nf90mpi_inq_libvers
        function nfmpi_inq_libvers()
        character(len = 80) :: nfmpi_inq_libvers
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.5: This function maps to "nf90mpi_create"
      interface
        function nfmpi_create(mpi_comm, path, cmode, mpi_info, ncid)
        integer,             intent(in)  :: mpi_comm
        character (len = *), intent(in)  :: path
        integer,             intent(in)  :: cmode
        integer,             intent(in)  :: mpi_info
        integer,             intent(out) :: ncid
        integer                          :: nfmpi_create
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.6: This function maps to "nf90mpi_open"
      interface
        function nfmpi_open(mpi_comm, path, omode, mpi_info, ncid)
        integer,             intent(in)  :: mpi_comm
        character (len = *), intent(in)  :: path
        integer,             intent(in)  :: omode
        integer,             intent(in)  :: mpi_info
        integer,             intent(out) :: ncid
        integer                          :: nfmpi_open
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.7
      interface nf90mpi_redef
        function nfmpi_redef(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_redef
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.8
! NOTE: The parallel netCDF interface does not have optional arguments,
!   unlike the serial netCDF interface.
      interface nf90mpi_enddef
        function nfmpi_enddef(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_enddef
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.9
      interface nf90mpi_close
        function nfmpi_close(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_close
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.10: These functions map to "nf90mpi_inquire"
! NOTE: The parallel netCDF interface does not support the optional
!   argument "format". The F77 interface to parallel netCDF does not
!   include the function "nfmpi_inq_format", so it is not possible to
!   support "format" in the F90 interface.
      interface
        function nfmpi_inq(ncid, ndims, nvars, ngatts, unlimdimid)
        integer, intent(in)  :: ncid
        integer, intent(out) :: ndims
        integer, intent(out) :: nvars
        integer, intent(out) :: ngatts
        integer, intent(out) :: unlimdimid
        integer :: nfmpi_inq
        end function

        function nfmpi_inq_ndims(ncid, ndims)
        integer, intent(in)  :: ncid
        integer, intent(out) :: ndims
        integer              :: nfmpi_inq_ndims
        end function

        function nfmpi_inq_nvars(ncid, nvars)
        integer, intent(in)  :: ncid
        integer, intent(out) :: nvars
        integer              :: nfmpi_inq_nvars
        end function

        function nfmpi_inq_natts(ncid, ngatts)
        integer, intent(in)  :: ncid
        integer, intent(out) :: ngatts
        integer              :: nfmpi_inq_natts
        end function

        function nfmpi_inq_unlimdim(ncid, unlimdimid)
        integer, intent(in)  :: ncid
        integer, intent(out) :: unlimdimid
        integer              :: nfmpi_inq_unlimdimid
        end function

!        function nfmpi_inq_format(ncid, format)
!        integer, intent(in)  :: ncid
!        integer, intent(out) :: format
!        integer              :: nfmpi_inq_format
!        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.11
      interface nf90mpi_sync
        function nfmpi_sync(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_sync
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.12
      interface nf90mpi_abort
        function nfmpi_abort(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_abort
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.13
      interface nf90mpi_set_fill
        function nfmpi_set_fill(ncid, fillmode, old_mode)
        integer, intent(in) :: ncid
        integer, intent(in) :: fillmode
        integer, intent(out) :: old_mode
        integer              :: nfmpi_set_fill
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 3.2
      interface nf90mpi_def_dim
        function nfmpi_def_dim(ncid, name, len, dimid)
        use mpi
        integer,                  intent(in)  :: ncid
        character(len = *),       intent(in)  :: name
        integer(MPI_OFFSET_KIND), intent(in)  :: len
        integer,                  intent(out) :: dimid
        integer                               :: nfmpi_def_dim
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 3.3
      interface nf90mpi_inq_dimid
        function nfmpi_inq_dimid(ncid, name, dimid)
        integer,            intent(in)  :: ncid
        character(len = *), intent(in)  :: name
        integer,            intent(out) :: dimid
        integer                         :: nfmpi_inq_dimid
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 3.4: These functions map to "nf90mpi_inquire_dimension"
      interface
        function nfmpi_inq_dim(ncid, dimid, name, len)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: dimid
        character(len = *),       intent(out) :: name
        integer(MPI_OFFSET_KIND), intent(out) :: len
        integer                               :: nfmpi_inq_dim
        end function

        function nfmpi_inq_dimname(ncid, dimid, name)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: dimid
        character(len = *), intent(out) :: name
        integer                         :: nfmpi_inq_dimname
        end function

        function nfmpi_inq_dimlen(ncid, dimid, len)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: dimid
        integer(MPI_OFFSET_KIND), intent(out) :: len
        integer                               :: nfmpi_inq_dimlen
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 3.5
      interface nf90mpi_rename_dim
        function nfmpi_rename_dim(ncid, dimid, name)
        integer,            intent(in) :: ncid
        integer,            intent(in) :: dimid
        character(len = *), intent(in) :: name
        integer                        :: nfmpi_rename_dim
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.3: This function maps to "nf90mpi_def_var"
      interface
        function nfmpi_def_var(ncid, name, xtype, nvdims, vdims, varid)
        integer,            intent(in)  :: ncid
        character(len = *), intent(in)  :: name
        integer,            intent(in)  :: xtype
        integer,            intent(in)  :: nvdims
        integer,            intent(in)  :: vdims(*)
        integer,            intent(out) :: varid
        integer                         :: nfmpi_def_var
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.4
      interface nf90mpi_inq_varid
        function nfmpi_inq_varid(ncid, name, varid)
        integer,            intent(in)  :: ncid
        character(len = *), intent(in)  :: name
        integer,            intent(out) :: varid
        integer                         :: nfmpi_inq_varid
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.5: These functions map to "nf90mpi_inquire_variable"
      interface
        function nfmpi_inq_var(ncid, varid, name, xtype, ndims, dimids, &
     &                         natts)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(out) :: name
        integer,            intent(out) :: xtype
        integer,            intent(out) :: ndims
        integer,            intent(out) :: dimids(*)
        integer,            intent(out) :: natts
        integer                         :: nfmpi_inq_var
        end function

        function nfmpi_inq_varname(ncid, varid, name)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(out) :: name
        integer                         :: nfmpi_inq_varname
        end function

        function nfmpi_inq_vartype(ncid, varid, xtype)
        integer, intent(in)  :: ncid
        integer, intent(in)  :: varid
        integer, intent(out) :: xtype
        integer              :: nfmpi_inq_vartype
        end function

        function nfmpi_inq_varndims(ncid, varid, ndims)
        integer, intent(in)  :: ncid
        integer, intent(in)  :: varid
        integer, intent(out) :: ndims
        integer              :: nfmpi_inq_varndims
        end function

        function nfmpi_inq_vardimid(ncid, varid, dimids)
        integer, intent(in)  :: ncid
        integer, intent(in)  :: varid
        integer, intent(out) :: dimids(*)
        integer              :: nfmpi_inq_vardimid
        end function

        function nfmpi_inq_varnatts(ncid, varid, natts)
        integer, intent(in)  :: ncid
        integer, intent(in)  :: varid
        integer, intent(out) :: natts
        integer              :: nfmpi_inq_varnatts
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.6: These functions map to "nf90mpi_put_var"
      interface nf90mpi_put_var1
        function nfmpi_put_var1_text(ncid, varid, index, chval)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        character(len = 1),       intent(in) :: chval
        integer                              :: nfmpi_put_var1_text
        end function

        function nfmpi_put_var1_int1(ncid, varid, index, i1val)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        integer*1,                intent(in) :: i1val
        integer                              :: nfmpi_put_var1_int1
        end function

        function nfmpi_put_var1_int2(ncid, varid, index, i2val)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        integer*2,                intent(in) :: i2val
        integer                              :: nfmpi_put_var1_int2
        end function

        function nfmpi_put_var1_int(ncid, varid, index, ival)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        integer*4,                intent(in) :: ival
        integer                              :: nfmpi_put_var1_int
        end function

        function nfmpi_put_var1_real(ncid, varid, index, rval)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        real*4,                   intent(in) :: rval
        integer                              :: nfmpi_put_var1_real
        end function

        function nfmpi_put_var1_double(ncid, varid, index, dval)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: index(*)
        real*8,                   intent(in) :: dval
        integer                              :: nfmpi_put_var1_double
        end function
      end interface

      interface nf90mpi_put_var
        function nfmpi_put_var_text(ncid, varid, text)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_var_text
        end function

        function nfmpi_put_var_int1(ncid, varid, i1vals)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_var_int1
        end function

        function nfmpi_put_var_int2(ncid, varid, i2vals)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_var_int2
        end function

        function nfmpi_put_var_int(ncid, varid, ivals)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_var_int
        end function

        function nfmpi_put_var_real(ncid, varid, rvals)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_var_real
        end function

        function nfmpi_put_var_double(ncid, varid, dvals)
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        real*8,                   intent(in) :: dvals(*)
        integer                              :: nfmpi_put_var_double
        end function
      end interface

      interface nf90mpi_put_vara
        function nfmpi_put_vara_text(ncid, varid, start, count, text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_vara_text
        end function

        function nfmpi_put_vara_int1(ncid, varid, start, count, i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_vara_int1
        end function

        function nfmpi_put_vara_int2(ncid, varid, start, count, i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_vara_int2
        end function

        function nfmpi_put_vara_int(ncid, varid, start, count, ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_vara_int
        end function

        function nfmpi_put_vara_real(ncid, varid, start, count, rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_vara_real
        end function

        function nfmpi_put_vara_double(ncid, varid, start, count, dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        real*8,                   intent(in) :: dvals(*)
        integer                              :: nfmpi_put_vara_double
        end function
      end interface

      interface nf90mpi_put_vars
        function nfmpi_put_vars_text(ncid, varid, start, count, stride, &
     &                               text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_vars_text
        end function

        function nfmpi_put_vars_int1(ncid, varid, start, count, stride, &
     &                               i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_vars_int1
        end function

        function nfmpi_put_vars_int2(ncid, varid, start, count, stride, &
     &                               i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_vars_int2
        end function

        function nfmpi_put_vars_int(ncid, varid, start, count, stride,  &
     &                              ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_vars_int
        end function

        function nfmpi_put_vars_real(ncid, varid, start, count, stride, &
     &                               rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_vars_real
        end function

        function nfmpi_put_vars_double(ncid, varid, start, count,       &
     &                                 stride, dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        real*8,                   intent(in) :: dvals(*)
        integer                              :: nfmpi_put_vars_double
        end function
      end interface

      interface nf90mpi_put_varm
        function nfmpi_put_varm_text(ncid, varid, start, count, stride, &
     &                               imap, text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_varm_text
        end function

        function nfmpi_put_varm_int1(ncid, varid, start, count, stride, &
     &                               imap, i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_varm_int1
        end function

        function nfmpi_put_varm_int2(ncid, varid, start, count, stride, &
     &                               imap, i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_varm_int2
        end function

        function nfmpi_put_varm_int(ncid, varid, start, count, stride,  &
     &                              imap, ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_varm_int
        end function

        function nfmpi_put_varm_real(ncid, varid, start, count, stride, &
     &                               imap, rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_varm_real
        end function

        function nfmpi_put_varm_double(ncid, varid, start, count,       &
     &                                 stride, imap, dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        real*8,                   intent(in) :: dvals(*)
        integer                              :: nfmpi_put_varm_double
        end function
      end interface

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.6: These functions map to "nfmpi_put_var", but are specific
!   to parallel netCDF and are for collective data mode output
      interface nf90mpi_put_vara_all
        function nfmpi_put_vara_text_all(ncid, varid, start, count,     &
     &                                   text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_vara_text_all
        end function

        function nfmpi_put_vara_int1_all(ncid, varid, start, count,     &
     &                                   i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_vara_int1_all
        end function

        function nfmpi_put_vara_int2_all(ncid, varid, start, count,     &
     &                                   i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_vara_int2_all
        end function

        function nfmpi_put_vara_int_all(ncid, varid, start, count,      &
     &                                  ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_vara_int_all
        end function

        function nfmpi_put_vara_real_all(ncid, varid, start, count,     &
     &                                   rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_vara_real_all
        end function

        function nfmpi_put_vara_double_all(ncid, varid, start, count,   &
     &                                     dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        real*8,                   intent(in) :: dvals(*)
        integer                             :: nfmpi_put_vara_double_all
        end function
      end interface

      interface nf90mpi_put_vars_all
        function nfmpi_put_vars_text_all(ncid, varid, start, count,     &
     &                                   stride, text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_vars_text_all
        end function

        function nfmpi_put_vars_int1_all(ncid, varid, start, count,     &
     &                                   stride, i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_vars_int1_all
        end function

        function nfmpi_put_vars_int2_all(ncid, varid, start, count,     &
     &                                   stride, i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_vars_int2_all
        end function

        function nfmpi_put_vars_int_all(ncid, varid, start, count,      &
     &                                  stride, ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_vars_int_all
        end function

        function nfmpi_put_vars_real_all(ncid, varid, start, count,     &
     &                                   stride, rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_vars_real_all
        end function

        function nfmpi_put_vars_double_all(ncid, varid, start, count,   &
     &                                 stride, dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        real*8,                   intent(in) :: dvals(*)
        integer                             :: nfmpi_put_vars_double_all
        end function
      end interface

      interface nf90mpi_put_varm_all
        function nfmpi_put_varm_text_all(ncid, varid, start, count,     &
     &                                   stride, imap, text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        character(len = *),       intent(in) :: text(*)
        integer                              :: nfmpi_put_varm_text_all
        end function

        function nfmpi_put_varm_int1_all(ncid, varid, start, count,     &
     &                                   stride, imap, i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_varm_int1_all
        end function

        function nfmpi_put_varm_int2_all(ncid, varid, start, count,     &
     &                                   stride, imap, i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_varm_int2_all
        end function

        function nfmpi_put_varm_int_all(ncid, varid, start, count,      &
     &                                  stride, imap, ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_varm_int_all
        end function

        function nfmpi_put_varm_real_all(ncid, varid, start, count,     &
     &                                   stride, imap, rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_varm_real_all
        end function

        function nfmpi_put_varm_double_all(ncid, varid, start, count,   &
     &                                 stride, imap, dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        integer(MPI_OFFSET_KIND), intent(in) :: start(*)
        integer(MPI_OFFSET_KIND), intent(in) :: count(*)
        integer(MPI_OFFSET_KIND), intent(in) :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in) :: imap(*)
        real*8,                   intent(in) :: dvals(*)
        integer                             :: nfmpi_put_varm_double_all
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.7: These functions map to "nf90mpi_get_var"
      interface nf90mpi_get_var1
        function nfmpi_get_var1_text(ncid, varid, index, chval)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        character(len = 1),       intent(out) :: chval
        integer                               :: nfmpi_get_var1_text
        end function

        function nfmpi_get_var1_int1(ncid, varid, index, i1val)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        integer*1,                intent(out) :: i1val
        integer                               :: nfmpi_get_var1_int1
        end function

        function nfmpi_get_var1_int2(ncid, varid, index, i2val)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        integer*2,                intent(out) :: i2val
        integer                               :: nfmpi_get_var1_int2
        end function

        function nfmpi_get_var1_int(ncid, varid, index, ival)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        integer*4,                intent(out) :: ival
        integer                               :: nfmpi_get_var1_int
        end function

        function nfmpi_get_var1_real(ncid, varid, index, rval)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        real*4,                   intent(out) :: rval
        integer                               :: nfmpi_get_var1_real
        end function

        function nfmpi_get_var1_double(ncid, varid, index, dval)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: index(*)
        real*8,                   intent(out) :: dval
        integer                               :: nfmpi_get_var1_double
        end function
      end interface

      interface nf90mpi_get_var
        function nfmpi_get_var_text(ncid, varid, text)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_var_text
        end function

        function nfmpi_get_var_int1(ncid, varid, i1vals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_var_int1
        end function

        function nfmpi_get_var_int2(ncid, varid, i2vals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_var_int2
        end function

        function nfmpi_get_var_int(ncid, varid, ivals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_var_int
        end function

        function nfmpi_get_var_real(ncid, varid, rvals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_var_real
        end function

        function nfmpi_get_var_double(ncid, varid, dvals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        real*8,                   intent(out) :: dvals(*)
        integer                               :: nfmpi_get_var_double
        end function
      end interface

      interface nf90mpi_get_vara
        function nfmpi_get_vara_text(ncid, varid, start, count, text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_vara_text
        end function

        function nfmpi_get_vara_int1(ncid, varid, start, count, i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_vara_int1
        end function

        function nfmpi_get_vara_int2(ncid, varid, start, count, i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_vara_int2
        end function

        function nfmpi_get_vara_int(ncid, varid, start, count, ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_vara_int
        end function

        function nfmpi_get_vara_real(ncid, varid, start, count, rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_vara_real
        end function

        function nfmpi_get_vara_double(ncid, varid, start, count, dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        real*8,                   intent(out) :: dvals(*)
        integer                               :: nfmpi_get_vara_double
        end function
      end interface

      interface nf90mpi_get_vars
        function nfmpi_get_vars_text(ncid, varid, start, count, stride, &
     &                               text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_vars_text
        end function

        function nfmpi_get_vars_int1(ncid, varid, start, count, stride, &
     &                               i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_vars_int1
        end function

        function nfmpi_get_vars_int2(ncid, varid, start, count, stride, &
     &                               i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_vars_int2
        end function

        function nfmpi_get_vars_int(ncid, varid, start, count, stride,  &
     &                              ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_vars_int
        end function

        function nfmpi_get_vars_real(ncid, varid, start, count, stride, &
     &                               rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_vars_real
        end function

        function nfmpi_get_vars_double(ncid, varid, start, count,       &
     &                                 stride, dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        real*8,                   intent(out) :: dvals(*)
        integer                               :: nfmpi_get_vars_double
        end function
      end interface

      interface nf90mpi_get_varm
        function nfmpi_get_varm_text(ncid, varid, start, count, stride, &
     &                               imap, text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_varm_text
        end function

        function nfmpi_get_varm_int1(ncid, varid, start, count, stride, &
     &                               imap, i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_varm_int1
        end function

        function nfmpi_get_varm_int2(ncid, varid, start, count, stride, &
     &                               imap, i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_varm_int2
        end function

        function nfmpi_get_varm_int(ncid, varid, start, count, stride,  &
     &                              imap, ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_varm_int
        end function

        function nfmpi_get_varm_real(ncid, varid, start, count, stride, &
     &                               imap, rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_varm_real
        end function

        function nfmpi_get_varm_double(ncid, varid, start, count,       &
     &                                 stride, imap, dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        real*8,                   intent(out) :: dvals(*)
        integer                               :: nfmpi_get_varm_double
        end function
      end interface

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.7: These functions map to "nf90mpi_get_var", but are
!   specific to parallel netCDF and are to be used in collective data
!   mode.
      interface nf90mpi_get_var_all
        function nfmpi_get_var_text_all(ncid, varid, text)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_var_text_all
        end function

        function nfmpi_get_var_int1_all(ncid, varid, i1vals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_var_int1_all
        end function

        function nfmpi_get_var_int2_all(ncid, varid, i2vals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_var_int2_all
        end function

        function nfmpi_get_var_int_all(ncid, varid, ivals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_var_int_all
        end function

        function nfmpi_get_var_real_all(ncid, varid, rvals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_var_real_all
        end function

        function nfmpi_get_var_double_all(ncid, varid, dvals)
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        real*8,                   intent(out) :: dvals(*)
        integer                              :: nfmpi_get_var_double_all
        end function
      end interface

      interface nf90mpi_get_vara_all
        function nfmpi_get_vara_text_all(ncid, varid, start, count,     &
     &                                   text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_vara_text_all
        end function

        function nfmpi_get_vara_int1_all(ncid, varid, start, count,     &
     &                                   i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_vara_int1_all
        end function

        function nfmpi_get_vara_int2_all(ncid, varid, start, count,     &
     &                                   i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_vara_int2_all
        end function

        function nfmpi_get_vara_int_all(ncid, varid, start, count,      &
     &                                  ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_vara_int_all
        end function

        function nfmpi_get_vara_real_all(ncid, varid, start, count,     &
     &                                   rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_vara_real_all
        end function

        function nfmpi_get_vara_double_all(ncid, varid, start, count,   &
     &                                     dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        real*8,                   intent(out) :: dvals(*)
        integer                             :: nfmpi_get_vara_double_all
        end function
      end interface

      interface nf90mpi_get_vars_all
        function nfmpi_get_vars_text_all(ncid, varid, start, count,     &
     &                                   stride, text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_vars_text_all
        end function

        function nfmpi_get_vars_int1_all(ncid, varid, start, count,     &
     &                                   stride, i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_vars_int1_all
        end function

        function nfmpi_get_vars_int2_all(ncid, varid, start, count,     &
     &                                   stride, i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_vars_int2_all
        end function

        function nfmpi_get_vars_int_all(ncid, varid, start, count,      &
     &                                  stride, ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_vars_int_all
        end function

        function nfmpi_get_vars_real_all(ncid, varid, start, count,     &
     &                                   stride, rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_vars_real_all
        end function

        function nfmpi_get_vars_double_all(ncid, varid, start, count,   &
     &                                 stride, dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        real*8,                   intent(out) :: dvals(*)
        integer                             :: nfmpi_get_vars_double_all
        end function
      end interface

      interface nf90mpi_get_varm_all
        function nfmpi_get_varm_text_all(ncid, varid, start, count,     &
     &                                   stride, imap, text)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        character(len = *),       intent(out) :: text(*)
        integer                               :: nfmpi_get_varm_text_all
        end function

        function nfmpi_get_varm_int1_all(ncid, varid, start, count,     &
     &                                   stride, imap, i1vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*1,                intent(out) :: i1vals(*)
        integer                               :: nfmpi_get_varm_int1_all
        end function

        function nfmpi_get_varm_int2_all(ncid, varid, start, count,     &
     &                                   stride, imap, i2vals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*2,                intent(out) :: i2vals(*)
        integer                               :: nfmpi_get_varm_int2_all
        end function

        function nfmpi_get_varm_int_all(ncid, varid, start, count,      &
     &                                  stride, imap, ivals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        integer*4,                intent(out) :: ivals(*)
        integer                               :: nfmpi_get_varm_int_all
        end function

        function nfmpi_get_varm_real_all(ncid, varid, start, count,     &
     &                                   stride, imap, rvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        real*4,                   intent(out) :: rvals(*)
        integer                               :: nfmpi_get_varm_real_all
        end function

        function nfmpi_get_varm_double_all(ncid, varid, start, count,   &
     &                                     stride, imap, dvals)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        integer(MPI_OFFSET_KIND), intent(in)  :: start(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: count(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: stride(*)
        integer(MPI_OFFSET_KIND), intent(in)  :: imap(*)
        real*8,                   intent(out) :: dvals(*)
        integer                             :: nfmpi_get_varm_double_all
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.10
      interface nf90mpi_rename_var
        function nfmpi_rename_var(ncid, varid, new_name)
        integer,            intent(in) :: ncid
        integer,            intent(in) :: varid
        character(len = *), intent(in) :: new_name
        integer                        :: nfmpi_rename_var
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3: These functions map to "nf90mpi_put_att"
      interface
        function nfmpi_put_att_text(ncid, varid, name, len, text)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer(MPI_OFFSET_KIND), intent(in) :: len
        character(len = *),       intent(in) :: text
        integer                              :: nfmpi_put_att_text
        end function

        function nfmpi_put_att_int1(ncid, varid, name, xtype, len,      &
     &                              i1vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer,                  intent(in) :: xtype
        integer(MPI_OFFSET_KIND), intent(in) :: len
        integer*1,                intent(in) :: i1vals(*)
        integer                              :: nfmpi_put_att_int1
        end function

        function nfmpi_put_att_int2(ncid, varid, name, xtype, len,      &
     &                              i2vals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer,                  intent(in) :: xtype
        integer(MPI_OFFSET_KIND), intent(in) :: len
        integer*2,                intent(in) :: i2vals(*)
        integer                              :: nfmpi_put_att_int2
        end function

        function nfmpi_put_att_int(ncid, varid, name, xtype, len, ivals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer,                  intent(in) :: xtype
        integer(MPI_OFFSET_KIND), intent(in) :: len
        integer*4,                intent(in) :: ivals(*)
        integer                              :: nfmpi_put_att_int
        end function

        function nfmpi_put_att_real(ncid, varid, name, xtype, len,      &
     &                              rvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer,                  intent(in) :: xtype
        integer(MPI_OFFSET_KIND), intent(in) :: len
        real*4,                   intent(in) :: rvals(*)
        integer                              :: nfmpi_put_att_real
        end function

        function nfmpi_put_att_double(ncid, varid, name, xtype, len,    &
     &                                dvals)
        use mpi
        integer,                  intent(in) :: ncid
        integer,                  intent(in) :: varid
        character(len = *),       intent(in) :: name
        integer,                  intent(in) :: xtype
        integer(MPI_OFFSET_KIND), intent(in) :: len
        real*8,                   intent(in) :: dvals(*)
        integer                              :: nfmpi_put_att_double
        end function
      end interface

      interface nf90mpi_put_att
        module procedure nf90mpi_put_att_text
        module procedure nf90mpi_put_att_int1_scalar
        module procedure nf90mpi_put_att_int1_1d
        module procedure nf90mpi_put_att_int2_scalar
        module procedure nf90mpi_put_att_int2_1d
        module procedure nf90mpi_put_att_int4_scalar
        module procedure nf90mpi_put_att_int4_1d
        module procedure nf90mpi_put_att_real4_scalar
        module procedure nf90mpi_put_att_real4_1d
        module procedure nf90mpi_put_att_real8_scalar
        module procedure nf90mpi_put_att_real8_1d
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.4: These functions map to "nf90mpi_inquire_attribute"
      interface
        function nfmpi_inq_att(ncid, varid, name, xtype, len)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        character(len = *),       intent(in)  :: name
        integer,                  intent(out) :: xtype
        integer(MPI_OFFSET_KIND), intent(out) :: len
        integer                               :: nfmpi_inq_att
        end function

        function nfmpi_inq_atttype(ncid, varid, name, xtype)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        integer,            intent(out) :: xtype
        integer                         :: nfmpi_inq_atttype
        end function

        function nfmpi_inq_attlen(ncid, varid, name, len)
        use mpi
        integer,                  intent(in)  :: ncid
        integer,                  intent(in)  :: varid
        character(len = *),       intent(in)  :: name
        integer(MPI_OFFSET_KIND), intent(out) :: len
        integer                               :: nfmpi_inq_attlen
        end function

        function nfmpi_inq_attid(ncid, varid, name, attnum)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        integer,            intent(out) :: attnum
        integer                         :: nfmpi_inq_attid
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.4
      interface nf90mpi_inq_attname
        function nfmpi_inq_attname(ncid, varid, attnum, name)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        integer,            intent(in)  :: attnum
        character(len = *), intent(out) :: name
        integer                         :: nfmpi_inq_attname
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5: These functions map to "nf90mpi_get_att"
      interface
        function nfmpi_get_att_text(ncid, varid, name, text)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        character(len = *), intent(out) :: text
        integer                         :: nfmpi_get_att_text
        end function

        function nfmpi_get_att_int1(ncid, varid, name, i1vals)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        integer*1,          intent(out) :: i1vals(*)
        integer                         :: nfmpi_get_att_int1
        end function

        function nfmpi_get_att_int2(ncid, varid, name, i2vals)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        integer*2,          intent(out) :: i2vals(*)
        integer                         :: nfmpi_get_att_int2
        end function

        function nfmpi_get_att_int(ncid, varid, name, ivals)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        integer*4,          intent(out) :: ivals(*)
        integer                         :: nfmpi_get_att_int
        end function

        function nfmpi_get_att_real(ncid, varid, name, rvals)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        real*4,             intent(out) :: rvals(*)
        integer                         :: nfmpi_get_att_real
        end function

        function nfmpi_get_att_double(ncid, varid, name, dvals)
        integer,            intent(in)  :: ncid
        integer,            intent(in)  :: varid
        character(len = *), intent(in)  :: name
        real*8,             intent(out) :: dvals(*)
        integer                         :: nfmpi_get_att_double
        end function
      end interface

      interface nf90mpi_get_att
        module procedure nf90mpi_get_att_text
        module procedure nf90mpi_get_att_int1_scalar
        module procedure nf90mpi_get_att_int1_1d
        module procedure nf90mpi_get_att_int2_scalar
        module procedure nf90mpi_get_att_int2_1d
        module procedure nf90mpi_get_att_int4_scalar
        module procedure nf90mpi_get_att_int4_1d
        module procedure nf90mpi_get_att_real4_scalar
        module procedure nf90mpi_get_att_real4_1d
        module procedure nf90mpi_get_att_real8_scalar
        module procedure nf90mpi_get_att_real8_1d
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.6
      interface nf90mpi_copy_att
        function nfmpi_copy_att(ncid_in, varid_in, name, ncid_out,      &
     &                          varid_out)
        integer,            intent(in) :: ncid_in
        integer,            intent(in) :: varid_in
        character(len = *), intent(in) :: name
        integer,            intent(in) :: ncid_out
        integer,            intent(in) :: varid_out
        integer                        :: nfmpi_copy_att
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.7
      interface nf90mpi_rename_att
        function nfmpi_rename_att(ncid, varid, curname, newname)
        integer,            intent(in) :: ncid
        integer,            intent(in) :: varid
        character(len = *), intent(in) :: curname
        integer,            intent(in) :: newname
        integer                        :: nfmpi_rename_att
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.8
      interface nf90mpi_del_att
        function nfmpi_del_att(ncid, varid, name)
        integer,            intent(in) :: ncid
        integer,            intent(in) :: varid
        character(len = *), intent(in) :: name
        integer                        :: nfmpi_del_att
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specific to parallel netCDF API
      interface nf90mpi_issyserr
        function nfmpi_issyserr(ncerr)
        integer, intent(in) :: ncerr
        logical             :: nfmpi_issyserr
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specific to parallel netCDF API
      interface nf90mpi_get_file_info
        function nfmpi_get_file_info(ncid, mpi_info)
        integer, intent(in)  :: ncid
        integer, intent(out) :: mpi_info
        integer              :: nfmpi_get_file_info
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specific to parallel netCDF API
      interface nf90mpi_delete
        function nfmpi_delete(path, mpi_info)
        character(len = *), intent(in) :: path
        integer,            intent(in) :: mpi_info
        integer                        :: nfmpi_delete
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specific to parallel netCDF API
      interface nf90mpi_begin_indep_data
        function nfmpi_begin_indep_data(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_begin_indep_data
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Specific to parallel netCDF API
      interface nf90mpi_end_indep_data
        function nfmpi_end_indep_data(ncid)
        integer, intent(in) :: ncid
        integer             :: nfmpi_end_indep_data
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.17 from serial netCDF Fortran 77 interface
      interface
        function nfmpi_set_default_format(formt, old_formt)
        integer, intent(in)  :: formt
        integer, intent(out) :: old_formt
        integer              :: nfmpi_set_default_format
        end function
      end interface
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

      private :: nf90mpi_put_att_text,                                  &
     & nf90mpi_put_att_int1_scalar,  nf90mpi_put_att_int1_1d,           &
     & nf90mpi_put_att_int2_scalar,  nf90mpi_put_att_int2_1d,           &
     & nf90mpi_put_att_int4_scalar,  nf90mpi_put_att_int4_1d,           &
     & nf90mpi_put_att_real4_scalar, nf90mpi_put_att_real4_1d,          &
     & nf90mpi_put_att_real8_scalar, nf90mpi_put_att_real8_1d,          &
     & nf90mpi_get_att_text,                                            &
     & nf90mpi_get_att_int1_scalar,  nf90mpi_get_att_int1_1d,           &
     & nf90mpi_get_att_int2_scalar,  nf90mpi_get_att_int2_1d,           &
     & nf90mpi_get_att_int4_scalar,  nf90mpi_get_att_int4_1d,           &
     & nf90mpi_get_att_real4_scalar, nf90mpi_get_att_real4_1d,          &
     & nf90mpi_get_att_real8_scalar, nf90mpi_get_att_real8_1d

      contains

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.5
      function nf90mpi_create(path, cmode, ncid, mpi_comm, mpi_info)
      character(len = *), intent(in)  :: path
      integer,            intent(in)  :: cmode
      integer,            intent(out) :: ncid
      integer, optional,  intent(in)  :: mpi_comm
      integer, optional,  intent(in)  :: mpi_info
      integer                         :: nf90mpi_create
      if ( present(mpi_comm) .and. present(mpi_info) ) then
        nf90mpi_create = nfmpi_create(mpi_comm, path, cmode, mpi_info,  &
     &                                ncid)
      else if ( present(mpi_comm) ) then
        nf90mpi_create = nfmpi_create(mpi_comm, path, cmode,            &
     &                                MPI_INFO_NULL, ncid)
      else if ( present(mpi_info) ) then
        nf90mpi_create = nfmpi_create(MPI_COMM_WORLD, path, cmode,      &
     &                                mpi_info, ncid)
      else
        nf90mpi_create = nfmpi_create(MPI_COMM_WORLD, path, cmode,      &
     &                                MPI_INFO_NULL, ncid)
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.6
      function nf90mpi_open(path, omode, ncid, mpi_comm, mpi_info)
      character(len = *), intent(in)  :: path
      integer,            intent(in)  :: omode
      integer,            intent(out) :: ncid
      integer, optional,  intent(in)  :: mpi_comm
      integer, optional,  intent(in)  :: mpi_info
      integer                         :: nf90mpi_open
      if ( present(mpi_comm) .and. present(mpi_info) ) then
        nf90mpi_open = nfmpi_open(mpi_comm, path, omode, mpi_info, ncid)
      else if ( present(mpi_comm) ) then
        nf90mpi_open = nfmpi_open(mpi_comm, path, omode, MPI_INFO_NULL, &
     &                            ncid)
      else if ( present(mpi_info) ) then
        nf90mpi_open = nfmpi_open(MPI_COMM_WORLD, path, omode, mpi_info,&
     &                            ncid)
      else
        nf90mpi_open = nfmpi_open(MPI_COMM_WORLD, path, omode,          &
     &                            MPI_INFO_NULL, ncid)
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 2.10
! NOTE: The last argument to this function should be "format", but the
! pnetCDF library does not include the proper inquiry function.
      function nf90mpi_inquire(ncid, ndims, nvars, ngatts, unlimdimid)
      integer,           intent(in)  :: ncid
      integer, optional, intent(out) :: ndims
      integer, optional, intent(out) :: nvars
      integer, optional, intent(out) :: ngatts
      integer, optional, intent(out) :: unlimdimid
!      integer, optional, intent(out) :: format
      integer                        :: nf90mpi_inquire
      integer :: error
      nf90mpi_inquire = NF90MPI_NOERR
      if ( present(ndims) ) then
        error = nfmpi_inq_ndims(ncid, ndims)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire = error
      end if
      if ( present(nvars) ) then
        error = nfmpi_inq_nvars(ncid, nvars)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire = error
      end if
      if ( present(ngatts) ) then
        error = nfmpi_inq_natts(ncid, ngatts)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire = error
      end if
      if ( present(unlimdimid) ) then
        error = nfmpi_inq_unlimdim(ncid, unlimdimid)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire = error
      end if
!      if ( present(format) ) then
!        error = nfmpi_inq_format(ncid, format)
!        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire = error
!      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 3.4
      function nf90mpi_inquire_dimension(ncid, dimid, name, len)
      integer,                            intent(in)  :: ncid
      integer,                            intent(in)  :: dimid
      character(len = *),       optional, intent(out) :: name
      integer(MPI_OFFSET_KIND), optional, intent(out) :: len
      integer                               :: nf90mpi_inquire_dimension
      integer :: error
      nf90mpi_inquire_dimension = NF90MPI_NOERR
      if ( present(name) ) then
        error = nfmpi_inq_dimname(ncid, dimid, name)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_dimension =error
      end if
      if ( present(len) ) then
        error = nfmpi_inq_dimlen(ncid, dimid, len)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_dimension =error
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.3
      function nf90mpi_def_var(ncid, name, xtype, dimids, varid)
      integer,            intent(in)  :: ncid
      character(len = *), intent(in)  :: name
      integer,            intent(in)  :: xtype
      integer, optional,  intent(in)  :: dimids(:)
      integer,            intent(out) :: varid
      integer                         :: nf90mpi_def_var
      integer :: ndims
      if ( present(dimids) ) then
        ndims = size(dimids,1)
        nf90mpi_def_var = nfmpi_def_var(ncid, name, xtype, ndims,       &
     &                                  dimids, varid)
      else
        ndims = 0
        nf90mpi_def_var = nfmpi_def_var(ncid, name, xtype, ndims,       &
     &                                  (/ 0 /), varid)
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 4.5
      function nf90mpi_inquire_variable(ncid, varid, name, xtype, ndims,&
     &                                  dimids, natts)
      integer,                      intent(in)  :: ncid
      integer,                      intent(in)  :: varid
      character(len = *), optional, intent(out) :: name
      integer,            optional, intent(out) :: xtype
      integer,            optional, intent(out) :: ndims
      integer,            optional, intent(out) :: dimids(*)
      integer,            optional, intent(out) :: natts
      integer                                :: nf90mpi_inquire_variable
      integer :: error
      nf90mpi_inquire_variable = NF90MPI_NOERR
      if ( present(name) ) then
        error = nfmpi_inq_varname(ncid, varid, name)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_variable = error
      end if
      if ( present(xtype) ) then
        error = nfmpi_inq_vartype(ncid, varid, xtype)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_variable = error
      end if
      if ( present(ndims) ) then
        error = nfmpi_inq_varndims(ncid, varid, ndims)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_variable = error
      end if
      if ( present(dimids) ) then
        error = nfmpi_inq_vardimid(ncid, varid, dimids)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_variable = error
      end if
      if ( present(natts) ) then
        error = nfmpi_inq_varnatts(ncid, varid, natts)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_variable = error
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_text(ncid, varid, name, text)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      character(len = *), intent(in) :: text
      integer                        :: nf90mpi_put_att_text
      integer(MPI_OFFSET_KIND) :: len
      len = int(len_trim(text),MPI_OFFSET_KIND)
      nf90mpi_put_att_text =                                            &
     &    nfmpi_put_att_text(ncid, varid, name, len, text)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int1_scalar(ncid, varid, name, i1val)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*1,          intent(in) :: i1val
      integer                        :: nf90mpi_put_att_int1_scalar
      integer(MPI_OFFSET_KIND) :: len
      len = int(1,MPI_OFFSET_KIND)
      nf90mpi_put_att_int1_scalar = nfmpi_put_att_int1(ncid, varid,     &
     &    name, NF90MPI_BYTE, len, (/i1val/))
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int1_1d(ncid, varid, name, i1vals)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*1,          intent(in) :: i1vals(:)
      integer                        :: nf90mpi_put_att_int1_1d
      integer(MPI_OFFSET_KIND) :: len
      len = int(size(i1vals,1),MPI_OFFSET_KIND)
      nf90mpi_put_att_int1_1d = nfmpi_put_att_int1(ncid, varid, name,   &
     &    NF90MPI_BYTE, len, i1vals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int2_scalar(ncid, varid, name, i2val)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*2,          intent(in) :: i2val
      integer                        :: nf90mpi_put_att_int2_scalar
      integer(MPI_OFFSET_KIND) :: len
      len = int(1,MPI_OFFSET_KIND)
      nf90mpi_put_att_int2_scalar = nfmpi_put_att_int2(ncid, varid,     &
     &    name, NF90MPI_SHORT, len, (/i2val/))
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int2_1d(ncid, varid, name, i2vals)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*2,          intent(in) :: i2vals(:)
      integer                        :: nf90mpi_put_att_int2_1d
      integer(MPI_OFFSET_KIND) :: len
      len = int(size(i2vals,1),MPI_OFFSET_KIND)
      nf90mpi_put_att_int2_1d = nfmpi_put_att_int2(ncid, varid, name,   &
     &    NF90MPI_SHORT, len, i2vals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int4_scalar(ncid, varid, name, ival)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*4,          intent(in) :: ival
      integer                        :: nf90mpi_put_att_int4_scalar
      integer(MPI_OFFSET_KIND) :: len
      len = int(1,MPI_OFFSET_KIND)
      nf90mpi_put_att_int4_scalar = nfmpi_put_att_int(ncid, varid,      &
     &    name, NF90MPI_INT, len, (/ival/))
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_int4_1d(ncid, varid, name, ivals)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      integer*4,          intent(in) :: ivals(:)
      integer                        :: nf90mpi_put_att_int4_1d
      integer(MPI_OFFSET_KIND) :: len
      len = int(size(ivals,1),MPI_OFFSET_KIND)
      nf90mpi_put_att_int4_1d = nfmpi_put_att_int(ncid, varid, name,    &
     &    NF90MPI_INT, len, ivals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_real4_scalar(ncid, varid, name, rval)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      real*4,             intent(in) :: rval
      integer                        :: nf90mpi_put_att_real4_scalar
      integer(MPI_OFFSET_KIND) :: len
      len = int(1,MPI_OFFSET_KIND)
      nf90mpi_put_att_real4_scalar = nfmpi_put_att_real(ncid, varid,    &
     &    name, NF90MPI_FLOAT, len, (/rval/))
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_real4_1d(ncid, varid, name, rvals)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      real*4,             intent(in) :: rvals(:)
      integer                        :: nf90mpi_put_att_real4_1d
      integer(MPI_OFFSET_KIND) :: len
      len = int(size(rvals,1),MPI_OFFSET_KIND)
      nf90mpi_put_att_real4_1d = nfmpi_put_att_real(ncid, varid, name,  &
     &    NF90MPI_FLOAT, len, rvals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_real8_scalar(ncid, varid, name, dval)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      real*8,             intent(in) :: dval
      integer                        :: nf90mpi_put_att_real8_scalar
      integer(MPI_OFFSET_KIND) :: len
      len = int(1,MPI_OFFSET_KIND)
      nf90mpi_put_att_real8_scalar = nfmpi_put_att_double(ncid, varid,  &
     &    name, NF90MPI_DOUBLE, len, (/dval/))
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.3
      function nf90mpi_put_att_real8_1d(ncid, varid, name, dvals)
      integer,            intent(in) :: ncid
      integer,            intent(in) :: varid
      character(len = *), intent(in) :: name
      real*8,             intent(in) :: dvals(:)
      integer                        :: nf90mpi_put_att_real8_1d
      integer(MPI_OFFSET_KIND) :: len
      len = int(size(dvals,1),MPI_OFFSET_KIND)
      nf90mpi_put_att_real8_1d = nfmpi_put_att_double(ncid, varid,      &
     &    name, NF90MPI_DOUBLE, len, dvals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.4
      function nf90mpi_inquire_attribute(ncid, varid, name, xtype, len, &
     &                                   attnum)
      integer,                            intent(in)  :: ncid
      integer,                            intent(in)  :: varid
      character(len = *),                 intent(in)  :: name
      integer,                  optional, intent(out) :: xtype
      integer(MPI_OFFSET_KIND), optional, intent(out) :: len
      integer,                  optional, intent(out) :: attnum
      integer                               :: nf90mpi_inquire_attribute
      integer :: error
      nf90mpi_inquire_attribute = NF90MPI_NOERR
      if ( present(xtype) ) then
        error = nfmpi_inq_atttype(ncid, varid, name, xtype)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_attribute =error
      end if
      if ( present(len) ) then
        error = nfmpi_inq_attlen(ncid, varid, name, len)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_attribute =error
      end if
      if ( present(attnum) ) then
        error = nfmpi_inq_attid(ncid, varid, name, attnum)
        if ( error .ne. NF90MPI_NOERR ) nf90mpi_inquire_attribute =error
      end if
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_text(ncid, varid, name, text)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      character(len = *), intent(out) :: text
      integer                         :: nf90mpi_get_att_text
      nf90mpi_get_att_text = nfmpi_get_att_text(ncid, varid, name, text)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int1_scalar(ncid, varid, name, i1val)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*1,          intent(out) :: i1val
      integer                         :: nf90mpi_get_att_int1_scalar
      integer*1 :: i1val_tmp(1)
      nf90mpi_get_att_int1_scalar =                                     &
     &    nfmpi_get_att_int1(ncid, varid, name, i1val_tmp)
      i1val = i1val_tmp(1)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int1_1d(ncid, varid, name, i1vals)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*1,          intent(out) :: i1vals(:)
      integer                         :: nf90mpi_get_att_int1_1d
      nf90mpi_get_att_int1_1d =                                         &
     &    nfmpi_get_att_int1(ncid, varid, name, i1vals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int2_scalar(ncid, varid, name, i2val)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*2,          intent(out) :: i2val
      integer                         :: nf90mpi_get_att_int2_scalar
      integer*2 :: i2val_tmp(1)
      nf90mpi_get_att_int2_scalar =                                     &
     &    nfmpi_get_att_int2(ncid, varid, name, i2val_tmp)
      i2val = i2val_tmp(1)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int2_1d(ncid, varid, name, i2vals)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*2,          intent(out) :: i2vals(:)
      integer                         :: nf90mpi_get_att_int2_1d
      nf90mpi_get_att_int2_1d =                                         &
     &    nfmpi_get_att_int2(ncid, varid, name, i2vals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int4_scalar(ncid, varid, name, ival)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*4,          intent(out) :: ival
      integer                         :: nf90mpi_get_att_int4_scalar
      integer :: ival_tmp(1)
      nf90mpi_get_att_int4_scalar =                                     &
     &    nfmpi_get_att_int(ncid, varid, name, ival_tmp)
      ival = ival_tmp(1)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_int4_1d(ncid, varid, name, ivals)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      integer*4,          intent(out) :: ivals(:)
      integer                         :: nf90mpi_get_att_int4_1d
      nf90mpi_get_att_int4_1d =                                         &
     &    nfmpi_get_att_int(ncid, varid, name, ivals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_real4_scalar(ncid, varid, name, rval)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      real*4,             intent(out) :: rval
      integer                         :: nf90mpi_get_att_real4_scalar
      real*4 :: rval_tmp(1)
      nf90mpi_get_att_real4_scalar =                                    &
     &    nfmpi_get_att_real(ncid, varid, name, rval_tmp)
      rval = rval_tmp(1)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_real4_1d(ncid, varid, name, rvals)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      real*4,             intent(out) :: rvals(:)
      integer                         :: nf90mpi_get_att_real4_1d
      nf90mpi_get_att_real4_1d =                                        &
     &    nfmpi_get_att_real(ncid, varid, name, rvals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_real8_scalar(ncid, varid, name, dval)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      real*8,             intent(out) :: dval
      integer                         :: nf90mpi_get_att_real8_scalar
      real*8 :: dval_tmp(1)
      nf90mpi_get_att_real8_scalar =                                    &
     &    nfmpi_get_att_double(ncid, varid, name, dval_tmp)
      dval = dval_tmp(1)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Section 5.5
      function nf90mpi_get_att_real8_1d(ncid, varid, name, dvals)
      integer,            intent(in)  :: ncid
      integer,            intent(in)  :: varid
      character(len = *), intent(in)  :: name
      real*8,             intent(out) :: dvals(:)
      integer                         :: nf90mpi_get_att_real8_1d
      nf90mpi_get_att_real8_1d =                                        &
     &    nfmpi_get_att_double(ncid, varid, name, dvals)
      end function
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      end module


More information about the parallel-netcdf mailing list