-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmltest
More file actions
executable file
·95 lines (82 loc) · 2.17 KB
/
mltest
File metadata and controls
executable file
·95 lines (82 loc) · 2.17 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/bash
# test module load in parallel for the entire apps stack
# Ruoshi Sun
# 2023-12-01
ml parallel || {
echo "Error: cannot load parallel module"
exit 1
}
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` CATEGORY"
echo " CATEGORY = core|toolchains|compiler|mpi|container|vendor|all"
echo "Since the modules need to be loaded, you cannot run this script for other YYYYMMs."
exit 1
fi
if [ "$1" = "all" ]; then
CATEGORY=(core toolchains compiler mpi container vendor)
else
CATEGORY=$1
fi
PROC=$(nproc --all)
MODULEPATH_DEFAULT=/apps/modulefiles/standard/core:/apps/modulefiles/standard/toolchains:/apps/modulefiles/vendor
unset MODULEPATH
export MODULEPATH=$MODULEPATH_DEFAULT
function getmodule {
LUA=$(basename $1)
i=$2 # category
if [ "$i" = "vendor" ]; then
PREFIX=/apps/modulefiles/$i
else
PREFIX=/apps/modulefiles/standard/$i
fi
ML=()
APP=$(echo $1|awk -F'/' '{print $(NF-1)}')
VERSION=${LUA/.lua/}
case "$i" in
"core"|"toolchains"|"vendor")
;;
"compiler"|"container"|"mpi")
n=$((${#PREFIX}+1))
PARENT=$(dirname $1)
PARENT=${PARENT:$n}
PARENT=${PARENT%/*}
COMPILER=${PARENT%%/*}
# replace / with ' ' every other occurrence
# replace intel/2* with intel-compilers/2*; intel/18 as is
ML+=($(echo $PARENT|sed '-es#/# #'{8..1..2}|sed 's#^intel/2#intel-compilers/2#'))
echo -n "$PARENT/"
;;
*)
echo "Unknown category"
exit 1
;;
esac
echo -n "$APP/$VERSION "
# hidden module
if [ ${VERSION:0:1} = "." ]; then
echo -n "(H) "
fi
echo -n "... "
ML+=("$APP/$VERSION")
module purge
MLMSG=$(mktemp)
ml "${ML[@]}" 2>$MLMSG && echo "PASS" || {
echo -e "\033[1;31mFAIL\033[0m"
cat $MLMSG
}
rm $MLMSG
}
export -f getmodule
for i in ${CATEGORY[@]}; do
if [ "$i" = "vendor" ]; then
PREFIX=/apps/modulefiles/$i
else
PREFIX=/apps/modulefiles/standard/$i
fi
echo "[$PREFIX]"
LUAS=( $(find $PREFIX/ -name '*.lua') )
N=${#LUAS[@]}
echo $N
parallel -j$PROC getmodule ::: ${LUAS[@]} ::: $i
echo
done