Address this TODO item in default.2025.env:
|
# TODO: Deducing which environment file maps to a machine relies on |
|
# partial string match, which makes surgically-precise SYSTEMNAME |
|
# introspection unnecessary. A substring match allows for simple |
|
# and robust solution, e.g. `MACHINE=$(hostname)` already works 99% |
|
# of the time (other 1% comes from intentionally obfuscated hostnames) |
|
# |
|
# HPC admins know best so perhaps it's better to let them handle |
|
# SYSTEMNAME setting on their respective environment file. Saving the |
|
# machine name to a dummy variable is sufficient. |
|
# |
|
# Set SYSTEMNAME if not yet set |
|
if [ -z "${SYSTEMNAME}" ]; then |
|
if [ $(command -v sinfo) ]; then |
|
export SYSTEMNAME=$(scontrol show config | grep ClusterName | awk -F= '{ print $2 }' | xargs) |
|
else |
|
export SYSTEMNAME=$(hostname | awk -F. '{ for(i=1;i<=NF;i++) if(!match($i, /[0-9]$/)) { print $i; break }; if(i==NF+1) { print $1 } }') |
|
fi |
|
fi |
|
# Map machine to environment file by detecting a |
|
# unique signature from the machine name. |
|
known_machine="true" |
|
env_dir=$(dirname $(realpath ${BASH_SOURCE:-$0})) |
|
if [[ $SYSTEMNAME == *"jedi"* || $SYSTEMNAME == *"jupiter"* ]]; then |
|
export TSMP2_ENV_FILE=${env_dir}/jsc.2025.gnu.openmpi |
|
elif [[ $SYSTEMNAME == *"jureca"* || $SYSTEMNAME == *"juwels"* || $SYSTEMNAME == *"jusuf"* ]]; then |
|
export TSMP2_ENV_FILE=${env_dir}/jsc.2025.intel.psmpi |
|
elif [[ $SYSTEMNAME == *"marvin"* ]]; then |
|
export TSMP2_ENV_FILE=${env_dir}/uni-bonn.gnu.openmpi |
|
elif [[ $SYSTEMNAME == *"UBUNTU"* ]]; then |
|
export TSMP2_ENV_FILE=${env_dir}/ubuntu.gnu.openmpi |
|
else |
|
echo "WARNING: Unknown default environment for machine '$(hostname)'" |
|
known_machine="false" |
|
fi |
Address this
TODOitem in default.2025.env:TSMP2/env/default.2025.env
Lines 12 to 29 in b8d5689
TSMP2/env/default.2025.env
Lines 31 to 46 in b8d5689