1 |
jmc |
1.1 |
#!/bin/bash |
2 |
jmc |
1.13 |
#SBATCH -J ifcMp2_tst |
3 |
jmc |
1.1 |
#SBATCH -p sched_mit_hill |
4 |
|
|
#SBATCH --mem-per-cpu 4000 |
5 |
|
|
#SBATCH -N 1 |
6 |
|
|
#SBATCH --tasks-per-node 10 |
7 |
jmc |
1.13 |
#SBATCH -e /home/jm_c/test_engaging/output/ifcMp2_tst.stderr |
8 |
|
|
#SBATCH -o /home/jm_c/test_engaging/output/ifcMp2_tst.stdout |
9 |
jmc |
1.19 |
#SBATCH --no-requeue |
10 |
|
|
#SBATCH --constraint=centos6 |
11 |
jmc |
1.1 |
|
12 |
jmc |
1.19 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/engaging/test_engag_ifc_mp2,v 1.18 2019/10/21 23:27:16 jmc Exp $ |
13 |
jmc |
1.1 |
# $Name: $ |
14 |
|
|
|
15 |
|
|
if test -f /etc/profile.d/modules.sh ; then |
16 |
|
|
. /etc/profile.d/modules.sh |
17 |
|
|
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 |
|
|
|
26 |
|
|
dNam='engaging' |
27 |
|
|
HERE="$HOME/test_$dNam" |
28 |
|
|
OUTP="$HERE/output"; SavD="$HERE/send" |
29 |
|
|
SEND="ssh eofe4 $SavD/mpack" |
30 |
|
|
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.5 |
typ='' ; addExp='' ; skipExp='' |
42 |
|
|
sfx='ifcMp2' |
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 |
|
|
|
66 |
|
|
checkOut=1 ; #options="$options -do" |
67 |
|
|
#options="$options -nc" ; checkOut=1 |
68 |
|
|
#options="$options -q" ; checkOut=0 |
69 |
|
|
|
70 |
jmc |
1.11 |
if test -d $TST_DIR ; then |
71 |
|
|
echo "start from TST_DIR='$TST_DIR' at: "`date` |
72 |
|
|
else |
73 |
|
|
#if test ! -d $TST_DIR ; then mkdir $TST_DIR ; fi |
74 |
|
|
#if test ! -d $TST_DIR ; then |
75 |
|
|
# echo "ERROR: Can't create directory \"$TST_DIR\"" |
76 |
|
|
# exit 1 |
77 |
|
|
#fi |
78 |
|
|
#echo "start in new dir TST_DIR='$TST_DIR' at: "`date` |
79 |
|
|
echo "ERROR: missing directory \"$TST_DIR\"" |
80 |
|
|
exit 1 |
81 |
|
|
fi |
82 |
|
|
cd $TST_DIR |
83 |
|
|
pwd |
84 |
|
|
|
85 |
jmc |
1.1 |
NSLOTS=$SLURM_NTASKS |
86 |
|
|
THEDATE=`date` |
87 |
|
|
echo '********************************************************************************' |
88 |
|
|
echo 'Start job '$THEDATE |
89 |
|
|
echo 'NSLOTS = '$NSLOTS |
90 |
|
|
echo '======= NODELIST ===============================================================' |
91 |
|
|
echo $SLURM_NODELIST |
92 |
jmc |
1.4 |
echo '======= Procs ==================================================================' |
93 |
|
|
grep 'model name' /proc/cpuinfo | uniq |
94 |
|
|
echo -n ' x ' |
95 |
|
|
grep -c 'model name' /proc/cpuinfo |
96 |
jmc |
1.1 |
cat /etc/redhat-release |
97 |
|
|
echo '======= env ====================================================================' |
98 |
|
|
env | grep SLURM |
99 |
|
|
echo '======= modules ================================================================' |
100 |
|
|
module list 2>&1 |
101 |
|
|
echo '================================================================================' |
102 |
|
|
|
103 |
|
|
#- |
104 |
|
|
MPI_MFile="${OUTP}/mf_${sfx}" #- currently not used |
105 |
|
|
#mpiCMD="mpirun -hostfile TR_MFILE -n TR_NPROC ./mitgcmuv" |
106 |
|
|
#- make the testreport MPI_MFILE: |
107 |
|
|
#listNODES=`echo $SLURM_NODELIST | sed -e 's/\[/ /' -e 's/\]//' -e 's/,/ /' -e 's/-/ /'` |
108 |
|
|
# duplicate the 2 listed nodes into a 6 list file: |
109 |
|
|
#/bin/rm -f $MPI_MFile ; touch $MPI_MFile |
110 |
|
|
#for nc in `seq 1 4` ; do pfx='' |
111 |
|
|
# for nd in $listNODES ; do |
112 |
|
|
# if test "x$pfx" = x ; then pfx=$nd ; else |
113 |
|
|
# echo "${pfx}${nd}" >> $MPI_MFile |
114 |
|
|
# fi |
115 |
|
|
# done |
116 |
|
|
#done |
117 |
|
|
|
118 |
|
|
#- check for disk space: relative space (99%) or absolute (10.G): |
119 |
|
|
dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
120 |
|
|
if [ $dsp -gt 99 ] ; then |
121 |
|
|
#dsp=`df -P . | tail -1 | awk '{print $4}'` |
122 |
|
|
#if [ $dsp -le 100000000 ] ; then |
123 |
|
|
echo 'Not enough space on this disk => do not run testreport.' |
124 |
|
|
df . |
125 |
|
|
exit |
126 |
|
|
fi |
127 |
jmc |
1.14 |
|
128 |
|
|
if [ $checkOut -eq 1 ] ; then |
129 |
|
|
if test ! -e $gcmDIR/.git/config ; then |
130 |
|
|
echo "no file: $gcmDIR/.git/config => try to download a fresh clone" |
131 |
|
|
checkOut=2 |
132 |
|
|
fi |
133 |
|
|
if test "x$addExp" != x ; then |
134 |
|
|
if test ! -e $gcmDIR/$git_other/.git/config ; then |
135 |
|
|
echo "no file: $gcmDIR/$git_other/.git/config => try a fresh clone" |
136 |
|
|
checkOut=2 |
137 |
|
|
fi |
138 |
|
|
fi |
139 |
|
|
fi |
140 |
jmc |
1.1 |
if [ $checkOut -eq 1 ] ; then |
141 |
|
|
echo "cleaning output from $gcmDIR/verification :" |
142 |
|
|
#- remove previous output tar files and tar & remove previous output-dir |
143 |
|
|
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
144 |
|
|
( cd $gcmDIR/verification |
145 |
|
|
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_? 2> /dev/null` |
146 |
|
|
for dd in $listD |
147 |
|
|
do |
148 |
|
|
if test -d $dd ; then |
149 |
|
|
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
150 |
jmc |
1.11 |
retVal=$? |
151 |
|
|
if test "x$retVal" != x0 ; then |
152 |
jmc |
1.1 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
153 |
jmc |
1.11 |
echo " on '"`hostname`"' (return val=$retVal) but continue" |
154 |
jmc |
1.1 |
fi |
155 |
|
|
fi |
156 |
|
|
done ) |
157 |
|
|
echo "clean tst_2+2 + testreport output (+ Makefile_syntax files)" |
158 |
|
|
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
159 |
|
|
( cd $gcmDIR/verification ; ./testreport $typ -clean ) |
160 |
|
|
( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax ) |
161 |
|
|
( cd $gcmDIR/verification ; rm -f */build/port_rand.i */build/ptracers_set_iolabel.i ) |
162 |
jmc |
1.14 |
if test "x$addExp" != x ; then |
163 |
|
|
( cd $gcmDIR/verification |
164 |
|
|
listD=`ls -o | grep '^l' | awk '{print $8}' 2> /dev/null` |
165 |
|
|
echo " + remove local links: $listD" |
166 |
|
|
/bin/rm -f $listD |
167 |
|
|
) |
168 |
|
|
fi |
169 |
|
|
echo "Update $git_code code in dir $gcmDIR :" |
170 |
jmc |
1.15 |
( cd $gcmDIR ; git pull ) 2>&1 |
171 |
jmc |
1.11 |
retVal=$? |
172 |
|
|
if test "x$retVal" != x0 ; then |
173 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
174 |
jmc |
1.1 |
exit |
175 |
|
|
fi |
176 |
jmc |
1.15 |
echo " and checkout master:" |
177 |
|
|
( cd $gcmDIR ; git checkout master -- . ) 2>&1 |
178 |
jmc |
1.14 |
if test "x$addExp" != x ; then |
179 |
|
|
echo "Update $git_other code in dir $gcmDIR/$git_other :" |
180 |
jmc |
1.15 |
( cd $gcmDIR/$git_other ; git pull ) 2>&1 |
181 |
jmc |
1.14 |
retVal=$? |
182 |
|
|
if test "x$retVal" != x0 ; then |
183 |
|
|
echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit" |
184 |
|
|
exit |
185 |
|
|
fi |
186 |
jmc |
1.15 |
echo " and checkout master:" |
187 |
|
|
( cd $gcmDIR/$git_other ; git checkout master -- . ) 2>&1 |
188 |
jmc |
1.1 |
fi |
189 |
|
|
fi |
190 |
jmc |
1.14 |
|
191 |
jmc |
1.1 |
if [ $checkOut -eq 2 ] ; then |
192 |
|
|
if test -e $gcmDIR ; then |
193 |
|
|
echo -n "Removing working copy: $gcmDIR ..." |
194 |
|
|
rm -rf $gcmDIR |
195 |
|
|
echo " done" |
196 |
|
|
fi |
197 |
jmc |
1.14 |
echo "Make a clone of $git_code from repo: $git_repo ..." |
198 |
jmc |
1.13 |
git clone $git_repo/${git_code}.git $gcmDIR 2> $tmpFil |
199 |
jmc |
1.11 |
retVal=$? |
200 |
|
|
if test $retVal = 0 ; then |
201 |
|
|
echo ' done' ; rm -f $tmpFil |
202 |
|
|
else |
203 |
|
|
echo " Error: 'git clone' returned: $retVal" |
204 |
|
|
cat $tmpFil ; rm -f $tmpFil |
205 |
jmc |
1.1 |
exit |
206 |
jmc |
1.11 |
fi |
207 |
jmc |
1.14 |
if test "x$addExp" != x ; then |
208 |
|
|
echo "Make a clone of $git_other from repo: $git_repo ..." |
209 |
|
|
( cd $gcmDIR ; git clone $git_repo/${git_other}.git 2> $tmpFil ) |
210 |
|
|
retVal=$? |
211 |
|
|
if test $retVal = 0 ; then |
212 |
|
|
echo ' done' ; rm -f $tmpFil |
213 |
|
|
else |
214 |
|
|
echo " Error: 'git clone' returned: $retVal" |
215 |
|
|
cat $tmpFil ; rm -f $tmpFil |
216 |
|
|
exit |
217 |
|
|
fi |
218 |
|
|
fi |
219 |
jmc |
1.1 |
if test -d $gcmDIR/verification ; then |
220 |
|
|
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
221 |
|
|
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
222 |
|
|
fi |
223 |
|
|
fi |
224 |
|
|
|
225 |
jmc |
1.18 |
#- change dir to $gcmDIR/verification + add link for additional experiments: |
226 |
jmc |
1.1 |
if test -e $gcmDIR/verification ; then |
227 |
|
|
if [ $checkOut -lt 2 ] ; then |
228 |
|
|
echo " dir $gcmDIR/verification exist" ; fi |
229 |
|
|
cd $gcmDIR/verification |
230 |
|
|
for exp2add in $addExp ; do |
231 |
jmc |
1.14 |
test -r $exp2add && /bin/rm -rf $exp2add |
232 |
|
|
if test -d ../$git_other/$exp2add ; then |
233 |
|
|
echo " add $exp2add link from $git_other" |
234 |
|
|
ln -s ../$git_other/$exp2add . |
235 |
jmc |
1.1 |
else |
236 |
jmc |
1.14 |
echo " missing dir: $git_other/$exp2add" |
237 |
|
|
continue |
238 |
jmc |
1.1 |
fi |
239 |
|
|
done |
240 |
|
|
else |
241 |
|
|
echo "no dir: $gcmDIR/verification => exit" |
242 |
|
|
exit |
243 |
|
|
fi |
244 |
|
|
|
245 |
jmc |
1.10 |
if [ $checkOut -ge 1 ] ; then |
246 |
jmc |
1.9 |
#- 0) just make all module header ( *__genmod.mod files) using modified Makefile |
247 |
|
|
# <-- skip this step |
248 |
jmc |
1.1 |
echo '' |
249 |
jmc |
1.9 |
#- 1) just compile ("-nr"), using "-j 4" to speed up |
250 |
|
|
echo ./testreport $options -of $OPTFILE \ |
251 |
|
|
-j 4 -nr -odir ${dNam}-$sfx |
252 |
|
|
./testreport $options -of $OPTFILE \ |
253 |
|
|
-j 4 -nr -odir ${dNam}-$sfx |
254 |
|
|
nFc=`grep -c '^Y . N N ' tr_out.txt` |
255 |
|
|
echo " <= fail to compile $nFc experiments" |
256 |
jmc |
1.10 |
fi |
257 |
jmc |
1.9 |
|
258 |
|
|
echo '' |
259 |
|
|
#- 2) run and report results ; also finish to compile those who failed with "-j" |
260 |
jmc |
1.5 |
#echo ./testreport $options -of $OPTFILE -command \'$mpiCMD\' -mf $MPI_MFile \ |
261 |
|
|
echo ./testreport $options -of $OPTFILE \ |
262 |
jmc |
1.10 |
-q -odir ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
263 |
jmc |
1.5 |
#./testreport $options -of $OPTFILE -command "$mpiCMD" -mf $MPI_MFile \ |
264 |
|
|
./testreport $options -of $OPTFILE \ |
265 |
jmc |
1.10 |
-q -odir ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
266 |
jmc |
1.1 |
|
267 |
|
|
echo '' |
268 |
jmc |
1.9 |
#- 3) test restart and report results |
269 |
jmc |
1.5 |
#echo ../tools/do_tst_2+2 -mpi -exe \'$mpiCMD\' -mf $MPI_MFile \ |
270 |
|
|
echo ../tools/do_tst_2+2 -mpi \ |
271 |
jmc |
1.10 |
-o ${dNam}-$sfx -send \'$SEND\' -sd $SavD -a jm_c@mitgcm.org |
272 |
jmc |
1.5 |
#../tools/do_tst_2+2 -mpi -exe "$mpiCMD" -mf $MPI_MFile \ |
273 |
|
|
../tools/do_tst_2+2 -mpi \ |
274 |
jmc |
1.10 |
-o ${dNam}-$sfx -send "$SEND" -sd $SavD -a jm_c@mitgcm.org |
275 |
jmc |
1.1 |
|