forked from ufs-community/land-DA_workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_check.sh
executable file
·44 lines (35 loc) · 1.56 KB
/
module_check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Script to ensure required modules are loaded for the land DA system.
# find which machine we are on
if [[ ${HOSTNAME} == *"Orion"* ]]; then
MACHINE=orion
elif [[ ${HOSTNAME} == *"hfe"* ]]; then
MACHINE=hera
fi
# check which modules are required and notify the user if they are not currently loaded in the environment.
if [[ ( ${MACHINE} == "orion" || ${MACHINE} == "hera" ) && ${USE_SINGULARITY} != "yes" ]]; then
env_mods=($(grep -o 'load("[^"]*")' ${CYCLEDIR}/modulefiles/build_${MACHINE}_intel.lua | sed 's/load("//;s/")//'))
missing_mods=()
for mod in ${env_mods[@]}
do
if ! module is-loaded "${mod}"; then
missing_mods+=("${mod}")
fi
done
if [[ ${#missing_mods[@]} -gt 0 ]]; then
echo "Error: the following modules are not loaded in the current environment: ${missing_mods[@]}. Please load them via 'module use ${CYCLEDIR}/modulefiles; module load landda_${MACHINE}.intel' and then re-launch do_submit_cycle.sh."
exit 1
else
echo "All modules properly loaded in environment. Continuing!"
fi
elif [[ ${USE_SINGULARITY} =~ "yes" ]]; then
if ! command -v mpiexec &> /dev/null; then
echo "Error: mpiexec is not in the current path. Please load an Intel MPI of version 2021 or newer."
exit 1
elif ! mpiexec --version | grep -Eq "Intel.*2021|202[2-9][0-9]*"; then
echo "Warning: loaded Intel MPI is a version older than 2021. Intel MPIs prior to 2021 have not been tested."
echo "Current loaded version is $(mpiexec --version)"
else
echo "Intel MPI properly set for Singularity. Continuing."
fi
fi