Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions init/arch_specs/eessi_arch_arm.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ARM CPU architecture specifications
# Software path in EESSI | Vendor ID | List of defining CPU features
"aarch64/arm/neoverse-n1" "ARM" "asimd" # Ampere Altra
"aarch64/arm/neoverse-n1" "" "asimd" # AWS Graviton2
"aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm"
"aarch64/arm/neoverse-v1" "" "asimd svei8mm" # AWS Graviton3
"aarch64/neoverse-n1" "ARM" "asimd" # Ampere Altra
"aarch64/neoverse-n1" "" "asimd" # AWS Graviton2
"aarch64/neoverse-v1" "ARM" "asimd svei8mm"
"aarch64/neoverse-v1" "" "asimd svei8mm" # AWS Graviton3
29 changes: 14 additions & 15 deletions init/bash
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Allow for a silent mode
if [[ -v EESSI_SILENT ]]; then
# EESSI_SILENT set
output=/dev/null
else
output=/dev/stdout
fi

function show_msg {
# only echo msg if EESSI_SILENT is unset
msg=$1
if [[ ! -v EESSI_SILENT ]]; then
echo "$msg"
fi
}
# The following method should be safe, but might break if file is a symlink
# (could switch to $(dirname "$(readlink -f "$BASH_SOURCE")") in that case)
source $(dirname "$BASH_SOURCE")/eessi_environment_variables
Expand All @@ -20,19 +19,19 @@ if [ $? -eq 0 ]; then
export PATH=$EPREFIX/usr/bin:$EPREFIX/bin:$PATH

# init Lmod
echo "Initializing Lmod..." >> $output
show_msg "Initializing Lmod..."
source $EESSI_EPREFIX/usr/share/Lmod/init/bash

# prepend location of modules for EESSI software stack to $MODULEPATH
echo "Prepending $EESSI_MODULEPATH to \$MODULEPATH..." >> $output
module use $EESSI_MODULEPATH

#echo >> $output
#echo "*** Known problems in the ${EESSI_VERSION} software stack ***" >> $output
#echo >> $output
#echo "1) ..." >> $output
#echo >> $output
#echo >> $output
#show_msg ""
#show_msg "*** Known problems in the ${EESSI_VERSION} software stack ***"
#show_msg ""
#show_msg "1) ..."
#show_msg ""
#show_msg ""

echo "Environment set up to use NESSI (${EESSI_VERSION}), have fun!"

Expand Down
32 changes: 21 additions & 11 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
VERSION="1.0.0"
VERSION="1.1.0"

# Logging
LOG_LEVEL="INFO"
# default log level: only emit warnings or errors
LOG_LEVEL="WARN"
# Default result type is a best match
CPUPATH_RESULT="best"

timestamp () {
date "+%Y-%m-%d %H:%M:%S"
Expand Down Expand Up @@ -67,8 +69,8 @@ check_allinfirst(){

cpupath(){
# If EESSI_SOFTWARE_SUBDIR_OVERRIDE is set, use it
log "DEBUG" "cpupath: Override variable set as '$EESI_SOFTWARE_SUBDIR_OVERRIDE' "
[ $EESI_SOFTWARE_SUBDIR_OVERRIDE ] && echo ${EESI_SOFTWARE_SUBDIR_OVERRIDE} && exit
log "DEBUG" "cpupath: Override variable set as '$EESSI_SOFTWARE_SUBDIR_OVERRIDE' "
[ $EESI_SOFTWARE_SUBDIR_OVERRIDE ] && echo ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} && exit

# Identify the best matching CPU architecture from a list of supported specifications for the host CPU
# Return the path to the installation files in NESSI of the best matching architecture
Expand Down Expand Up @@ -105,7 +107,8 @@ cpupath(){
log "DEBUG" "cpupath: CPU flags of host system: '$cpu_flags'"

# Default to generic CPU
local best_arch_match="generic"
local best_arch_match="$machine_type/generic"
local all_arch_matches=$best_arch_match

# Iterate over the supported CPU specifications to find the best match for host CPU
# Order of the specifications matters, the last one to match will be selected
Expand All @@ -114,22 +117,29 @@ cpupath(){
if [ "${cpu_vendor}x" == "${arch_spec[1]}x" ]; then
# each flag in this CPU specification must be found in the list of flags of the host
check_allinfirst "${cpu_flags[*]}" ${arch_spec[2]} && best_arch_match=${arch_spec[0]} && \
all_arch_matches="$best_arch_match:$all_arch_matches" && \
log "DEBUG" "cpupath: host CPU best match updated to $best_arch_match"
fi
done

log "INFO" "cpupath: best match for host CPU: $best_arch_match"
echo "$best_arch_match"
if [ "allx" == "${CPUPATH_RESULT}x" ]; then
log "INFO" "cpupath: all matches for host CPU: $all_arch_matches"
echo "$all_arch_matches"
else
log "INFO" "cpupath: best match for host CPU: $best_arch_match"
echo "$best_arch_match"
fi
}

# Parse command line arguments
USAGE="Usage: eessi_archdetect.sh [-h][-d] <action>"
USAGE="Usage: eessi_archdetect.sh [-h][-d][-a] <action>"

while getopts 'hdv' OPTION; do
while getopts 'hdva' OPTION; do
case "$OPTION" in
h) echo "$USAGE"; exit 0;;
d) LOG_LEVEL="DEBUG";;
v) echo "eessi_archdetect.sh v$VERSION"; exit 0;;
a) CPUPATH_RESULT="all";;
?) echo "$USAGE"; exit 1;;
esac
done
Expand All @@ -139,5 +149,5 @@ ARGUMENT=${1:-none}

case "$ARGUMENT" in
"cpupath") cpupath; exit;;
*) echo "$USAGE"; log "ERROR" "Missing <action> argument";;
*) echo "$USAGE"; log "ERROR" "Missing <action> argument (possible actions: 'cpupath')";;
esac
30 changes: 15 additions & 15 deletions init/eessi_environment_variables
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# $BASH_SOURCE points to correct path, see also http://mywiki.wooledge.org/BashFAQ/028
EESSI_INIT_DIR_PATH=$(dirname $(realpath $BASH_SOURCE))

# Allow for a silent mode
if [[ -v EESSI_SILENT ]]; then
# EESSI_SILENT set
output=/dev/null
else
output=/dev/stdout
fi
function show_msg {
# only echo msg if EESSI_SILENT is unset
msg=$1
if [[ ! -v EESSI_SILENT ]]; then
echo "$msg"
fi
}

function error() {
echo -e "\e[31mERROR: $1\e[0m" >&2
Expand All @@ -19,7 +19,7 @@ function error() {
source $EESSI_INIT_DIR_PATH/minimal_eessi_env

if [ -d $EESSI_PREFIX ]; then
echo "Found NESSI repo @ $EESSI_PREFIX!" >> $output
show_msg "Found NESSI repo @ $EESSI_PREFIX!"

export EESSI_EPREFIX=$EPREFIX
if [ -d $EESSI_EPREFIX ]; then
Expand All @@ -28,21 +28,21 @@ if [ -d $EESSI_PREFIX ]; then
if [ "$EESSI_USE_ARCHDETECT" == "1" ]; then
# if archdetect is enabled, use internal code
export EESSI_SOFTWARE_SUBDIR=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh cpupath)
echo "archdetect says ${EESSI_SOFTWARE_SUBDIR}" >> $output
show_msg "archdetect says ${EESSI_SOFTWARE_SUBDIR}"
elif [ "$EESSI_USE_ARCHSPEC" == "1" ]; then
# note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined!
export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3
export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX)
echo "archspec says ${EESSI_SOFTWARE_SUBDIR}" >> $output
show_msg "archspec says ${EESSI_SOFTWARE_SUBDIR}"
else
error "Don't know how to detect host CPU, giving up!"
fi
if [ ! -z $EESSI_SOFTWARE_SUBDIR ]; then

echo "Using ${EESSI_SOFTWARE_SUBDIR} as software subdirectory." >> $output
show_msg "Using ${EESSI_SOFTWARE_SUBDIR} as software subdirectory."
export EESSI_SOFTWARE_PATH=$EESSI_PREFIX/software/$EESSI_OS_TYPE/$EESSI_SOFTWARE_SUBDIR
if [ ! -z $EESSI_BASIC_ENV ]; then
echo "Only setting up basic environment, so we're done" >> $output
show_msg "Only setting up basic environment, so we're done"
elif [ -d $EESSI_SOFTWARE_PATH ]; then
# Allow for the use of a custom MNS
if [ -z ${EESSI_CUSTOM_MODULEPATH+x} ]; then
Expand All @@ -55,21 +55,21 @@ if [ -d $EESSI_PREFIX ]; then
fi
EESSI_MODULEPATH=$EESSI_SOFTWARE_PATH/$EESSI_MODULE_SUBDIR
else
echo "Using defined environment variable \$EESSI_CUSTOM_MODULEPATH to set EESSI_MODULEPATH." >> $output
show_msg "Using defined environment variable \$EESSI_CUSTOM_MODULEPATH to set EESSI_MODULEPATH."
EESSI_MODULEPATH=$EESSI_CUSTOM_MODULEPATH
fi

if [ -d $EESSI_MODULEPATH ]; then
export EESSI_MODULEPATH=$EESSI_MODULEPATH
echo "Using ${EESSI_MODULEPATH} as the directory to be added to MODULEPATH." >> $output
show_msg "Using ${EESSI_MODULEPATH} as the directory to be added to MODULEPATH."
else
error "NESSI module path at $EESSI_MODULEPATH not found!"
false
fi

export LMOD_RC="$EESSI_SOFTWARE_PATH/.lmod/lmodrc.lua"
if [ -f $LMOD_RC ]; then
echo "Found Lmod configuration file at $LMOD_RC" >> $output
show_msg "Found Lmod configuration file at $LMOD_RC"
else
error "Lmod configuration file not found at $LMOD_RC"
fi
Expand Down