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