Re: [netcdfgroup] What is the "standard" way to use NetCDF from Fortran 90?

Magnus Hagdorn wrote:
On Tue, 2009-07-14 at 13:25 +0200, Thomas Orgis wrote:
So... my question is: What should I do to use the Fortran 90 interface
of NetCDF?
Seems like the only safe way is to include a copy of the source of
that module from NetCDF sources and compile that together with my
other code. Is that The Right Way(tm)?
Or, should one rather have the OS distribution install the fortran
module source in /usr/include (or some other place where you can pull
in the source from)?

What is the NetCDF folks' angle on this?

Fortran libraries are a bit of a mess, especially f90 libraries since as
you observed the module files are compiler vendor and version specific.
There is also no standard place where fortran modules should get
installed. I think the fedora people decided to install them
into /usr/lib/modules or so. if you want to use the intel compilers than
you will need to compile netcdf yourself (or get your sys-admin to do
so). I'd suggest to install netcdf into the
prefix /usr/local/intel_VERSION/. Then compile your code with
ifort -I/usr/local/intel_VERSION/include
-L/usr/local/intel_VERSION/lib ...

alternative you can install netcdf in your home directory. BTW, I am
assuming you are using Linux or some other Unix like OS.

Thomas,

I would like to second Magnus's recommendation for separate upper-level library directories for each instance of a compiler. You may have missed the significance of this.

My work group has a similar scheme which works well. For example, we currently have these target directories for installs of netcdf and other fortran-sensitive libraries. Actually I like Magnus's scheme better, omitting /lib/, but this is what we have now.

  /usr/local/lib/g77
  /usr/local/lib/g95
  /usr/local/lib/gfortran
  /usr/local/lib/xlf

When necessary, add the compiler level number, e.g. gfortran_4.3, gfortran_4.4. We are (generally) managing to keep the installed software packages current, so we have not even felt the need for version numbers. And as Ed just said, gfortran seems to be the only one that currently has module file discrepancies between versions.

This scheme is fully supported by the regular Netcdf source distribution. Just use the --prefix option with configure to specify the target path, each time you build to a new compiler version. Keep the standard scheme of separate include and lib subdirectories under the target paths.

Careful use of environment variables as input to user make files makes switching between compilers easy. I use $F90_CMD and $LIB_NETCDF for this purpose, as well as a few others. The second one contains the associated library path. HTH.

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.cdc.noaa.gov/psd1/



  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: