nfmpi_put_var problem

Rob Latham robl at mcs.anl.gov
Wed Apr 8 10:57:43 CDT 2009


On Wed, Apr 08, 2009 at 03:31:33PM -0000, zbych at igf.fuw.edu.pl wrote:
> I'm trying to use nfmpi_put_var and  nfmpi_put_var_all to write either
> real*4 or real*8 data, depending on the desired precision. I am curious
> why in pnetcdf.inc we have:
> 
>       integer         nfmpi_put_var
> !                         (integer             ncid,
> !                          integer             varid,
> !                          character(*)        text)
>       external        nfmpi_put_var
> 
> 
> but in pnetcdf.h we have:
> 
> int ncmpi_put_var(int ncid, int varid, const void *buf, int bufcount,
> MPI_Datatype datatype);

Thanks.  That's a problem in our header file.  The fortran interface
is generated from the C and should be called like this in fortran:

ierr = nfmpi_put_var(ncid, varid, buf, bufcount, datatype, ierr)

> So, shall we specify bufcount and MPI_Datatype for fortran call ? If the
> argument is of char* type, do we need to rewrite the data from the real
> matrix to the char matrix ?

No need to rewrite the data.  The char * type is a mistake in the
header file.  'buf' should be of whatever type you are describing with
'datatype'.

I'll fix this.  As I understand it, most f77 compilers ignore the
function prototype?  Still, it needs to be corrected.

==rob


-- 
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA


More information about the parallel-netcdf mailing list