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