diff --git a/etc/platform-configs/hermit/compiler/cray b/etc/platform-configs/hermit/compiler/cray new file mode 100644 index 0000000..7c98f53 --- /dev/null +++ b/etc/platform-configs/hermit/compiler/cray @@ -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; }'" diff --git a/etc/platform-configs/hermit/compiler/gnu b/etc/platform-configs/hermit/compiler/gnu new file mode 100644 index 0000000..c0af6aa --- /dev/null +++ b/etc/platform-configs/hermit/compiler/gnu @@ -0,0 +1,3 @@ +#!/bin/bash +COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=tfn" +COMPILER_VERSION_CMD="cc -dumpversion" diff --git a/etc/platform-configs/hermit/compiler/intel b/etc/platform-configs/hermit/compiler/intel new file mode 100644 index 0000000..c0af6aa --- /dev/null +++ b/etc/platform-configs/hermit/compiler/intel @@ -0,0 +1,3 @@ +#!/bin/bash +COMPILER_OPTS="CC=cc CXX=CC FC=ftn F77=tfn" +COMPILER_VERSION_CMD="cc -dumpversion" diff --git a/etc/platform-configs/hermit/compiler/pgi b/etc/platform-configs/hermit/compiler/pgi new file mode 100644 index 0000000..e5c81fd --- /dev/null +++ b/etc/platform-configs/hermit/compiler/pgi @@ -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/-/./'" diff --git a/etc/platform-configs/hermit/compiler/system b/etc/platform-configs/hermit/compiler/system new file mode 100644 index 0000000..918f7db --- /dev/null +++ b/etc/platform-configs/hermit/compiler/system @@ -0,0 +1,3 @@ +#!/bin/bash +COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran" +COMPILER_VERSION_CMD="gcc -dumpversion" diff --git a/etc/platform-configs/laki/compiler/gnu b/etc/platform-configs/laki/compiler/gnu new file mode 100644 index 0000000..918f7db --- /dev/null +++ b/etc/platform-configs/laki/compiler/gnu @@ -0,0 +1,3 @@ +#!/bin/bash +COMPILER_OPTS="CC=gcc CXX=g++ FC=gfortran F77=gfortran" +COMPILER_VERSION_CMD="gcc -dumpversion" diff --git a/etc/platform-configs/laki/compiler/intel b/etc/platform-configs/laki/compiler/intel new file mode 100644 index 0000000..c4539a1 --- /dev/null +++ b/etc/platform-configs/laki/compiler/intel @@ -0,0 +1,3 @@ +#!/bin/bash +COMPILER_OPTS="CC=icc CXX=icpc++ FC=ifort F77=ifort" +COMPILER_VERSION_CMD="icc -dumpversion" diff --git a/etc/platform-configs/laki/compiler/pgi b/etc/platform-configs/laki/compiler/pgi new file mode 100644 index 0000000..4b3e753 --- /dev/null +++ b/etc/platform-configs/laki/compiler/pgi @@ -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/-/./'" diff --git a/etc/platform-configs/laki/compiler/system b/etc/platform-configs/laki/compiler/system new file mode 120000 index 0000000..9893768 --- /dev/null +++ b/etc/platform-configs/laki/compiler/system @@ -0,0 +1 @@ +gnu \ No newline at end of file diff --git a/sit b/sit index e6fe48f..157e5e4 100755 --- a/sit +++ b/sit @@ -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}"