install.sh 3.75 KB
Newer Older
Vincent Chabannes's avatar
Vincent Chabannes committed
1 2
#!/bin/bash

3 4
source ../common.sh

Vincent Chabannes's avatar
Vincent Chabannes committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
LIB_VERSION=develop
GCC_VERSION=6.4.0
MPI_LIB=openmpi
MPI_VERSION=1.10.7 #2.1.1 #1.10.7
GCC_FULL=gcc-$GCC_VERSION
GCC_SHORT="gcc${GCC_VERSION//.}"
MPI_FULL=${MPI_LIB}-${MPI_VERSION}
MPI_SHORT="${MPI_LIB}${MPI_VERSION//.}"

LIB_NAME="feelpp-lib"
LIB_TOOLBOXES_NAME="feelpp-toolboxes"
LIB_FULLNAME=${LIB_NAME}-${LIB_VERSION}
LIB_TOOLBOXES_FULLNAME=${LIB_TOOLBOXES_NAME}-${LIB_VERSION}
SUB_LIB_DIR=${LIB_NAME}/${LIB_VERSION}/${GCC_FULL}/${MPI_FULL}
SUB_TOOLBOXES_DIR=${LIB_TOOLBOXES_NAME}/${LIB_VERSION}/${GCC_FULL}/${MPI_FULL}
20
SRC_DIR=${PREWORK_DIR}/${SUB_LIB_DIR}
Vincent Chabannes's avatar
Vincent Chabannes committed
21 22 23
GIT_URL="https://github.com/feelpp/feelpp.git"
BUILD_LIB_DIR=${SRC_DIR}/build-lib
BUILD_TOOLBOXES_DIR=${SRC_DIR}/build-toolboxes
24 25
INSTALL_LIB_DIR=${PREINSTALL_DIR}/${SUB_LIB_DIR}
INSTALL_TOOLBOXES_DIR=${PREINSTALL_DIR}/${SUB_TOOLBOXES_DIR}
Vincent Chabannes's avatar
Vincent Chabannes committed
26
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
27
MODULE_LIB_DIR=${PREMODULE_DIR}/libs/${LIB_NAME}
Vincent Chabannes's avatar
Vincent Chabannes committed
28 29
MODULE_LIB_PATH=${MODULE_LIB_DIR}/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}
MODULE_LIB_NAME=${LIB_NAME}/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}
30
MODULE_TOOLBOXES_DIR=${PREMODULE_DIR}/libs/${LIB_TOOLBOXES_NAME}
Vincent Chabannes's avatar
Vincent Chabannes committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
MODULE_TOOLBOXES_PATH=${MODULE_TOOLBOXES_DIR}/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}

FEELPP_PROFILE=feelpp.profile_${GCC_SHORT}_${MPI_SHORT}

install_lib()
{
module purge
module load ${FEELPP_PROFILE}
module list

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

if [[ ! -d $SRC_DIR/feelpp ]]; then
  mkdir -p $SRC_DIR
  cd  $SRC_DIR
  git clone $GIT_URL
else
  cd  $SRC_DIR/feelpp && git pull
fi
cd  $SRC_DIR/feelpp && git submodule update --init --recursive
    
rm -rf $BUILD_LIB_DIR
mkdir $BUILD_LIB_DIR
cd $BUILD_LIB_DIR || exit 1
cmake -DCMAKE_BUILD_TYPE=Release \
      -DCMAKE_CXX_COMPILER=clang++ \
      -DCMAKE_C_COMPILER=clang \
      -DCMAKE_INSTALL_PREFIX=${INSTALL_LIB_DIR} \
      -DCMAKE_CXX_FLAGS="-Wno-expansion-to-defined" \
      -DFEELPP_ENABLE_OMC=OFF  -DFEELPP_ENABLE_FMILIB=OFF \
       $SRC_DIR/feelpp || exit 1
cd $BUILD_LIB_DIR/cmake && make install || exit 1
cd $BUILD_LIB_DIR/contrib && make install -j16 || exit 1
cd $BUILD_LIB_DIR/feel && make install -j16 || exit 1
cd $BUILD_LIB_DIR/applications/mesh && make install -j16 || exit 1
cd $BUILD_LIB_DIR/applications/databases && make install -j16 || exit 1
}

install_lib_tooboxes()
{
    module purge
    module load feelpp-lib/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}
    module list

    if [[ ! -d $SRC_DIR/feelpp ]]; then
	echo "no src dir : exit"
	exit 1
    fi

    echo "start configure of toolboxes with FEELPP_DIR=${FEELPP_DIR}" 
    
    rm -rf $BUILD_TOOLBOXES_DIR
    mkdir $BUILD_TOOLBOXES_DIR
    cd $BUILD_TOOLBOXES_DIR || exit 1

    cmake -DCMAKE_BUILD_TYPE=Release \
	  -DCMAKE_CXX_COMPILER=clang++ \
	  -DCMAKE_C_COMPILER=clang \
	  -DCMAKE_INSTALL_PREFIX=${INSTALL_TOOLBOXES_DIR} \
	  -DFEELPP_DIR=${FEELPP_DIR} \
	  $SRC_DIR/feelpp/toolboxes || exit 1
    make install -j16
}

install_module_lib()
{
    cd $SCRIPT_DIR
    mkdir -p ${MODULE_LIB_DIR}

    export LIB_NAME
    export LIB_VERSION
    export INSTALL_LIB_DIR
    export FEELPP_PROFILE
    envtpl  --keep-template -o $MODULE_LIB_PATH module_lib.tmpl
}

install_module_tooboxes()
{
    cd $SCRIPT_DIR
    mkdir -p ${MODULE_TOOLBOXES_DIR}
    export LIB_TOOLBOXES_NAME
    export LIB_VERSION
    export INSTALL_TOOLBOXES_DIR
    export MODULE_LIB_NAME
    envtpl  --keep-template -o $MODULE_TOOLBOXES_PATH module_toolboxes.tmpl
}

if [[ $1 == "module" ]]; then
    install_module_lib
    install_module_tooboxes
    exit 1
fi

if [[ $1 == "feelpp-lib" ]]; then
    install_lib
    install_module_lib
    exit 1
fi

if [[ $1 == "feelpp-toolboxes" ]]; then
    install_lib_tooboxes
    install_module_tooboxes
    exit 1
fi

install_lib
install_module_lib
install_lib_tooboxes
install_module_tooboxes