[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 20050817:netcdf fortran precision



Unidata Support <address@hidden> writes:

> ------- Forwarded Message
>
>>To: address@hidden
>>From: "Shipway, Ben" <address@hidden>
>>Subject: netcdf fortran precision
>>Organization: UCAR/Unidata
>>Keywords: 200508171714.j7HHESjo022721
>
> I hope I am mailing the appropriate address - if not, then please point
> me to a relevant forum for discussion of netcdf.

Howdy Ben!

address@hidden is a good email address for netCDF
questions. There is also a netCDF mailing list you may wish to
subscribe to. In my experience the members of the netCDF mailing list
are very helpful. For more info on the mailing list, see:

http://my.unidata.ucar.edu/content/software/netcdf/docs/faq.html#maillist

>
> I am working on some code which calls fortran functions from the netcdf
> library.  In some circumstances this code will be compiled with default
> double precision integers and in others it will be single precision.  My
> question is whether I will need two versions of the library, each
> compiled with the corresponding default precision?

Yes, you will need two versions of the netCDF library.

>
> Rather than doing this could I create my own custom netcdf.inc file 
> which specifies the kind of integers used, e.g. integer(kind=4)
> nf_create etc. and make sure that any arguments are also of the correct
> precision?  Is there a reason why this might be a bad idea or is there a
> simpler way to achieve what I want (i.e. only needing 1 library)?

Sorry, I don't think this would work, but my understanding of this is
limited. However, the usual way to do what you want is to have two
libraries.

You need a 32-bit and a 64-bit version of the underlying C
library. The fortran API is just a thin layer that calls the C
library.

So it seems you will need both, and you will need to keep them in
different directories, and use the -L option of your linker to help it
find the correct library.

For a 64-bit compile, you need to set some environmental flags and
rebuild the library. Do a "make distclean" and then restart the
install process, just as if you had just unpacked the tarball. (That
is, rerun './configure && make test' but first set your environmental
flags for a 64-bit build.)

You don't mention your compile platform, so I can't tell you what
settings you need; it varies from compiler to compiler. The settings
for all the compilers I know about are listed here:

http://my.unidata.ucar.edu/content/software/netcdf/docs/netcdf-install/Building-on-64-Bit-Platforms.html

If you don't have one of the listed systems, I can't tell you what
options to use - you'll have to consult your C compiler
documentation. You can check to see if any other netCDF user has
reported working settings for your platform at:

http://my.unidata.ucar.edu/content/software/netcdf/docs/other-builds.html

If you figure out how to build 64-bit netCDF on an unlisted platform,
please email the settings; we will put it on the website so others may
see it.

Let me know if you need more help.

Thanks,

Ed


-- 
Ed Hartnett  -- address@hidden