NetCDF installation

From GHER

Jump to: navigation, search

Contents

Download

wget -O - ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz  | tar xvzf -
cd netcdf-*

Compiling NetCDF on Linux

First compile the C package (netcdf-x.y.tar.gz) and then the Fortran package (netcdf-fortran-x.y.tar.gz).

You must be root to execute make install if you install the NetCDF library to its default location which is /usr/local.


./configure --prefix /home/ulg/gher/abarth/local/intel-14.0.1/ FC=ifort CPPFLAGS="$(nc-config --cflags)" LDFLAGS="$(nc-config --libs)"

Is everything there ?

After make install you should have (at least) the following files:

  • /usr/local/include/netcdf.inc
  • /usr/local/include/netcdf.mod (case maybe different, you may have e.g. NETCDF.mod)
  • /usr/local/lib/libnetcdf.a

You can install NetCDF at a different location. This is necessary for example if you don't have root privileges on your machine. You use the --prefix option of the configure script to specify a different location:

./configure --prefix=$HOME/netcdf FC=gfortran

This installs NetCDF in your home directory.

Telling DINEOF where you installed NetCDF

If NetCDF is installed in a non-standard location, you have to specify with the -I and -L options where the NetCDF include files (netcdf.inc and netcdf.mod) and the NetCDF library (libnetcdf.a) can be found. These options are added in the Makefile variables INCLUDE, DINEOF_LIBRARIES and CROSSVAL_LIBRARIES, for example:

F90FLAGS = -I$(HOME)/netcdf/include ...
DINEOF_LIBRARIES= -L$(HOME)/netcdf/lib -lnetcdf ...
CROSSVAL_LIBRARIES= -L$(HOME)/netcdf/lib -lnetcdf ...

These variables are defined in Compilers/OS-compiler.mk.


NetCDF on Nic 3

  • HDF5-1.8.6 compiled with gcc 4.1.2 (system compiler) in /u/mc/opt/hdf5-1.8.6
./configure --prefix /u/mc/opt/hdf5-1.8.6 --enable-static --enable-hl --enable-shared --with-pic

make checked reports:

grep '^Testing.*FAIL' make_check.log | wc -l
0
grep '^Testing.*SKIP' make_check.log | wc -l
17
grep '^Testing.*PASSED' make_check.log | wc -l
1761


  • NetCDF 4.1.3

Fortran ifort 10.0

module purge
module load intel/compiler/64/11.0/074
./configure --prefix=$HOME/opt/intel-11.0/netcdf-4.1.3 FC=ifort CPPFLAGS="-I/u/mc/opt/hdf5-1.8.6/include" LDFLAGS="-L/u/mc/opt/hdf5-1.8.6/lib" && make && make check > make_check.log

Fortran ifort 11.1

module purge
module load ict/compiler/64/11.1/038
make clean 
./configure --prefix=$HOME/opt/intel-11.1/netcdf-4.1.3 FC=ifort CPPFLAGS="-I/u/mc/opt/hdf5-1.8.6/include" LDFLAGS="-L/u/mc/opt/hdf5-1.8.6/lib" && make && make check &>  make_check.log

0 non-expected failures.

Personal tools