Added configurable compiler selection for different platforms.

This commit is contained in:
Christoph Niethammer 2011-07-06 21:19:40 +00:00
parent 523eadc411
commit d4f1c488a3
10 changed files with 83 additions and 39 deletions

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=tfn"
COMPILER_VERSION_CMD="cc -V 2>&1| awk '/Version/{ print \$5; }'"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=tfn"
COMPILER_VERSION_CMD="cc -dumpversion"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=tfn"
COMPILER_VERSION_CMD="cc -dumpversion"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=ftn"
COMPILER_VERSION_CMD="cc -V 2> /dev/null | awk '/pgcc/{print \$2}' | sed -e 's/-/./'"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran"
COMPILER_VERSION_CMD="gcc -dumpversion"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran"
COMPILER_VERSION_CMD="gcc -dumpversion"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=icc CXX=icpc++ FC=ifort F77=ifort"
COMPILER_VERSION_CMD="icc -dumpversion"

View file

@ -0,0 +1,3 @@
#!/bin/bash
COMPILER_OPTS="CC=pgcc CXX=pgCC FC=pgf95 F77=pgf77"
COMPILER_VERSION_CMD="pgcc -V | awk '/pgcc/{print \$2}' | sed -e 's/-/./'"

View file

@ -0,0 +1 @@
gnu

97
sit
View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -l
#
# Install script inspired by the ebuild system of Gentoo Linux
#
@ -17,6 +17,21 @@ if [[ -e $SIT_CONFIG_FILE ]] ; then
fi
source "$SIT_PATH/functions.sh"
# check platform
# TODO: add ip addresses for identification?
case $HOSTNAME in
cl3fr1|cl3fr2|imager)
PLATFORM="laki"
;;
xe601)
PLATFORM="hermit"
;;
*)
sit_fail "Unknown host $HOSTNAME"
;;
esac
sit_info "Platform: $PLATFORM"
# compiler to use
# (gnu|intel|pgi)
@ -30,51 +45,53 @@ PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR}
# Compiler specifications
if [ "$COMPILER" == "system" ] ; then
echo "Using system default compiler"
else
if [ -z "$COMPILER_VERSION" ] ; then
COMPILER_MODULE=compiler/${COMPILER}
else
COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION}
fi
echo "Loading compiler module ${COMPILER_MODULE}"
module load ${COMPILER_MODULE}
COMPILER_CONFIG_FILE="$SIT_PATH/etc/platform-configs/${PLATFORM}/compiler/${COMPILER}"
if [ -e $COMPILER_CONFIG_FILE ] ; then
source $COMPILER_CONFIG_FILE
else
sit_fail "Could not find configuration file for compiler '${COMPILER}' on platform '${PLATFORM}'."
fi
case ${COMPILER} in
system)
COMPILER="" # prevent any compiler specs in the prefix
;;
gnu)
COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran"
if [ "x${COMPILER_VERSION}" == "x" ] ; then
COMPILER_VERSION=$(gcc -dumpversion)
fi
;;
intel)
COMPILER_OPTS="CC=icc CXX=icpc FC=ifort F77=ifort"
if [ "x${COMPILER_VERSION}" == "x" ] ; then
COMPILER_VERSION=$(icc -dumpversion)
fi
;;
pgi)
COMPILER_OPTS="CC=pgcc CXX=pgCC FC=pgf95 F77=pgf77"
if [ "x${COMPILER_VERSION}" == "x" ] ; then
COMPILER_VERSION=$(pgcc -V | awk '/pgcc/{print $2}')
fi
;;
*)
echo "Unknown compiler ${COMPILER}."
;;
case $PLATFORM in
hermit)
if [ "$COMPILER" == "system" ] ; then
echo "Using system default compiler"
COMPILER="" # prevent any compiler specs in the prefix
else
module swap $(module list -l 2>&1 | awk '/^PrgEnv-/{print $1}') PrgEnv-${COMPILER}
if [ ! -z "$COMPILER_VERSION" ] ; then
if [ "${COMPILER}" == "gnu" ] ; then
module swap gcc gcc/$COMPILER_VERSION
else
module swap $COMPILER $COMPILER/$COMPILER_VERSION
fi
fi
fi
;;
laki|*)
if [ "$COMPILER" == "system" ] ; then
echo "Using system default compiler"
COMPILER="" # prevent any compiler specs in the prefix
else
if [ -z "$COMPILER_VERSION" ] ; then
COMPILER_MODULE=compiler/${COMPILER}
else
COMPILER_MODULE=compiler/${COMPILER}/${COMPILER_VERSION}
fi
echo "Loading compiler module ${COMPILER_MODULE}"
module load ${COMPILER_MODULE}
fi
;;
esac
# reevaluate compiler version
COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD")
# make the compiler variables CC, CXX, FC and F77 available
if [ ! -z "$COMPILER_OPTS" ] ; then
export ${COMPILER_OPTS}
fi
echo "Using compiler: $COMPILER version: $COMPILER_VERSION"
if [ ! -z "$MPI" ] ; then
MPI_MODULE="mpi/$MPI"
@ -97,6 +114,7 @@ else
sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE"
fi
PACKAGENAME=${PACKAGENAME:=$PACKAGE}
# construct the final installation directory path
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}"
@ -125,13 +143,14 @@ LOGDIR=${WORKDIR}
# the class file like CATEGORY or PACKAGE)
source $SCLASS_DIR/$SCLASSFILE
echo "Package name: $PACKAGENAME"
echo "Installation PREFIX: $PREFIX"
echo "Working dir: $WORKDIR"
echo "Source dir: $SRCDIR"
echo "Build dir: $BUILDDIR"
echo "Logfile dir: $LOGDIR"
sit_countdown 2
sit_countdown 3
if [ -d ${WORKDIR} ] ; then
sit_info "Removing existing working directory ${WORKDIR}"