PGI Guide to NetCDF

This guide is intended to help build and test the network Common Data Format libraries using the PGI 5.1 and 5.2.

Version Information

This guide was created for the release 3.5.1 of netCDF and PGI Release 5.1-5 pgf90 and pgcc 32-bit compilers on an x86 processor-base system running Linux. The guide was updated on July 14, 2004 for PGI 5.2.

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 netCDF FTP site or on the web at the netCDF FAQ page. The 3.5.1 release notes contain information about this release.


You should have release 5.1-5 or newer in order to compile and run without incident.

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 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 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="-O -Msignextend -V" FC=pgf90 F90=pgf90 FFLAGS="-g -w -V"  \
CXX=pgCC CPPFLAGS="-DNDEBUG -DpgiFortran" ./configure -prefix=/tmp/final >& config.log

make >& make.log

make test >& make_test.log

You can compare your log files with ours: config.log, make.log, and make_test.log.

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.

Click me