1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.13 |
#SBATCH -J ifcMp2_tst |
3 |
jmc |
1.1 |
#SBATCH -p sched_mit_hill |
4 |
jmc |
1.26 |
#SBATCH -t 06:00:00 |
5 |
jmc |
1.1 |
#SBATCH --mem-per-cpu 4000 |
6 |
|
|
#SBATCH -N 1 |
7 |
|
|
#SBATCH --tasks-per-node 10 |
8 |
jmc |
1.24 |
# #SBATCH -x node[360,365] |
9 |
jmc |
1.13 |
#SBATCH -e /home/jm_c/test_engaging/output/ifcMp2_tst.stderr |
10 |
|
|
#SBATCH -o /home/jm_c/test_engaging/output/ifcMp2_tst.stdout |
11 |
jmc |
1.19 |
#SBATCH --no-requeue |
12 |
jmc |
1.1 |
|
13 |
jmc |
1.30 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mp2,v 1.29 2023/11/06 14:23:01 jmc Exp $ |
14 |
jmc |
1.1 |
# $Name: $ |
15 |
|
|
|
16 |
jmc |
1.27 |
if test -f /etc/profile.d/modules.sh ; then . /etc/profile.d/modules.sh ; fi |
17 |
jmc |
1.1 |
# Note: added "ulimit -s unlimited" in file "~/.bashrc" |
18 |
|
|
# to pass big test (the 2 fizhi-cs-* test & adjoint tests) with MPI |
19 |
|
|
|
20 |
|
|
umask 0022 |
21 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
22 |
|
|
export LC_ALL="en_US.UTF-8" |
23 |
|
|
echo " running on: "`hostname` |
24 |
jmc |
1.27 |
headNode='eofe8' |
25 |
jmc |
1.1 |
|
26 |
|
|
dNam='engaging' |
27 |
jmc |
1.27 |
HERE="$HOME/test_${dNam}" |
28 |
jmc |
1.1 |
OUTP="$HERE/output"; SavD="$HERE/send" |
29 |
jmc |
1.27 |
SEND="ssh $headNode $SavD/mpack" |
30 |
jmc |
1.1 |
TST_DIR="/pool001/jm_c/test_$dNam" |
31 |
jmc |
1.11 |
tmpFil="/tmp/"`basename $0`".$$" |
32 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
33 |
jmc |
1.13 |
#- which GitHub repository to use and how to access it: |
34 |
jmc |
1.14 |
git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other' |
35 |
jmc |
1.11 |
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
36 |
jmc |
1.13 |
#-- |
37 |
|
|
git_repo="https://github.com/$git_repo" |
38 |
|
|
#git_repo="git://github.com/$git_repo" |
39 |
|
|
#git_repo="git@github.com:$git_repo" |
40 |
jmc |
1.1 |
|
41 |
jmc |
1.23 |
dblTr=0 ; typ='' ; addExp='' ; skipExp='' |
42 |
|
|
sfx='ifcMp2'; dblTr=1 |
43 |
jmc |
1.16 |
addExp='atm_gray atm_strato offline_cheapaml' |
44 |
jmc |
1.1 |
module add slurm |
45 |
|
|
module add gcc |
46 |
|
|
module add engaging/intel/2013.1.046 |
47 |
|
|
#export MPI_INC_DIR="$MPI_HOME/include" |
48 |
|
|
OPTFILE="../tools/build_options/linux_amd64_ifort+impi" |
49 |
jmc |
1.4 |
export GENERIC='on' # <-- to prevent the use of "-xHost" option |
50 |
jmc |
1.1 |
mpiCMD="mpirun -env I_MPI_DEBUG 2 -n TR_NPROC ./mitgcmuv" #- currently not used |
51 |
jmc |
1.8 |
options="$typ -MPI 4 -mth" |
52 |
jmc |
1.9 |
#options="-j 4 $options" |
53 |
jmc |
1.1 |
export OMP_NUM_THREADS=2 |
54 |
jmc |
1.2 |
export KMP_STACKSIZE=400m |
55 |
jmc |
1.1 |
#options="$options -gsl" |
56 |
|
|
#export GSL_IEEE_MODE=double-precision,mask-underflow,mask-denormalized |
57 |
|
|
ulimit -s unlimited |
58 |
|
|
#- need this to get "staf" & "do_make_syntax.sh": |
59 |
|
|
export PATH="$PATH:$HOME/bin" |
60 |
|
|
|
61 |
jmc |
1.11 |
gcmDIR="MITgcm_$sfx" |
62 |
jmc |
1.1 |
dAlt=`date +%d` ; dAlt=`expr $dAlt % 3` |
63 |
|
|
if [ $dAlt -eq 1 ] ; then options="$options -fast" |
64 |
|
|
else options="$options -devel" ; fi |
65 |
jmc |
1.27 |
if test "x$skipExp" != x ; then skipExp=`echo $skipExp | sed 's/^ *//'` ; fi |
66 |
jmc |
1.1 |
|
67 |
|
|
checkOut=1 ; #options="$options -do" |
68 |
jmc |
1.23 |
#options="$options -nc" ; checkOut=1 ; dblTr=0 |
69 |
|
|
#options="$options -q" ; checkOut=0 ; dblTr=0 |
70 |
jmc |
1.29 |
# dblTr=-1 #- skip testreport completely (only run "do_tst_2+2") |
71 |
jmc |
1.1 |
|
72 |
jmc |
1.11 |
if test -d $TST_DIR ; then |
73 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
74 |
|
|
else |
75 |
|
|
#if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi |
76 |
|
|
#if test ! -d $TST_DIR ; then |
77 |
|
|
# echo "ERROR: Can't create directory \"$TST_DIR\"" |
78 |
|
|
# exit 1 |
79 |
|
|
#fi |
80 |
|
|
#echo "start in new dir TST_DIR='$TST_DIR' at: "`date` |
81 |
|
|
echo "ERROR: missing directory \"$TST_DIR\"" |
82 |
|
|
exit 1 |
83 |
|
|
fi |
84 |
|
|
cd $TST_DIR |
85 |
|
|
pwd |
86 |
jmc |
1.21 |
df . |
87 |
jmc |
1.11 |
|
88 |
jmc |
1.1 |
NSLOTS=$SLURM_NTASKS |
89 |
|
|
THEDATE=`date` |
90 |
|
|
echo '********************************************************************************' |
91 |
|
|
echo 'Start job '$THEDATE |
92 |
|
|
echo 'NSLOTS = '$NSLOTS |
93 |
|
|
echo '======= NODELIST ===============================================================' |
94 |
|
|
echo $SLURM_NODELIST |
95 |
jmc |
1.20 |
cat /etc/redhat-release |
96 |
jmc |
1.4 |
echo '======= Procs ==================================================================' |
97 |
|
|
grep 'model name' /proc/cpuinfo | uniq |
98 |
|
|
echo -n ' x ' |
99 |
|
|
grep -c 'model name' /proc/cpuinfo |
100 |
jmc |
1.1 |
echo '======= env ====================================================================' |
101 |
|
|
env | grep SLURM |
102 |
|
|
echo '======= modules ================================================================' |
103 |
|
|
module list 2>&1 |
104 |
|
|
echo '================================================================================' |
105 |
|
|
|
106 |
|
|
#- |
107 |
|
|
MPI_MFile="${OUTP}/mf_${sfx}" #- currently not used |
108 |
|
|
#mpiCMD="mpirun -hostfile TR_MFILE -n TR_NPROC ./mitgcmuv" |
109 |
|
|
#- make the testreport MPI_MFILE: |
110 |
|
|
#listNODES=`echo $SLURM_NODELIST | sed -e 's/\[/ /' -e 's/\]//' -e 's/,/ /' -e 's/-/ /'` |
111 |
|
|
# duplicate the 2 listed nodes into a 6 list file: |
112 |
|
|
#/bin/rm -f $MPI_MFile ; touch $MPI_MFile |
113 |
|
|
#for nc in `seq 1 4` ; do pfx='' |
114 |
|
|
# for nd in $listNODES ; do |
115 |
|
|
# if test "x$pfx" = x ; then pfx=$nd ; else |
116 |
|
|
# echo "${pfx}${nd}" >> $MPI_MFile |
117 |
|
|
# fi |
118 |
|
|
# done |
119 |
|
|
#done |
120 |
|
|
|
121 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
122 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
123 |
|
|
if [ $dsp -gt 99 ] ; then |
124 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
125 |
|
|
#if [ $dsp -le 100000000 ] ; then |
126 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
127 |
|
|
df . |
128 |
|
|
exit |
129 |
|
|
fi |
130 |
jmc |
1.14 |
|
131 |
|
|
if [ $checkOut -eq 1 ] ; then |
132 |
|
|
if test ! -e $gcmDIR/.git/config ; then |
133 |
|
|
echo "no file: $gcmDIR/.git/config => try to download a fresh clone" |
134 |
|
|
checkOut=2 |
135 |
|
|
fi |
136 |
|
|
if test "x$addExp" != x ; then |
137 |
|
|
if test ! -e $gcmDIR/$git_other/.git/config ; then |
138 |
|
|
echo "no file: $gcmDIR/$git_other/.git/config => try a fresh clone" |
139 |
|
|
checkOut=2 |
140 |
|
|
fi |
141 |
|
|
fi |
142 |
|
|
fi |
143 |
jmc |
1.1 |
if [ $checkOut -eq 1 ] ; then |
144 |
jmc |
1.30 |
echo "cleaning output from $gcmDIR/verification @ "`date +"%H:%M:%S"`" :" |
145 |
jmc |
1.1 |
#- remove previous output tar files and tar & remove previous output-dir |
146 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
147 |
|
|
( cd $gcmDIR/verification |
148 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
149 |
|
|
for dd in $listD |
150 |
|
|
do |
151 |
|
|
if test -d $dd ; then |
152 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
153 |
jmc |
1.11 |
retVal=$? |
154 |
|
|
if test "x$retVal" != x0 ; then |
155 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
156 |
jmc |
1.11 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
157 |
jmc |
1.1 |
fi |
158 |
|
|
fi |
159 |
|
|
done ) |
160 |
|
|
echo "clean tst_2+2 + testreport output (+ Makefile_syntax files)" |
161 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
162 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
163 |
|
|
( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax ) |
164 |
|
|
( cd $gcmDIR/verification ; rm -f */build/port_rand.i */build/ptracers_set_iolabel.i ) |
165 |
jmc |
1.27 |
if test "x$addExp" != x ; then |
166 |
|
|
( cd $gcmDIR/verification |
167 |
|
|
listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null` |
168 |
|
|
echo " + remove local links: $listD" |
169 |
|
|
/bin/rm -f $listD |
170 |
|
|
) |
171 |
|
|
fi |
172 |
jmc |
1.30 |
echo "Update $git_code code in dir $gcmDIR @ "`date +"%H:%M:%S"`" :" |
173 |
jmc |
1.15 |
( cd $gcmDIR ; git pull ) 2>&1 |
174 |
jmc |
1.11 |
retVal=$? |
175 |
|
|
if test "x$retVal" != x0 ; then |
176 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
177 |
jmc |
1.1 |
exit |
178 |
|
|
fi |
179 |
jmc |
1.30 |
echo " and checkout master @ "`date +"%H:%M:%S"`" :" |
180 |
jmc |
1.15 |
( cd $gcmDIR ; git checkout master -- . ) 2>&1 |
181 |
jmc |
1.14 |
if test "x$addExp" != x ; then |
182 |
jmc |
1.30 |
echo "Update $git_other code in dir $gcmDIR/$git_other @ "`date +"%H:%M:%S"`" :" |
183 |
jmc |
1.15 |
( cd $gcmDIR/$git_other ; git pull ) 2>&1 |
184 |
jmc |
1.14 |
retVal=$? |
185 |
|
|
if test "x$retVal" != x0 ; then |
186 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
187 |
|
|
exit |
188 |
|
|
fi |
189 |
jmc |
1.30 |
echo " and checkout master @ "`date +"%H:%M:%S"`" :" |
190 |
jmc |
1.15 |
( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1 |
191 |
jmc |
1.1 |
fi |
192 |
|
|
fi |
193 |
jmc |
1.14 |
|
194 |
jmc |
1.1 |
if [ $checkOut -eq 2 ] ; then |
195 |
|
|
if test -e $gcmDIR ; then |
196 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
197 |
|
|
rm -rf $gcmDIR |
198 |
|
|
echo " done" |
199 |
|
|
fi |
200 |
jmc |
1.14 |
echo "Make a clone of $git_code from repo: $git_repo ..." |
201 |
jmc |
1.13 |
git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil |
202 |
jmc |
1.11 |
retVal=$? |
203 |
|
|
if test $retVal = 0 ; then |
204 |
|
|
echo ' done' ; rm -f $tmpFil |
205 |
|
|
else |
206 |
|
|
echo " Error: 'git clone' returned: $retVal" |
207 |
|
|
cat $tmpFil ; rm -f $tmpFil |
208 |
jmc |
1.1 |
exit |
209 |
jmc |
1.11 |
fi |
210 |
jmc |
1.14 |
if test "x$addExp" != x ; then |
211 |
|
|
echo "Make a clone of $git_other from repo: $git_repo ..." |
212 |
|
|
( cd $gcmDIR ; git clone $git_repo/${git_other}.git 2> $tmpFil ) |
213 |
|
|
retVal=$? |
214 |
|
|
if test $retVal = 0 ; then |
215 |
|
|
echo ' done' ; rm -f $tmpFil |
216 |
|
|
else |
217 |
|
|
echo " Error: 'git clone' returned: $retVal" |
218 |
|
|
cat $tmpFil ; rm -f $tmpFil |
219 |
|
|
exit |
220 |
|
|
fi |
221 |
|
|
fi |
222 |
jmc |
1.1 |
if test -d $gcmDIR/verification ; then |
223 |
|
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
224 |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
225 |
|
|
fi |
226 |
|
|
fi |
227 |
|
|
|
228 |
jmc |
1.18 |
#- change dir to $gcmDIR/verification + add link for additional experiments: |
229 |
jmc |
1.1 |
if test -e $gcmDIR/verification ; then |
230 |
|
|
if [ $checkOut -lt 2 ] ; then |
231 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
232 |
|
|
cd $gcmDIR/verification |
233 |
|
|
for exp2add in $addExp ; do |
234 |
jmc |
1.14 |
test -r $exp2add && /bin/rm -rf $exp2add |
235 |
|
|
if test -d ../$git_other/$exp2add ; then |
236 |
|
|
echo " add $exp2add link from $git_other" |
237 |
|
|
ln -s ../$git_other/$exp2add . |
238 |
jmc |
1.1 |
else |
239 |
jmc |
1.14 |
echo " missing dir: $git_other/$exp2add" |
240 |
|
|
continue |
241 |
jmc |
1.1 |
fi |
242 |
|
|
done |
243 |
|
|
else |
244 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
245 |
|
|
exit |
246 |
|
|
fi |
247 |
|
|
|
248 |
jmc |
1.23 |
if [ $dblTr -eq 1 ] ; then |
249 |
jmc |
1.27 |
echo '' |
250 |
jmc |
1.9 |
#- 0) just make all module header ( *__genmod.mod files) using modified Makefile |
251 |
|
|
# <-- skip this step |
252 |
|
|
#- 1) just compile ("-nr"), using "-j 4" to speed up |
253 |
jmc |
1.27 |
echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \ |
254 |
jmc |
1.9 |
-j 4 -nr -odir ${dNam}-$sfx |
255 |
jmc |
1.27 |
./testreport $options -of $OPTFILE -skd "$skipExp" \ |
256 |
jmc |
1.9 |
-j 4 -nr -odir ${dNam}-$sfx |
257 |
|
|
nFc=`grep -c '^Y . N N ' tr_out.txt` |
258 |
|
|
echo " <= fail to compile $nFc experiments" |
259 |
jmc |
1.23 |
options="$options -q" |
260 |
jmc |
1.10 |
fi |
261 |
jmc |
1.9 |
|
262 |
jmc |
1.29 |
if [ $dblTr -ge 0 ] ; then |
263 |
jmc |
1.9 |
echo '' |
264 |
|
|
#- 2) run and report results ; also finish to compile those who failed with "-j" |
265 |
jmc |
1.5 |
#echo ./testreport $options -of $OPTFILE -command \'$mpiCMD\' -mf $MPI_MFile \ |
266 |
jmc |
1.27 |
echo ./testreport $options -of $OPTFILE -skd \'$skipExp\' \ |
267 |
jmc |
1.23 |
-odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
268 |
jmc |
1.5 |
#./testreport $options -of $OPTFILE -command "$mpiCMD" -mf $MPI_MFile \ |
269 |
jmc |
1.27 |
./testreport $options -of $OPTFILE -skd "$skipExp" \ |
270 |
jmc |
1.23 |
-odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
271 |
jmc |
1.28 |
retVal=$? |
272 |
jmc |
1.29 |
else retVal=0 ; fi |
273 |
jmc |
1.1 |
|
274 |
jmc |
1.28 |
if test "x$retVal" != x0 ; then |
275 |
|
|
echo "<== testreport returned retVal=${retVal}, expecting 0" |
276 |
|
|
echo " -> skip restart test 'do_tst_2+2'" |
277 |
|
|
else |
278 |
jmc |
1.1 |
echo '' |
279 |
jmc |
1.9 |
#- 3) test restart and report results |
280 |
jmc |
1.5 |
#echo ../tools/do_tst_2+2 -mpi -exe \'$mpiCMD\' -mf $MPI_MFile \ |
281 |
|
|
echo ../tools/do_tst_2+2 -mpi \ |
282 |
jmc |
1.10 |
-o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
283 |
jmc |
1.5 |
#../tools/do_tst_2+2 -mpi -exe "$mpiCMD" -mf $MPI_MFile \ |
284 |
|
|
../tools/do_tst_2+2 -mpi \ |
285 |
jmc |
1.10 |
-o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
286 |
jmc |
1.28 |
fi |