forked from CFD-GO/TCLB_cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig
executable file
·154 lines (129 loc) · 3.34 KB
/
config
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
#set -e
PP=$(dirname $0)
source $PP/lib.bash
source $PP/checks.bash
while true
do
case "$1" in
-h|--help) usage;;
-y|--yes) agree=true;;
-d|--default) def=true;;
*) break;;
esac
shift
done
source_conf
ask_init
RUN_COMMAND="mpirun"
GRANT_DEF="$(defgrant)"
TCLB_DEF="$(pwd)"
CONFOPT_DEF="--disable-cuda"
RHOME_DEF=$(R RHOME 2>/dev/null)
RHOME_ASK="fix"
RUN_GPU_ASK="yn"
RUN_GPU_DEF="y"
MODULES_UNLOAD_DEF="purge"
PREPARE_ASK="no"
PREPARE_CONFIGURE_ASK="no"
PREPARE_MAKE_ASK="no"
PREPARE_RUN_ASK="no"
source_cluster
ask GRANT "What is your grant name"
ask TCLB "What is the path to TCLB" path
ask RUN_GPU "Do you want to run on GPU"
ask CONFOPT "Provide ./configure options you want to use (please use single ' for quotes)"
ask RHOME "What is the path to R (without the bin/ part)"
ask DEBUGQ "What is the name of the debug queue/partition"
ask MAINQ "What is the name of the main queue/partition to use"
ask MAX_UNITS_PER_NODE "What is the maximal number of process/gpus per node"
ask CORES_PER_UNIT "What number of cores you want to attach to every process/gpu"
ask CORES_PER_UNIT_FULL "What number of cores to attach on a full node"
ask MODULES_RUN "What modules to load for running TCLB"
ask MODULES_ADD "What additional modules to load for compilation"
ask MODULES_UNLOAD "What modules to unload for running/compiling TCLB"
ask PREPARE "What commands to run before running anything"
ask PREPARE_CONFIGURE "What commands to run before running anything"
ask PREPARE_MAKE "What commands to run before running make"
ask PREPARE_RUN "What commands to run before running TCLB"
ask RUN_COMMAND "What command to use to run MPI application (runmpi|srun|aprun)"
save_conf
if ! test -z "$MODULES_RUN"
then
MODULES_RUN_LOAD="quiet_run module load $MODULES_RUN"
fi
if ! test -z "$MODULES_ADD"
then
MODULES_ADD_LOAD="\$mod_add && quiet_run module load $MODULES_ADD"
fi
if ! test -z "$MODULES_UNLOAD"
then
if test "$MODULES_UNLOAD" == "purge"
then
MODULES_UNLOAD_LOAD="quiet_run module purge"
else
MODULES_UNLOAD_LOAD="quiet_run module unload $MODULES_UNLOAD"
fi
fi
if ! test -z "$RHOME"
then
RHOME_LOAD="export PATH=\"$RHOME/bin:\$PATH\""
fi
cat >$PP/mods.ini <<EOF
TYPE=\$1
test -z "\$TYPE" && TYPE=MAKE
function quiet_run {
echo -n "\$@... "
if ! \$@ >/dev/null 2>&1
then
echo "ERROR"
exit -1;
else
echo "OK"
fi
}
if ! declare -f pb_msg >/dev/null
then
function pb_msg { return 0; }
function pb_file { return 0; }
else
PB_CURL_OPT="--insecure"
fi
function say {
MSG="\$@"
pb_msg "\$SLURM_JOB_NAME" "\$MSG (after \$SECONDS s)"
}
$(if ! test -z "$MODULES_UNLOAD"
then
if test "$MODULES_UNLOAD" == "purge"
then
echo "quiet_run module purge"
else
echo "quiet_run module unload $MODULES_UNLOAD"
fi
fi)
$(test -z "$RHOME" || echo "export PATH=\"$RHOME/bin:\$PATH\"" )
$(test -z "$MODULES_RUN" || echo "quiet_run module load $MODULES_RUN" )
case "\$TYPE" in
"MAKE")
$(test -z "$MODULES_ADD" || echo "quiet_run module load $MODULES_ADD" )
$PREPARE_MAKE
;;
"CONFIGURE")
$(test -z "$MODULES_ADD" || echo "quiet_run module load $MODULES_ADD" )
$PREPARE_CONFIGURE
;;
"RUN")
$PREPARE_RUN
;;
esac
$PREPARE
EOF
if ask_no "Do you want to install needed R packages now?"
then
salloc -p $DEBUGQ --ntasks=1 $PP/exec.install skipssl rdep
fi
if ask_yes "Do you want to run ./configure now?"
then
salloc -p $DEBUGQ --ntasks=1 $PP/exec.configure $CONFOPT
fi