161 lines
3.6 KiB
Bash
Executable file
161 lines
3.6 KiB
Bash
Executable file
#!/bin/sh
|
|
# installation script for Mercurium Compiler + Nanons++
|
|
#
|
|
# Christoph Niethammer <niethammer@hlrs.de> (C) 2011
|
|
#
|
|
|
|
# exit on any error!
|
|
set -e
|
|
|
|
# directory containing the source tar files
|
|
SRC_POOL="$HOME/src"
|
|
|
|
# basic installation directory
|
|
PREFIX_BASE=${PREFIX_BASE:=$HOME/bin}
|
|
|
|
# compiler to use
|
|
# (gnu|intel|pgi)
|
|
COMPILER=${COMPILER:=gnu}
|
|
# use specific compiler version
|
|
COMPILER_VERSION=${COMPILER_VERSION:=}
|
|
|
|
# package to build
|
|
CATEGORY="compiler"
|
|
PACKAGE="mcxx-nanox"
|
|
VERSION="master"
|
|
PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:="$(date +%Y-%m-%d)"}
|
|
|
|
# add a descriptor at the end of the installation path e.g. for special config options etc.
|
|
PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR}
|
|
|
|
mcxx_src_dir="$SRC_POOL/mcxx/mcxx.git"
|
|
nanox_src_dir="$SRC_POOL/nanox/nanox.git"
|
|
|
|
# enable instrumentation (no|yes)
|
|
instrumentation=${instrumentation:="no"}
|
|
|
|
# Compiler specifications
|
|
|
|
if [ "x${COMPILER_VERSION}" != "x" ]
|
|
then
|
|
COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION}
|
|
else
|
|
COMPILER_MODULE=compiler/${COMPILER}
|
|
fi
|
|
|
|
echo "Loading compiler module ${COMPILER_MODULE}"
|
|
module load ${COMPILER_MODULE}
|
|
|
|
case ${COMPILER} in
|
|
gnu)
|
|
COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran"
|
|
COMPILER_VERSION=$(gcc -dumpversion)
|
|
;;
|
|
intel)
|
|
COMPILER_OPTS="CC=icc CXX=icpc FC=ifort F77=ifort"
|
|
COMPILER_VERSION=$(icc -dumpversion)
|
|
;;
|
|
pgi)
|
|
COMPILER_OPTS="CC=pgcc CXX=pgCC FC=pgf95 F77=pgf77"
|
|
COMPILER_VERSION=$(pgcc -V | awk '/pgcc/{print $2}')
|
|
;;
|
|
*)
|
|
echo "Unknown compiler ${COMPILER}."
|
|
;;
|
|
esac
|
|
|
|
if [ "$instrumentation" = "yes" ]; then
|
|
module load performance/extrae
|
|
echo "Building with EXTRAE_HOME=$EXTRAE_HOME"
|
|
sleep 2
|
|
withextrae="--with-extrae=$EXTRAE_HOME"
|
|
fi
|
|
|
|
|
|
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}-${COMPILER}-${COMPILER_VERSION}${PACKAGE_DESCRIPTOR}"
|
|
echo "PREFIX: $PREFIX"
|
|
sleep 2
|
|
|
|
|
|
|
|
fail ()
|
|
{
|
|
echo
|
|
echo "Installation failed"
|
|
echo "Check $LOGFILE to find what went wrong"
|
|
exit 1
|
|
}
|
|
|
|
make_package ()
|
|
{
|
|
local dir=$1
|
|
shift
|
|
|
|
cd $dir
|
|
|
|
echo -n "configuring... "
|
|
if [[ -d build ]] ; then
|
|
rm -rf build
|
|
fi
|
|
mkdir build
|
|
cd build
|
|
../configure --prefix=$PREFIX $* || fail
|
|
echo -n "compiling... "
|
|
make || fail
|
|
echo -n "installing... "
|
|
make install || fail
|
|
cd ..
|
|
echo "Success"
|
|
}
|
|
|
|
|
|
cd $nanox_src_dir
|
|
rm -rf autom4te.cache
|
|
#git pull
|
|
git checkout master
|
|
./autogen.sh
|
|
nanox_version=$(git rev-list -n 1 master)
|
|
|
|
|
|
cd $mcxx_src_dir
|
|
rm -rf autom4te.cache
|
|
#git pull
|
|
git checkout master
|
|
./autogen.sh
|
|
mcxx_version=$(git rev-list -n 1 master)
|
|
|
|
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}-${COMPILER}-${COMPILER_VERSION}${PACKAGE_DESCRIPTOR}"
|
|
|
|
echo -n "Installing Nanos++ runtime library... "
|
|
make_package $nanox_src_dir $withextrae $cudadir
|
|
echo -n "Installing Mercurium compiler... "
|
|
make_package $mcxx_src_dir --enable-openmpt
|
|
|
|
echo "mcxx: $mcxx_version" > $PREFIX/VERSION.txt
|
|
echo "nanox: $nanox_version" >> $PREFIX/VERSION.txt
|
|
|
|
echo "Environment installed successfully"
|
|
|
|
|
|
|
|
module unload compiler
|
|
|
|
cat <<EOF
|
|
##############################################################################
|
|
# IMPORTANT!
|
|
##############################################################################
|
|
# To complete the installation please run the follwoing command:
|
|
#module load ${COMPILER_MODULE}
|
|
#cd ${BUILDDIR}
|
|
#make install 2>&1 | tee make_install.log
|
|
#bzip2 *.log
|
|
#mv *.log.bz2 ${PREFIX}/
|
|
cd ${PREFIX}
|
|
chmod -R g+rwX .
|
|
chmod -R o+rX .
|
|
# Finally do not forget to provide a module file!
|
|
##############################################################################
|
|
EOF
|
|
|
|
exit 0
|
|
|