Help getting started with Pnetcdf

Jim Edwards jedwards at ucar.edu
Mon Oct 13 16:35:20 CDT 2008


The pnetcdf.inc file contains some cpp directives.  If your compiler
supports cpp you can use
#include <pnetcdf.inc>  otherwise I think that you can edit the file and
comment those lines out.

Jim

On Mon, Oct 13, 2008 at 3:07 PM, Nikhil Laghave <nikhill at iastate.edu> wrote:

> Hello All,
>
> I have been using Parallel HDF5 for our code to do parallel IO of huge
> files but the performance we're getting is not very encouraging. So I wanted
> to do the same with Pnetcdf, but I am not able find much tutorials on the
> web with simple examples to write out files in parallel. The ones that are
> there are the serial ones.
>
> So I was wondering if someone on this mailing list has a simple Pnetcdf
> example, that will help me in understanding how to use pnetcdf.
>
> Also, I am trying to create a simple file using pnetcdf and am getting this
> error. There seems to be some problem with the include file and I don't
> understand how to get rid of this error. My code is as follows:
>
>       program simple_xy_wr
>       implicit none
>
>       include 'pnetcdf.inc'
>       include 'mpif.h'
>
> C     This is the name of the data file we will create.
>       character*(*) FILE_NAME
>       parameter (FILE_NAME='simple_xy.nc')
>
> C     We are writing 2D data, a 6 x 12 grid.
>       integer NDIMS,ierr
>       parameter (NDIMS=1)
>       integer NX, NY, i, myid, nprocs
>       parameter (NX = 16)
>       parameter (NY = 4)
>       CHARACTER(LEN=12) :: dataname
>
>
> C     When we create netCDF files, variables and dimensions, we get back
> C     an ID for each one.
>       integer ncid, varid,varid2, dimids(NDIMS), dimids2(NDIMS)
>       integer x_dimid, y_dimid
>
> C     This is the data array we will write. It will just be filled with
> C     a progression of integers for this example.
>       integer data_out(NX)
>       integer lengths_out(NY)
>
> C     Loop indexes, and error handling.
>       integer x, y, retval
>
>       call MPI_INIT(ierr)
>       call MPI_COMM_RANK(MPI_COMM_WORLD, myid, ierr)
>       call MPI_COMM_SIZE(MPI_COMM_WORLD, nprocs, ierr)
>       write(*,*) 'my id is :',myid,'& nprocs are:',nprocs
>
> C     Create some pretend data. If this wasn't an example program, we
> C     would have some real data to write, for example, model output.
>       do x = 1, NX
>          data_out(x) = (x - 1) * NX
>       end do
>       do y = 1, NY
>          lengths_out(y) = (y-1) * NY
>       enddo
>
>
>       nfmpi_create(MPI_COMM_WORLD,FILE_NAME,
>      &     NF_NETCDF4,MPI_INFO_NULL,ncid)
>
>       end
>
>
> When i compile this using : ftn simple.f $PNETCDF, i get this error.
>
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1816)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1820)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1823)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1825)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1827)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1831)
> PGF90-S-0021-Label field of continuation line is not blank
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1833)
> PGF90-S-0034-Syntax error at or near identifier
> sizeof_mpi_offsetnfmpi_unlimited
> (/usr/common/usg/pnetcdf/1.0.2/include/pnetcdf.inc: 1836)
> PGF90-S-0034-Syntax error at or near end of line (simple.f: 50)
> PGF90-S-0038-Symbol, nfmpi_unlimited, has not been explicitly declared
> (simple.f)
>   0 inform,   0 warnings,  10 severes, 0 fatal for simple_xy_wr
>
> Am i missing something simple ?
> --
> Regards,
> Nikhil
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20081013/0e06be03/attachment.htm>


More information about the parallel-netcdf mailing list