NetCDF4

From GHER

(Difference between revisions)
Jump to: navigation, search
(NetCDF4)
(octcdf)
 
Line 42: Line 42:
  ./configure --prefix $PREFIX --disable-static --enable-netcdf-4 --enable-shared  --with-hdf5=$HOME/local-gcc --with-pic FCFLAGS=-fPIC FFLAGS=-fPIC FC=gfortran && make -j 8
  ./configure --prefix $PREFIX --disable-static --enable-netcdf-4 --enable-shared  --with-hdf5=$HOME/local-gcc --with-pic FCFLAGS=-fPIC FFLAGS=-fPIC FC=gfortran && make -j 8
-
 
-
== octcdf ==
 
-
 
-
unset CC
 
-
unset CXX
 
-
unset F77
 
-
unset LDFLAGS
 
-
unset CPPFLAGS
 
-
export LDFLAGS="-L/home/abarth/opt/netcdf-4.0/lib  -lnetcdf -L/home/abarth/local-gcc/lib -lhdf5_hl -lhdf5 -lz -lm $(mkoctfile -p LDFLAGS)"
 
-
export CPPFLAGS="-I/home/abarth/opt/netcdf-4.0/include $(mkoctfile -p CPPFLAGS)"cpr:~/Octave/octcdf/src
 
-
export LD_LIBRARY_PATH="/home/abarth/opt/netcdf-4.0/lib:$LD_LIBRARY_PATH"
 
-
./configure
 
-
make
 
-
 
= Intel compiler =
= Intel compiler =

Latest revision as of 20:25, 16 June 2015

NetCDF 4 depends on HDF5 1.8.1 and zlib

Contents

GCC

HDF5

export PREFIX=$HOME/opt/netcdf-4.1.2
wget -O - wget ftp://ftp.hdfgroup.org/HDF5/current/src/hdf5-1.8.6.tar.gz | tar zxvf -
cd hdf5-1.8.6/
./configure --prefix $PREFIX --enable-static --enable-hl --enable-shared --with-pic
make  &> make.log
make check &> make_check.log
make install
cd ..
wget http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-4.1.2.tar.gz
tar zxf netcdf.tar.gz
cd netcdf-4.1.2
./configure --prefix $PREFIX --enable-static --enable-shared --enable-netcdf-4 --enable-dap --enable-ncgen4    --disable-cxx --with-hdf5=$PREFIX  --with-pic FC=gfortran
make &> make.log
make check &> make_check.log
make install
cd ..

Notes:

  • --with-pic is necessary if static libraries are used for dynamic libraries (e.g. *.oct or *.mex file for octave or matlab)
  • FC=gfortran is necessary on nic3, otherwise:
ncfortran.h:24:42: error: NF_INT_IS_C_... not defined: No such file or directory



add to following to .bashrc

export LD_LIBRARY_PATH="$HOME/opt/netcdf-4.1.2/lib:$LD_LIBRARY_PATH"
export PATH="$HOME/opt/netcdf-4.1.2/bin:$PATH"

64-bit processor

./configure --prefix $PREFIX --disable-static --enable-netcdf-4 --enable-shared  --with-hdf5=$HOME/local-gcc --with-pic FCFLAGS=-fPIC FFLAGS=-fPIC FC=gfortran && make -j 8

Intel compiler

HDF5

./configure FC=ifort CC=icc --prefix ~/opt/intel-11.1/hdf5-1.8.9
make | tee make.log
make check | tee make_check.log
make install

NetCDF4

The option --with-hdf5=/path/to/hdf5 does not seem to exist anymore

./configure CC=icc FC=ifort --disable-cxx --prefix ~/opt/intel-11.1/netcdf-4.1.3 LDFLAGS="-L$HOME/opt/intel-11.1/hdf5-1.8.9/lib"  CPPFLAGS="-I$HOME/opt/intel-11.1/hdf5-1.8.9/include"
make | tee make.log
make check | tee make_check.log
make install

python-netcdf4

system-wide installation

sudo easy_install netcdf4

Home installation

NETCDF4_DIR=$PREFIX HDF5_DIR=$PREFIX PYTHONPATH=$HOME/Python/packages easy_install -d $HOME/Python/packages netcdf4
Personal tools