Issue with "integer" arguments in Fortran API for PNetCDF

Jim Edwards jedwards at ucar.edu
Tue Oct 24 16:46:39 CDT 2006


Hi John,

I'm not sure if this will help in your case but what i do is:

#ifdef PNETCDF
  use parallel_mod, only : nfsizekind=>mpi_offset_kind
#else
  use kinds, only : nfsizekind=>int_kind
#endif
then declare those variables with nfsizekind so that they work with either
netcdf or pnetcdf.

Oh  I think I see - you are writting your pnetcdf interface in c and calling
from fortran?
How about sticking with fortran - is that an option?



On 10/24/06, John Michalakes <john at michalakes.us> wrote:
>
> I'm having a problem adapting parallel NetCDF as an option in the WRF
> (Weather Research and Forecast) model I/O API. WRF currently supports
> non-parallel NetCDF, and we're now trying to extend the model to use the
> new
> parallel NetCDF code. Have run into a problem with some of the arguments
> in
> the API for parallel-NetCDF:
>
> The original NetCDF Fortran API defines lengths, starts, and other
> arguments
> as INTEGER. PnetCDF recasts some (but not all) of these arguments as
> MPI_Offset. We compile WRF with OBJECT_MODE 64 on the IBMs where
> KIND=MPI_OFFSET_KIND works out to 8 bytes. Thus, the calls in WRF that
> pass
> these arguments as 32-bit INTEGERs from Fortran are causing PNetCDF to see
> garbage in the high four bytes of the dummy argument. For example, the
> length argument to NFMPI_DEF_DIM ends up being 73 + a very-large-garbage
> value instead of 73.
>
> I was hoping for a relatively quick drop-in of PnetCDF into WRF I/O API
> but
> this now seems unlikely. There is a large amount of NetCDF interface code
> in
> WRF that will need to be gone through.  Or I can write a wrapper lib for
> all
> these routines.
>
> Has anyone done this already? What's needed is for the wrapper routine to
> accept INTEGER arguments and copy them to INTEGER(KIND=MPI_OFFSET_KIND) to
> be used as arguments to the actual NFMPI_* routines in PNetCDF and (in the
> case of return values) copy them back to INTEGER again.
>
> Not arguing, but curious: since PNetCDF is supposed to be a parallel
> implementation of the NetCDF API, why was the API altered this way to use
> arguments of type MPI_Offset instead of INTEGER? At least for what I'm
> trying to do, it is a significant impediment.
>
> I really appreciate that parallel NetCDF is being developed. It is very
> much
> needed, especially now as we try moving to Petascale. Kudos to the
> developers.
>
> John
>
> -----------------------------------------------------------
> John Michalakes, Software Engineer        michalak at ucar.edu
> NCAR, MMM Division                   voice: +1 303 497 8199
> 3450 Mitchell Lane                     fax: +1 303 497 8181
> Boulder, Colorado 80301 U.S.A.        cell: +1 720 209 2320
>         http://www.mmm.ucar.edu/individual/michalakes
> -----------------------------------------------------------
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20061024/c09629fc/attachment.htm>


More information about the parallel-netcdf mailing list