sit/mcxx-nanox_install.sh
Christoph Niethammer a7960c93d3 Improved OMPSs build script.
* build master branch version
* add build date to prefix path
2024-03-28 02:43:55 +01:00

174 lines
3.9 KiB
Bash
Executable file

#!/bin/sh
# installation script for Mercurium Compiler + Nanons++
#
# Christoph Niethammer <christoph.niethammer@web.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="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
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 $MK_OPTS || fail
echo -n "installing... "
make install || fail
cd ..
echo "Success"
}
if [ "$instrumentation" = "yes" ]; then
echo -n "Installing Extrae instrumentation library... "
echo "Not available yet."
fail
tar zxf $EXTRAE_TAR
make_package ${EXTRAE_TAR%.tar*} --disable-doc
fi
cd $nanox_src_dir
# tar jxf $NANOS_TAR
rm -rf autom4te.cache
#git pull
git checkout master
./autogen.sh
nanox_version=$(git rev-list -n 1 master)
echo $nanox_version
if [ "$instrumentation" = "yes" ]; then
export CXXFLAGS="-DNANOS_INSTRUMENTATION_ENABLED"
export CFLAGS="-DNANOS_INSTRUMENTATION_ENABLED"
withextrae="--with-extrae=$PREFIX"
fi
#tar jxf $MERCURIUM_TAR
cd $mcxx_src_dir
rm -rf autom4te.cache
#git pull
git checkout master
./autogen.sh
mcxx_version=$(git rev-list -n 1 master)
echo $mcxx_version
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