sit/mcxx-nanox_install.sh

165 lines
3.8 KiB
Bash
Raw Normal View History

2011-02-17 14:06:36 +00:00
#!/bin/sh
# installation script for Mercurium Compiler + Nanons++
#
2011-03-04 15:35:09 +00:00
# Christoph Niethammer <niethammer@hlrs.de> (C) 2011
2011-02-17 14:06:36 +00:00
#
# 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:=}
MAKEOPTS="-j3"
2011-02-17 14:06:36 +00:00
# package to build
CATEGORY="compiler"
PACKAGE="mcxx-nanox"
VERSION="master"
PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:="$(date +%Y-%m-%d)"}
2011-02-17 14:06:36 +00:00
# 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:="yes"}
2011-02-17 14:06:36 +00:00
# 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
2011-02-17 14:06:36 +00:00
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}-${COMPILER}-${COMPILER_VERSION}${PACKAGE_DESCRIPTOR}"
echo "PREFIX: $PREFIX"
sleep 2
2011-02-17 14:06:36 +00:00
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
2011-02-17 14:06:36 +00:00
rm -rf build
fi
mkdir build
cd build
../configure --prefix=$PREFIX $* 2>&1 | tee "configure.log"; ( exit ${PIPESTATUS} )
2011-02-17 14:06:36 +00:00
echo -n "compiling... "
make $MAKEOPTS 2>&1 | tee "make.log"; ( exit ${PIPESTATUS} )
2011-02-17 14:06:36 +00:00
echo -n "installing... "
make install 2>&1 | tee "make_install.log"; ( exit ${PIPESTATUS} )
bzip2 *.log
2011-02-17 14:06:36 +00:00
cd ..
echo "Success"
}
cd $nanox_src_dir
rm -rf autom4te.cache
#git pull
git checkout master
2011-02-17 14:06:36 +00:00
./autogen.sh
nanox_version=$(git rev-list -n 1 master)
cd $mcxx_src_dir
rm -rf autom4te.cache
#git pull
git checkout master
2011-02-17 14:06:36 +00:00
./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... "
2011-02-17 14:06:36 +00:00
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