install.sh 1.6 KB
Newer Older
Matthieu Boileau's avatar
Matthieu Boileau committed
1 2 3 4 5 6 7
#!/bin/bash

set -x 
LIB_NAME="fftw"
LIB_VERSION=3.3.6
GCC_VERSION=6.4.0
MPI_LIB=openmpi
8
MPI_VERSION=1.10.7
Matthieu Boileau's avatar
Matthieu Boileau committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

LIB_FULLNAME=${LIB_NAME}-${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}
WORK_DIR=/data/software/sources/${SUB_DIR}
SRC_DIR=${WORK_DIR}/${LIB_FULLNAME}-pl2
ARCHIVE=${SRC_DIR}.tar.gz
URL="http://www.fftw.org/${LIB_FULLNAME}-pl2.tar.gz"
#URL="http://75.98.172.202/${LIB_FULLNAME}-pl2.tar.gz"
BUILD_DIR=${WORK_DIR}/${LIB_FULLNAME}-build
INSTALL_DIR=/data/software/install/${SUB_DIR}
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MODULE_DIR=/data/software/modules/libs/${LIB_NAME}
MODULE_PATH=${MODULE_DIR}/${LIB_VERSION}_${GCC_SHORT}_${MPI_SHORT}

27
install_lib()
28
{
Matthieu Boileau's avatar
Matthieu Boileau committed
29 30 31 32
module purge
module load gcc/${GCC_VERSION}
module load ${MPI_LIB}/${MPI_VERSION}_${GCC_SHORT}

33
gcc --version | head -n 1
Matthieu Boileau's avatar
Matthieu Boileau committed
34
sleep 2
35
mpirun --version | head -n 1
Matthieu Boileau's avatar
Matthieu Boileau committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
sleep 2

if [[ ! -f $ARCHIVE ]]; then
  mkdir -p $WORK_DIR
  wget $URL -O $ARCHIVE
fi

if [[ ! -d $SRC_DIR ]]; then
  tar zxf $ARCHIVE --directory $WORK_DIR
fi

if [[ ! -d $BUILD_DIR ]]; then
  mkdir $BUILD_DIR
  cd $BUILD_DIR
  ${SRC_DIR}/configure \
  --prefix=${INSTALL_DIR} \
  --enable-mpi \
  --enable-shared
fi

cd $BUILD_DIR
make -j || exit 1
make -j install || exit 1
59
}
Matthieu Boileau's avatar
Matthieu Boileau committed
60

61
install_module()
62
{
Matthieu Boileau's avatar
Matthieu Boileau committed
63 64 65 66 67 68 69
cd $SCRIPT_DIR
mkdir -p ${MODULE_DIR}

export LIB_NAME
export LIB_VERSION
export INSTALL_DIR
envtpl  --keep-template -o $MODULE_PATH module.tmpl
70 71 72 73 74 75 76 77 78
}

if [[ $1 == "module" ]]
then
  install_module
else
  install_lib
  install_module
fi