install.sh 2.67 KB
Newer Older
Matthieu Boileau's avatar
Matthieu Boileau committed
1 2
#!/bin/bash

3 4
source ../common.sh

Matthieu Boileau's avatar
Matthieu Boileau committed
5
LIB_NAME="paraview"
6 7
LIB_VERSION_URL=5.4.1
LIB_VERSION=${LIB_VERSION_URL}-py3
Matthieu Boileau's avatar
Matthieu Boileau committed
8 9 10 11 12 13 14 15 16 17 18 19 20
GCC_VERSION=6.4.0
MPI_LIB=openmpi
MPI_VERSION=1.10.7
HDF5_VERSION=1.10.1
CMAKE_VERSION=3.9.2

LIB_FULLNAME=${LIB_NAME}-${LIB_VERSION}
LIB_VERSION_SHORT="${LIB_VERSION%.*}"
GCC_FULL=gcc-$GCC_VERSION
GCC_SHORT="gcc${GCC_VERSION//.}"
MPI_FULL=${MPI_LIB}-${MPI_VERSION}
MPI_SHORT="${MPI_LIB}${MPI_VERSION//.}"
SUB_DIR=${LIB_NAME}/${LIB_VERSION}/${GCC_FULL}/${MPI_FULL}
21
WORK_DIR=${PREWORK_DIR}/${SUB_DIR}
Matthieu Boileau's avatar
Matthieu Boileau committed
22 23
SRC_DIR=${WORK_DIR}/${LIB_FULLNAME}
ARCHIVE=${SRC_DIR}.tar.gz
24
URL="https://www.paraview.org/paraview-downloads/download.php?submit=Download&version=v${LIB_VERSION_SHORT}&type=binary&os=Sources&downloadFile=ParaView-v${LIB_VERSION_URL}.tar.gz"
Matthieu Boileau's avatar
Matthieu Boileau committed
25
BUILD_DIR=${WORK_DIR}/${LIB_FULLNAME}-build
26
INSTALL_DIR=${PREINSTALL_DIR}/${SUB_DIR}
Matthieu Boileau's avatar
Matthieu Boileau committed
27
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
28
MODULE_DIR=${PREMODULE_DIR}/tools/${LIB_NAME}
Matthieu Boileau's avatar
Matthieu Boileau committed
29 30
MODULE_PATH=${MODULE_DIR}/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}

31

Matthieu Boileau's avatar
Matthieu Boileau committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45
install_lib()
{
module purge
module load gcc/${GCC_VERSION}
module load ${MPI_LIB}/${MPI_VERSION}_${GCC_SHORT}
module load hdf5/${HDF5_VERSION}_${GCC_SHORT}_${MPI_SHORT}
module load cmake/${CMAKE_VERSION}_${GCC_SHORT}

gcc --version |head -n 1
mpirun --version |head -n 1
sleep 2

if [[ ! -f $ARCHIVE ]]; then
  mkdir -p $WORK_DIR
46
  wget $URL -O $ARCHIVE || exit 1
Matthieu Boileau's avatar
Matthieu Boileau committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
fi

if [[ ! -d $SRC_DIR ]]; then
  EXTRACT_DIR=${ARCHIVE%.tar*}
  mkdir -p $EXTRACT_DIR
  tar --extract --file=${ARCHIVE} --strip-components=1 --directory=$EXTRACT_DIR
fi

if [[ ! -d $BUILD_DIR ]]; then
  mkdir $BUILD_DIR
  cd $BUILD_DIR
  cmake $SRC_DIR \
  -DCMAKE_C_COMPILER=`which gcc` \
  -DCMAKE_CXX_COMPILER=`which g++` \
  -DBUILD_TESTING=OFF \
  -DVTK_RENDERING_BACKEND=OpenGL2 \
  -DPARAVIEW_ENABLE_CATALYST=ON \
  -DPARAVIEW_ENABLE_PYTHON=ON \
65 66 67
  -DPYTHON_LIBRARY="/usr/lib/x86_64-linux-gnu/libpython3.5m.so" \
  -DPYTHON_INCLUDE_DIR="/usr/include/python3.5" \
  -DPYTHON_EXECUTABLE="/usr/bin/python3" \
Matthieu Boileau's avatar
Matthieu Boileau committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
  -DPARAVIEW_INSTALL_DEVELOPMENT_FILES=ON \
  -DPARAVIEW_USE_MPI=ON \
  -DPARAVIEW_QT_VERSION=4 \
  -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR || exit 1
fi

cd $BUILD_DIR
make -j || exit 1
make -j install || exit 1
}

install_module()
{
cd $SCRIPT_DIR
mkdir -p ${MODULE_DIR}

export LIB_NAME
export LIB_VERSION_SHORT
export LIB_VERSION
export INSTALL_DIR
export GCC_VERSION
export GCC_SHORT
export MPI_LIB
export MPI_VERSION
export MPI_SHORT
export HDF5_VERSION
envtpl  --keep-template -o $MODULE_PATH module.tmpl
}

if [[ $1 == "module" ]]
then
  install_module
100 101 102 103 104 105 106 107 108
elif [[ $1 == "clean" ]]
then
  if [[ -d $BUILD_DIR ]]
  then
    rm -rf $BUILD_DIR
  else
    echo "$BUILD_DIR does not exist"
    exit 1
  fi
Matthieu Boileau's avatar
Matthieu Boileau committed
109 110 111 112 113
else
  install_lib
  install_module
fi