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