NetCDF library

From GHER

Jump to: navigation, search

The following instructions describe the installation of the NetCDF 4 library, with the HDF5 storage format.

The installation of the packages and libraries was performed on nic3 in the directory /u/mc and on the computer gher01 in the directory /usr/local

Contents

Download the sources

  • Download the NetCDF sources from Unidata webpage:
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf.tar.gz
  • Extract the archive:
tar -xvf netcdf.tar.gz

NetCDF with Intel Compilers

Install HDF5 and zlib packages

  • Download:
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/hdf5-1.8.2.tar.gz
wget ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/zlib-1.2.3.tar.gz
  • Extract the archives:
tar -xvf hdf5-1.8.2.tar.gz
tar -xvf zlib-1.2.3.tar.gz
  • Install zlib first
cd /u/mc/zlib-1.2.3
./configure --prefix=/u/mc
make
make install
  • Install HDF5
cd /u/mc/hdf5-1.8.2
./configure --prefix=/u/mc
make
make check
make install

Notes:

  1. if you want to be sure to have the last version of zlib and hdf5, check ftp://ftp.unidata.ucar.edu/pub/netcdf/netcdf-4/
  2. that the make operation can take quite a long time.
  3. replace /u/mc by /usr/local (or something else) for an installation on you machine

Compile

  • Specify the compilation options you want:
export CC=icc
export FC=ifort
  • Launch the configuration
./configure --enable-netcdf-4 --with-hdf5=/u/mc/ --with-zlib=/u/mc/ --prefix=/u/mc/

where /u/mc can be replaced by the location you want.

  • Run the tests
make check

Note that some of the tests may fail, but usually that is not a problem.

  • Perform the installation
make install

Once the installation is performed, new directories will appear in /u/mc:

  • bin/
  • include/
  • lib/
  • share/

In particular, the netcdf library is located in lib:

nick3:/u/mc$ ls lib/
libhdf5.a      libhdf5_hl.so        libhdf5.la        libhdf5.so.6      libnetcdf_c++.a   libz.a
libhdf5_hl.a   libhdf5_hl.so.0      libhdf5.settings  libhdf5.so.6.0.1  libnetcdf_c++.la  pkgconfig
libhdf5_hl.la  libhdf5_hl.so.0.0.0  libhdf5.so        libnetcdf.a       libnetcdf.la


NetCDF with gcc

sudo aptitude install libhdf4-dev libhdf5-serial-dev 
./configure --enable-hdf4  --enable-cxx-4  --with-udunits --with-pic
make 
sudo make install


Failed options

--with-libcf
*** No rule to make target `../../libsrc/libnetcdf.la', needed by `cfcheck'.  Stop.
--enable-netcdf4
*** Testing HDF4/NetCDF-4 interoperability...
/bin/bash: line 5: 28738 Segmentation fault      ${dir}$tst
FAIL: tst_interops2
================================================
1 of 60 tests failed
================================================
Personal tools