Commit graph

68 commits

Author SHA1 Message Date
00b50d0176 Read user before global configuration so its values take priority over it. 2024-03-28 03:11:44 +01:00
c623173aa9 Fix not working automatic removal of old working dir in case of all action. 2024-03-28 03:11:44 +01:00
1afff42278 Platform configs for vulcan. 2024-03-28 03:11:44 +01:00
033da1f29e Updated Copyright 2024-03-28 03:11:44 +01:00
ea57eb5510 Added log messages about used MPI implementation. 2024-03-28 03:11:44 +01:00
9d89fea32c Replace echos by sit_info. 2024-03-28 03:11:44 +01:00
eef081accb Add verbose output. 2024-03-28 03:11:44 +01:00
ac692f1a2d Move variables holding sit paths to later place so it is consideredd by debug mode. 2024-03-28 03:11:44 +01:00
7819d971c2 Improve command line parsing adding --debug option to enable bash debug mode. 2024-03-28 03:11:44 +01:00
e4e02bbd21 Fix order in which config files are read: First global, the user. 2024-03-28 03:11:44 +01:00
8ca07c229e Delete whitespaces at end of lines. 2024-03-28 03:11:44 +01:00
cf909d4c96 Turn echo output to sit_info and move to later place. 2024-03-28 03:11:44 +01:00
0c25f5431d Use non login shell. 2024-03-28 03:11:44 +01:00
3ed1792050 Add sit_warn to output warnings. 2024-03-28 03:11:44 +01:00
ea6f63a882 Minor fixes in command line parser and options. 2024-03-28 03:11:44 +01:00
e24d4ed21b Command line option parsing at the begin of sit. 2024-03-28 03:11:44 +01:00
1ad253394b Indentation 2024-03-28 03:11:44 +01:00
479c6c424c Renamed $SCLASSFILE to $sit_classfile and reordered code. 2024-03-28 03:11:44 +01:00
6fdacf1b33 Deleted unused variable ACTION 2024-03-28 03:11:44 +01:00
6fc26df120 Indentation 2024-03-28 03:11:44 +01:00
f319c0c474 Remove unnecessary sit_wait. 2024-03-28 03:11:44 +01:00
ff3562dc78 Do not modify the provided PACKAGE_DESCRIPTOR variable. 2024-03-28 03:11:44 +01:00
ac4d188dfa Display usage information in case of unknown action. 2024-03-28 03:11:44 +01:00
ebca0efb8e Code cleanup removing old commented code parts. 2024-03-28 03:11:44 +01:00
ad39567ef5 Renamed controll variable $SIT_RUN_OPTION to more adequate $sit_action. 2024-03-28 03:11:44 +01:00
4dff164737 Updated copyright statement. 2024-03-28 03:11:44 +01:00
cedbcbbf86 Removed additional "./" from SIT_PATH making paths more readable. 2024-03-28 03:11:44 +01:00
bea73457a3 Update compiler selection for hazelhen. 2024-03-28 03:11:44 +01:00
336ab82405 Cray: load compat module when swaping compiler 2024-03-28 03:11:44 +01:00
66099b121d Set MPI_DIR variable on cray systems by default, as there is no explicit module to load. 2024-03-28 03:11:44 +01:00
0055dbb3e6 fixed loading compiler on hornet 2024-03-28 03:11:44 +01:00
Muhammad Usman Saleem
8bfffc5fe9 #!/bin/bash -l
#
# Install script inspired by the ebuild system of Gentoo Linux
#
# Christoph Niethammer <niethammer@hlrs.de> (C) 2011-2013
#
 
# exit on any error!
set -e
# for debugging:
# set -x 

# Reading in execution option
SIT_RUN_OPTION=$2
if [[ -n $SIT_RUN_OPTION ]] ; then
	echo "Executing with option: $SIT_RUN_OPTION"
else
	echo "Default execution"
fi

SIT_PATH=$(dirname $PWD/$0)
SIT_CONFIG_FILE=$SIT_PATH/etc/sit.conf
SIT_USER_CONFIG_FILE=$HOME/.sit

# Reading in user configuration file if it exists
if [[ -e $SIT_USER_CONFIG_FILE ]] ; then
    source $SIT_USER_CONFIG_FILE
fi
# Reading in global configuration file
if [[ -e $SIT_CONFIG_FILE ]] ; then
    source $SIT_CONFIG_FILE
fi
source "$SIT_PATH/functions.sh"

sit_countdown 1

# identify platform manually if no environment variable was set
PLATFORM=${PLATFORM:=$SITE_PLATFORM_NAME}
if [ -z $PLATFORM ]; then
    sit_info "Unknown platform using default platform '${DEFAULT_PLATFORM}' configuration"
    PLATFORM="${DEFAULT_PLATFORM}"
fi

sit_info "Platform: $PLATFORM"

# compiler to use
# (gnu|intel|pgi)
COMPILER=${COMPILER:=${DEFAULT_COMPILER}}
# use specific compiler version
COMPILER_VERSION=${COMPILER_VERSION:=}


# add a descriptor at the end of the installation path e.g. for special config options etc.
PACKAGE_DESCRIPTOR=${PACKAGE_DESCRIPTOR:+-$PACKAGE_DESCRIPTOR}


# Compiler specifications
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


if [ "$COMPILER" == "system" ] ; then
    echo "Using system default compiler"
    COMPILER="" # prevent any compiler specs in the prefix
else 
    case $PLATFORM in
        hermit|hermit1)
            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
            ;;
        laki|*)
            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

if [ ! -z "${COMPILER}" ] ; then
    # reevaluate compiler version
    COMPILER_VERSION=$(eval "$COMPILER_VERSION_CMD")
fi
# make the compiler variables CC, CXX, FC and F77 available
if [ ! -z "$COMPILER_OPTS" ] ; then  
    echo "Compiler env: ${COMPILER_OPTS}"
    export ${COMPILER_OPTS}
fi
if [ ! -z $COMPILER ] ; then
    echo "Using compiler: $COMPILER version: $COMPILER_VERSION"
fi

if [ ! -z "$MPI" ] ; then 
    MPI_MODULE="mpi/$MPI"
    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  
    echo "Loading MPI module ${MPI_MODULE}"
    module load $MPI_MODULE

    case $COMPILER in
	intel)
            if [[ $MPI == "impi" ]] ; then
		MPICC="mpiicc"
		MPICXX="mpiicpc"
		MPIFC="mpiifort"
            else
		MPICC="mpicc"
		MPICXX="mpicxx"
		MPIFC="mpif90"
            fi
	    ;;
	gnu|*)
	    MPICC="mpicc"
	    MPICXX="mpicxx"
	    MPIFC="mpif90"
	    ;;
    esac
    echo "MPI compiler env: MPICC=$MPICC, MPICXX=$MPICXX, MPIFC=$MPIFC"
    MPI_DIR=${MPI_DIR:=$(dirname $(dirname $(which $MPICC)))}
fi

SCLASSFILE=$1
ACTION=$2

if [ -f $SCLASS_DIR/$SCLASSFILE ] ; then
    source $SCLASS_DIR/$SCLASSFILE
else
    sit_fail "Could not find file $SCLASS_DIR/$SCLASSFILE"
fi

PACKAGENAME=${PACKAGENAME:=$PACKAGE}

# construct the final installation directory path
if [ -z $PREFIX ] ; then
PREFIX="${PREFIX_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}"
PREFIX_SUFFIX=${MPI:+"-$MPI"}${MPI_VERSION_NUM:+"-$MPI_VERSION_NUM"}
PREFIX_SUFFIX=$PREFIX_SUFFIX${COMPILER:+"-$COMPILER"}${COMPILER_VERSION:+"-$COMPILER_VERSION"}
PREFIX_SUFFIX=$PREFIX_SUFFIX${PACKAGE_DESCRIPTOR}

PREFIX=$PREFIX${PREFIX_SUFFIX:+"$PREFIX_SUFFIX"}
fi

# final working directory path
WORKDIR=${WORKDIR_BASE}/${CATEGORY}/${PACKAGE}/${VERSION}$PREFIX_SUFFIX

# path to the source code directory
SRCDIR=${WORKDIR}/${P}

# build directory (should be different from source directory):
BUILDDIR=${WORKDIR}/build

# logfile directory
LOGDIR=${WORKDIR}


# source the package class file a second time, so we can modify variables 
# using their default values. (Defaults depend on other vairables in 
# 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 3

# if working dir already exists and execution option is Default then remove
# previous working directory and create new
if [[ -d ${WORKDIR} && -z $SIT_RUN_OPTION ]] ; then
    sit_info "Removing existing working directory ${WORKDIR}"
    sit_countdown 5
    rm -rf ${WORKDIR}
fi

if [ ! -d ${WORKDIR} ] ; then
	mkdir -p ${WORKDIR}
	mkdir -p ${BUILDDIR}
fi

if [ ! -z ${LOGDIR} ] ; then
    mkdir -p ${LOGDIR}
else
# TODO: this is dangerous as we compress and copy all *.log files inside LOGDIR!
    LOGDIR="/tmp"
fi


case $SIT_RUN_OPTION in
"sitinfo")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
;;
"unpack")
sit_unpack    2>&1 | tee "$LOGDIR/unpack.log";       ( exit ${PIPESTATUS[0]} )
;;
"prepare")
sit_prepare   2>&1 | tee "$LOGDIR/prepare.log";      ( exit ${PIPESTATUS[0]} )
;;
"configure")
sit_configure 2>&1 | tee "$LOGDIR/configure.log";    ( exit ${PIPESTATUS[0]} )
;;
"build")
sit_build     2>&1 | tee "$LOGDIR/make.log";         ( exit ${PIPESTATUS[0]} )
;;
"pretest")
sit_pretest   2>&1 | tee "$LOGDIR/pretest.log";      ( exit ${PIPESTATUS[0]} )
;;
"install")
sit_install   2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
;;
"posttest")
sit_posttest  2>&1 | tee "$LOGDIR/posttest.log";     ( exit ${PIPESTATUS[0]} )
;;
"postinst")
sit_postinst  2>&1 | tee "$LOGDIR/postinst.log";     ( exit ${PIPESTATUS[0]} )
;;
"copy_logs")
sit_copy_logs
;;
"setperms")
sit_setperms
;;
"")
sit_sitinfo >> "$LOGDIR/sit_cmd.log"
sit_unpack    2>&1 | tee "$LOGDIR/unpack.log";       ( exit ${PIPESTATUS[0]} )
sit_prepare   2>&1 | tee "$LOGDIR/prepare.log";      ( exit ${PIPESTATUS[0]} )
sit_configure 2>&1 | tee "$LOGDIR/configure.log";    ( exit ${PIPESTATUS[0]} )
sit_build     2>&1 | tee "$LOGDIR/make.log";         ( exit ${PIPESTATUS[0]} )

sit_pretest   2>&1 | tee "$LOGDIR/pretest.log";      ( exit ${PIPESTATUS[0]} )
sit_install   2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
sit_posttest  2>&1 | tee "$LOGDIR/posttest.log";     ( exit ${PIPESTATUS[0]} )
sit_postinst  2>&1 | tee "$LOGDIR/postinst.log";     ( exit ${PIPESTATUS[0]} )
sit_copy_logs
sit_setperms
;;
*)
echo "Argument $SIT_RUN_OPTION unrecognized."
esac


#sit_sitinfo >> "$LOGDIR/sit_cmd.log"
#sit_unpack    2>&1 | tee "$LOGDIR/unpack.log";       ( exit ${PIPESTATUS[0]} )
#sit_prepare   2>&1 | tee "$LOGDIR/prepare.log";      ( exit ${PIPESTATUS[0]} )
#sit_configure 2>&1 | tee "$LOGDIR/configure.log";    ( exit ${PIPESTATUS[0]} )
#sit_build     2>&1 | tee "$LOGDIR/make.log";         ( exit ${PIPESTATUS[0]} )

#sit_pretest   2>&1 | tee "$LOGDIR/pretest.log";      ( exit ${PIPESTATUS[0]} )
#sit_install   2>&1 | tee "$LOGDIR/make_install.log"; ( exit ${PIPESTATUS[0]} )
#sit_posttest  2>&1 | tee "$LOGDIR/posttest.log";     ( exit ${PIPESTATUS[0]} )
#sit_postinst  2>&1 | tee "$LOGDIR/postinst.log";     ( exit ${PIPESTATUS[0]} )
#sit_copy_logs
#sit_setperms  


cat <<EOF
##############################################################################
# IMPORTANT!
##############################################################################
# Do not forget to provide a module file!
##############################################################################
EOF

exit 0
2024-03-28 02:45:19 +01:00
Elke Flehmig
73bea190c0 typo: $mpi must be $MPI (uppercase) 2024-03-28 02:43:58 +01:00
9069a8dc76 Intel MPI module names do not depend on compiler (version). 2024-03-28 02:43:58 +01:00
Elke Flehmig
5f6afe13b4 added sit_postinst for final messages etc. after installation is finished 2024-03-28 02:43:58 +01:00
Elke Flehmig
8f74c65c11 set MPICXX and MPIFC for gnu/intel compilers 2024-03-28 02:43:58 +01:00
5799aed066 Update copyright statement. 2024-03-28 02:43:58 +01:00
e5757ddc15 Select platform via the new SITE_PLATFORM_NAME environment variable. 2024-03-28 02:43:58 +01:00
2199cc777f Added package for scalasca-1.4.1 2024-03-28 02:43:58 +01:00
68b57e26c4 Allow general PREFIX paths by respective environment variable. 2024-03-28 02:43:56 +01:00
ecb84751f8 Added support for ~/.sit per user config file. 2024-03-28 02:43:56 +01:00
766b668fca Bugfix: Correcting check of pipe status. 2024-03-28 02:43:56 +01:00
f6060b4cd5 Reverting cleanup changes.
Remove existing working directory as long as we do not support resuming.
2024-03-28 02:43:56 +01:00
bfd9d35558 Added comment: Using /tmp for logfiles may be dangerous. 2024-03-28 02:43:56 +01:00
Rainer Keller
28db8095c5 - Specify F77 before Fortran (F90, F2003, F2008) compilers
- Don't use -j2 make option by default, may break some non-conforming source builts
 - Fix a few buglets (like LOGDIR , and when packages are NOT configure-based, aka
   do not create a config.log file)
2024-03-28 02:43:56 +01:00
ef7ce70d3c Bugfix: Forgot new platform hermit1 in case section. 2024-03-28 02:43:56 +01:00
0be4a91a0f Write more compact code. 2024-03-28 02:43:56 +01:00
2cec8f8c18 Added new login/imager node for Laki. 2024-03-28 02:43:56 +01:00
4f966b0e06 Indention 2024-03-28 02:43:56 +01:00
96f446b375 Added new platform hermit1. 2024-03-28 02:43:56 +01:00