Commit b14aac734dec2a252fd28aadfd139a3f8aeec768

Authored by Benjamin Renard
1 parent 04317ed4

Add netCDF library with a script to install it with the parallel support

.gitignore 0 → 100644
... ... @@ -0,0 +1 @@
  1 +netcdf/tmp/
... ...
hdf5/hdf5-1.8.15.tar 0 → 100644
No preview for this file type
mpich/mpich-3.1.4.tar.gz 0 → 100644
No preview for this file type
netcdf/README 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +To install netcdf with parallel support (this will install also zlib, mpich and hdf5), run the script :
  2 +
  3 +> ./build_with_parallel_support.sh INSTALL_DIR
  4 +
  5 +After installation, you can delete the "tmp" directory.
... ...
netcdf/build_with_parallel_support.sh 0 → 100755
... ... @@ -0,0 +1,104 @@
  1 +#!/bin/bash
  2 +#
  3 +
  4 +if [ -z "${1}" ]; then
  5 + echo "Usage : ${0} INSTALL_DIR"
  6 + exit 1
  7 +else
  8 + INSTALL_DIR=${1}
  9 +fi;
  10 +
  11 +ZLIB_ARCHIVE_NAME="zlib-1.2.8"
  12 +ZLIB_ARCHIVE_PATH="../zlib/"$ZLIB_ARCHIVE_NAME".tar.gz"
  13 +
  14 +MPICH_ARCHIVE_NAME="mpich-3.1.4"
  15 +MPICH_ARCHIVE_PATH="../mpich/"$MPICH_ARCHIVE_NAME".tar.gz"
  16 +
  17 +HDF5_ARCHIVE_NAME="hdf5-1.8.15"
  18 +HDF5_ARCHIVE_PATH="../hdf5/"$HDF5_ARCHIVE_NAME".tar"
  19 +
  20 +NETCDF_ARCHIVE_NAME="netcdf-4.3.3.1"
  21 +NETCDF_ARCHIVE_PATH="./"$NETCDF_ARCHIVE_NAME".tar.gz"
  22 +
  23 +SCRIPT_DIR=`pwd`
  24 +
  25 +TMP_DIR=$SCRIPT_DIR"/tmp"
  26 +
  27 +mkdir -p $TMP_DIR
  28 +mkdir -p $INSTALL_DIR
  29 +
  30 +echo "--------";
  31 +echo "| ZLIB |";
  32 +echo "--------";
  33 +
  34 +tar xzf $ZLIB_ARCHIVE_PATH -C $TMP_DIR
  35 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress zlib archive"; exit $?; fi
  36 +
  37 +cd $TMP_DIR"/"$ZLIB_ARCHIVE_NAME
  38 +
  39 +./configure --prefix=$INSTALL_DIR
  40 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure zlib"; exit $?; fi
  41 +make
  42 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile zlib"; exit $?; fi
  43 +make install
  44 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot install zlib"; exit $?; fi
  45 +
  46 +echo "---------";
  47 +echo "| MPICH |";
  48 +echo "---------";
  49 +
  50 +cd $SCRIPT_DIR
  51 +tar xzf $MPICH_ARCHIVE_PATH -C $TMP_DIR
  52 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress MPICH archive"; exit $?; fi
  53 +
  54 +cd $TMP_DIR"/"$MPICH_ARCHIVE_NAME
  55 +
  56 +./configure CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" --disable-fortran --prefix=$INSTALL_DIR |& tee c.txt
  57 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure MPICH"; exit $?; fi
  58 +make 2>&1 | tee m.txt
  59 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile MPICH"; exit $?; fi
  60 +make install |& tee mi.txt
  61 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot install MPICH"; exit $?; fi
  62 +
  63 +export PATH=$INSTALL_DIR"/bin":$PATH
  64 +export LD_LIBRARY_PATH=$INSTALL_DIR"/lib":$LD_LIBRARY_PATH
  65 +
  66 +echo "------------------------------";
  67 +echo "| HDF5 with parallel support |";
  68 +echo "------------------------------";
  69 +
  70 +cd $SCRIPT_DIR
  71 +tar xf $HDF5_ARCHIVE_PATH -C $TMP_DIR
  72 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress HDF5 archive"; exit $?; fi
  73 +
  74 +cd $TMP_DIR"/"$HDF5_ARCHIVE_NAME
  75 +
  76 +CC=$INSTALL_DIR/bin/mpicc ./configure --prefix=$INSTALL_DIR --enable-parallel --disable-fortran --with-zlib=$INSTALL_DIR
  77 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure HDF5"; exit $?; fi
  78 +make
  79 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile HDF5"; exit $?; fi
  80 +make check
  81 +if [[ $? != 0 ]]; then echo "[ERROR] Check error with HDF5"; exit $?; fi
  82 +make install
  83 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot install HDF5"; exit $?; fi
  84 +
  85 +echo "--------------------------------";
  86 +echo "| NetCDF with parallel support |";
  87 +echo "--------------------------------";
  88 +
  89 +cd $SCRIPT_DIR
  90 +tar xzf $NETCDF_ARCHIVE_PATH -C $TMP_DIR
  91 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot decompress NetCDF archive"; exit $?; fi
  92 +
  93 +cd $TMP_DIR"/"$NETCDF_ARCHIVE_NAME
  94 +
  95 +CPPFLAGS=-I$INSTALL_DIR/include LDFLAGS=-L$INSTALL_DIR/lib ./configure --prefix=$INSTALL_DIR
  96 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot configure NetCDF"; exit $?; fi
  97 +make
  98 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot compile NetCDF"; exit $?; fi
  99 +make check
  100 +if [[ $? != 0 ]]; then echo "[ERROR] Check error with NetCDF"; exit $?; fi
  101 +make install
  102 +if [[ $? != 0 ]]; then echo "[ERROR] Cannot install NetCDF"; exit $?; fi
  103 +
  104 +echo "[DONE]"
... ...
netcdf/netcdf-4.3.2.tar.gz deleted
No preview for this file type
netcdf/netcdf-4.3.3.1.tar.gz 0 → 100644
No preview for this file type
zlib/zlib-1.2.8.tar.gz 0 → 100644
No preview for this file type