diff --git a/sit b/sit index c914d99..4030281 100755 --- a/sit +++ b/sit @@ -2,12 +2,15 @@ # # Install script inspired by the ebuild system of Gentoo Linux # -# Copyright (c) 2011-2018 Christoph Niethammer +# Copyright (c) 2011-2022 Christoph Niethammer # set -e #set -x +#source colors.sh +#echo -e "${RED}DEBUGME: $MPI_VERSION${ENDCOLOR}" + function show_help() { echo "Usage: $0 [options] [action] " echo "Options:" @@ -115,48 +118,30 @@ else fi -if [ "$COMPILER" == "system" ] ; then - echo "Using system default compiler" - COMPILER="" # prevent any compiler specs in the prefix -else - case $PLATFORM in - hazelhen) - 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 - # adjust MPICH and libsci versions to match compiler - # module load cray-mpich-compat/v7 || module load cray-mpich-compat/v6 - fi - MPI_DIR=$MPICH_DIR - module unload craype-hugepages16M - module sw craype-network-aries craype-network-none - module unload cray-mpich - module sw craype-haswell craype-sandybridge - ;; - hawk) - if [ -z "$COMPILER_VERSION" ] ; then - COMPILER_MODULE=${COMPILER} - else - COMPILER_MODULE=${COMPILER}/${COMPILER_VERSION} - fi - echo "Loading compiler module ${COMPILER_MODULE}" - module load ${COMPILER_MODULE} - ;; - laki|vulcan|*) - 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} - ;; - esac -fi +sit_info_verbose "COMPILER: $COMPILER" +sit_info_verbose "COMPILER version: $COMPILER_VERSION" +sit_info_verbose "MPI: $MPI" +sit_info_verbose "MPI version: $MPI_VERSION" + +case $PLATFORM in + hawk|vulcan) + COMPILER_MODULE=${COMPILER}${COMPILER_VERSION:+"/${COMPILER_VERSION}"} + MPI_MODULE=${MPI}${MPI_VERSION:+"/${MPI_VERSION}"} + MPI_VERSION_NUM=${MPI_VERSION%%-*} + sit_info_verbose "MPI version num: $MPI_VERSION_NUM" + ;; + system) + echo "Using system default compiler and MPI" + COMPILER="" # prevent any compiler specs in the prefix + MPI="" + ;; + *) + sit_fail "Unknown or unsupported system" + ;; +esac +echo "Loading modules: ${COMPILER_MODULE} ${MPI_MODULE}" + +module load "${COMPILER_MODULE}" "${MPI_MODULE}" if [ ! -z "${COMPILER}" ] ; then # reevaluate compiler version @@ -173,35 +158,6 @@ fi if [ ! -z "$MPI" ] ; then - MPI_MODULE="$MPI" - sit_info_verbose "MPI: $MPI" - sit_info_verbose "MPI version: $MPI_VERSION" - if [ ! -z "$MPI_VERSION" ] ; then - MPI_VERSION_NUM=${MPI_VERSION%%-*} - case $MPI in - impi) - MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}"} - ;; - *) - MPI_MODULE=${MPI_MODULE}${MPI_VERSION_NUM:+"/${MPI_VERSION_NUM}-$COMPILER-$COMPILER_VERSION"} - ;; - esac - fi - case $PLATFORM in - vulcan) - MPI_MODULE="mpi/$MPI" - ;; - hawk) - MPI_MODULE="$MPI" - ;; - *) - sit_error "mpi not supported on this platform" - ;; - esac - - echo "Loading MPI module ${MPI_MODULE}" - module load $MPI_MODULE - case $COMPILER in intel) if [[ $MPI == "impi" ]] ; then @@ -214,7 +170,7 @@ if [ ! -z "$MPI" ] ; then MPIFC="mpif90" fi ;; - gnu|*) + *) MPICC="mpicc" MPICXX="mpicxx" MPIFC="mpif90"