PGI Guide to NetCDF

This guide is intended to help build and test the network Common Data Format libraries using the PGI 6.0, 6.1, or 6.2 compilers.

Version Information

This guide was created for the release 3.6.0-p1 of netCDF and PGI Release 6.0, 6.1, 6.2 pgf90 and pgcc compilers. This information is for both x64 processors running 64-bit Linux and x86 processors running 32-bit Linux. Linux.

Application Notes

Information about netcdf can be found at the netCDF FAQ page.

(From the webpage) "NetCDF (network Common Data Form) is an interface for array-oriented data access and a freely-distributed collection of software libraries for C, Fortran, C++, Java, and perl that provide implementations of the interface. The netCDF software was developed by Glenn Davis, Russ Rew, Steve Emmerson, John Caron, and Harvey Davies at the Unidata Program Center in Boulder, Colorado, and augmented by contributions from other netCDF users. The netCDF libraries define a machine-independent format for representing scientific data. Together, the interface, libraries, and format support the creation, access, and sharing of scientific data."

Obtaining the Source Code

NetCDF source code can be downloaded from anonymous FTP at found at the the netCDF FTP site or on the web at the netCDF FAQ page. The 3.6.0 release notes contain information about this release.



Building NetCDF and Testing

To build and run netCDF, you will first need to create a working directory and a final directory. uncompress the netcdf.tar.Z or netcdf.tar.gz package and then untar it in the working directory. Then configure and make the result. Then run the various tests by executing make test. For this example, we are doing things in /tmp. Assume netcdf.tar.[Z|gz] is in /tmp.

cd /tmp
mkdir working
mkdir final
uncompress netcdf.tar.Z
cd /tmp/working
tar xvf /tmp/netcdf.tar
cd net*/src
env CC=pgcc CFLAGS="-O2 -Msignextend -V" FC=pgf90 F90=pgf90 FFLAGS="-O2 -w -V"  \
CXX=pgCC CPPFLAGS="-DNDEBUG -DpgiFortran" ./configure -prefix=/tmp/final >& config.log

make >& make.log

make test >& make_test.log

Note that some shell environments will ignore the "env" command listed above. If this occurs, please set each environment variable before executing the configure script.

The exact optimizations you use should be adjusted depending upon how you compile the applications that will use the netCDF library. If your application is 32-bits and is compiled with -Mcache_align or the aggregate flag -fastsse which contains -Mcache_align, then you must add -Mcache_align or -fastsse to the CFLAGS and FFLAGS. Failure to do so may result in a segmentation violation cause by mismatched data alignment.

New with 6.0, IPA will automatically obtain IPA from a library provided that the library was built with -Mipa and the application adds the IPA suboption -Mipa=libopt. If you believe your applications may use IPA optimziations, add -Mipa or -Mipa=fast to the CFLAGS and FFLAGS. Adding IPA to netCDF will not effect applications that do not use IPA.

Known Issues

If you get undefined reference errors to "__builtin_alloca", the libnecdf_c++.a library was built with a compiler other than pgCC. This occurs because using "env" before "./configure" doesn't work in some environments. You will need to edit your make.macros file with the correct variables as listed above and rebuild or individually set the evrionmental variables and rerun ./configure.

Click me