nfmpi_put_var problem

Wei-keng Liao wkliao at ece.northwestern.edu
Wed Apr 8 13:15:28 CDT 2009


The argument declarations for nfmpi_put_var() are commented out in  
pnetcdf.inc.
They are out-dated and misleading (were copied from the serial netCDF  
when
pnetCDF work started). Fortran compiler checks function return type,  
but not
the argument types. So, only function names and their return types are
actually  used in pnetcdf.inc, although we should update them to avoid
misunderstanding.

Please use the function as Rob suggested.
PnetCDF's Fortran functions are just like their C functions.

Wei-keng


On Apr 8, 2009, at 10:57 AM, Rob Latham wrote:

> 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