Building the NetCDF library

Discussion on computers, ROMS installation and compiling

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
arango
Site Admin
Posts: 1350
Joined: Wed Feb 26, 2003 4:41 pm
Location: DMCS, Rutgers University
Contact:

Building the NetCDF library

#1 Unread post by arango »

I have noticed that several users are having problems building the NetCDF library in several computer architectures. It seems that the second trailing underscore gives us a lot of problems. Nowadays, we need both the F77 and F90 interface of the NetCDF libray. The F77 interface is used in the ploting package whereas as the F90 interface is now needed for ROMS svn revision 75 or higher. Recall, that we are moving to parallel IO using the NetCDF 4.x library in the future.

The NetCDF 4.x library is even harder to build because it requires the HDF5 library (version 1.8 ). We are not planning to do more structural IO changes to ROMS in the future so the model can be compiled with both 3.x and 4.x NetCDF libraries. The parallel IO will be implemented using a CPP option. This will required opening the NetCDF file with different routine, NF_OPEN_PAR.

Now, the NetCDF Users' Guide has the following statement about compatibility:
When opening an existing netCDF file the netCDF library will transparently detect its format and adjust accordingly. However, netCDF library versions earlier that 3.6.0 cannot read 64-bit offset format files, and libary versions before 4.0 can't read netCDF-4/HDF5 files. NetCDF classic format files (even if created by version 3.6.0 or later) remain compatible with older versions of the netCDF library.
In view of all reported problems buidling the NetCDF library, I am wondering if we should stored built NetCDF libraries for various architectures and compilers in the ROMS website :?:

Any suggestions about how to do it :?: This is my take:

Code: Select all

    pgisoft/
            netcdf3
            netcdf4
            PARPACK
            MCT
            EMSF
where the above files are links to the actual library versions. This can get very complicated :roll:. Unidata builds the NetCDF libray for several architectures. It is not my intention to repeat this here. However, I noticed that if I download the libary version for CYGWIN with g95, it is not build with the -fno-second-underscore. So I have to rebuilt :evil:.

User avatar
m.hadfield
Posts: 521
Joined: Tue Jul 01, 2003 4:12 am
Location: NIWA

#2 Unread post by m.hadfield »

In view of all reported problems building the NetCDF library, I am wondering if we should stored built NetCDF libraries for various architectures and compilers in the ROMS website
Hmm, interesting. I'd like to point out a problem with this idea that's been caused by the move to the F90 interface: while the object-file format for the F77 interface seldom changes and is usually portable between different compilers on the same platform (once you've sorted out name-mangling and calling conventions), the same is definitely not true of the F90 interface files.

For example, I can build the netCDF f77 library with a 5-year old version of g77 (using -fno-second-underscore) and use it with current versions of g95 and gfortran, and probably with other compilers as well. However, a netCDF f90 library built with g95 won't work with gfortran and vice versa. Furthermore a netCDF f90 library built 6-12 months ago with g95 or gfortran won't work with current versions of the same compiler because they have both changed their file format in the meantime. (I know this from recent experience.)

So my feeling is that it is more efficient and flexible to do what we're doing now:
  • Store information about special build requirements for netCDF (and other libraries) on different platforms
  • Try to fix netCDF (and other library) problems on all the platforms used by ROMS and nag the developers to incorporate changes into the master code
But, hey, I've been wrong about things before, eg. my suggestion to make a bug-fix branch for each ROMS release. That was a terrible idea :(
We are not planning to do more structural IO changes to ROMS in the future so the model can be compiled with both 3.x and 4.x NetCDF libraries.
Thank heavens for that: the idea of trying to build HDF5 & NETCDF4 on the cray T3E is not appealing!
However, I noticed that if I download the library version for CYGWIN with g95, it is not build with the -fno-second-underscore. So I have to rebuilt
I didn't know there was a pre-compiled netCDF/Cywgin/g95 binary. Where did you get it?

I did suggest on the netCDF group that g95 should build the library with -fno-second-underscore by default. However this idea wasn't received with much enthusiasm (for good reasons, I think). They did put a note in the build instructions, see section 3.8.10.4 here

http://www.unidata.ucar.edu/software/ne ... ific-Notes[/quote]

Post Reply