1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
jmc |
1.7 |
# $Header: /u/gcmpack/MITgcm_contrib/test_scripts/other/test_local,v 1.6 2018/02/09 20:42:07 jmc Exp $ |
4 |
jmc |
1.1 |
# $Name: $ |
5 |
|
|
|
6 |
|
|
if test $# = 0 ; then |
7 |
|
|
echo 'need 1 argument' |
8 |
|
|
exit |
9 |
|
|
else |
10 |
|
|
if test $1 = ifort ; then |
11 |
|
|
# tst_list='iadm imp2 iur4' |
12 |
|
|
tst_list='iad4 imp2 iur4' |
13 |
|
|
dd1=`date +%d -d "1 day"` |
14 |
jmc |
1.2 |
# if test $dd1 != '01' ; then echo 'not last day of month'; exit ; fi |
15 |
jmc |
1.1 |
elif test $1 = gfort ; then |
16 |
jmc |
1.3 |
tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4 g77' |
17 |
|
|
elif test $1 = gfor8 ; then |
18 |
jmc |
1.1 |
# tst_list='gadm gads gmp2 gmpi gfo g77' |
19 |
|
|
tst_list='gadm gads gmp2 gfo' |
20 |
|
|
elif test $1 = gfor4 ; then |
21 |
|
|
tst_list='gad4 gmp4 gfo4 g77' |
22 |
|
|
else |
23 |
|
|
tst_list=$* |
24 |
|
|
fi |
25 |
|
|
fi |
26 |
|
|
echo "run: \""`basename $0` $*"\" on:" `date` |
27 |
|
|
echo " tst_list='$tst_list'" |
28 |
|
|
|
29 |
|
|
#- to get ~/bin in the patch (for staf) when run on cron: |
30 |
|
|
if [ -d ~/bin ]; then |
31 |
|
|
echo 'add ~/bin to $PATH' |
32 |
|
|
export PATH=$PATH:~/bin |
33 |
|
|
fi |
34 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
35 |
|
|
#export LC_ALL="en_US.UTF-8" |
36 |
|
|
#- Turn off stack limit for FIZHI & AD-tests |
37 |
|
|
ulimit -s unlimited |
38 |
|
|
#- method to acces CVS: |
39 |
jmc |
1.6 |
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q' |
40 |
|
|
#- and which GitHub repository to use: |
41 |
|
|
git_repo='MITgcm'; git_code='MITgcm' |
42 |
|
|
#git_repo='altMITgcm'; #git_code='MITgcm66h' |
43 |
|
|
#- other settings: |
44 |
|
|
tmpFil="/tmp/"`basename $0`".$$" |
45 |
|
|
mAddr='jm_c@mitgcm.org' |
46 |
jmc |
1.1 |
|
47 |
|
|
#-- for now, cannot mix ifort/gfortran tests: |
48 |
|
|
gfort=1 |
49 |
|
|
for tt in $tst_list |
50 |
|
|
do |
51 |
|
|
echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$? |
52 |
|
|
if [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2 |
53 |
|
|
elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0 |
54 |
|
|
else echo 'cannot mix ifort/gfortran' ; exit |
55 |
|
|
fi |
56 |
|
|
done |
57 |
|
|
if [ $gfort -eq 0 ] ; then |
58 |
|
|
#echo 'source ~jmc/bin/intel_v14.sh' |
59 |
|
|
#source ~jmc/bin/intel_v14.sh |
60 |
|
|
echo 'source ~jmc/bin/intel_v15.sh' |
61 |
|
|
source ~jmc/bin/intel_v15.sh |
62 |
|
|
fi |
63 |
|
|
if [ $gfort -eq 2 ] ; then |
64 |
|
|
echo 'source ~jmc/bin/openmpi.sh' |
65 |
|
|
source ~jmc/bin/openmpi.sh |
66 |
|
|
fi |
67 |
|
|
|
68 |
|
|
#-------------------------------------------------------------------- |
69 |
|
|
for tt in $tst_list |
70 |
|
|
do |
71 |
|
|
|
72 |
jmc |
1.6 |
gcmDIR="MITgcm_$tt" |
73 |
jmc |
1.1 |
echo "==========================================================================" |
74 |
|
|
# set -x |
75 |
|
|
rm -f tr_clean_$tt.log |
76 |
|
|
echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$? |
77 |
|
|
echo " testing tt= $tt , fwd= $fwd" |
78 |
jmc |
1.6 |
if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then |
79 |
jmc |
1.1 |
#- cleaning previous testreport run and updating the code: |
80 |
|
|
if [ $fwd -eq 0 ] ; then |
81 |
|
|
set -x |
82 |
|
|
#- cleanup previous test: |
83 |
jmc |
1.6 |
( cd $gcmDIR/verification ; ./testreport -adm -clean > ../../tr_clean_$tt.log 2>&1 ) |
84 |
jmc |
1.1 |
set +x |
85 |
|
|
else |
86 |
|
|
set -x |
87 |
|
|
#- cleanup previous restart: |
88 |
jmc |
1.6 |
( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean > ../../tr_clean_$tt.log 2>&1 ) |
89 |
jmc |
1.1 |
#- cleanup previous test: |
90 |
jmc |
1.6 |
( cd $gcmDIR/verification ; ./testreport -clean >> ../../tr_clean_$tt.log 2>&1 ) |
91 |
jmc |
1.1 |
set +x |
92 |
|
|
fi |
93 |
|
|
if [ $gfort -eq 0 ] ; then |
94 |
jmc |
1.6 |
echo ' remove all Makefile_syntax' >> tr_clean_$tt.log |
95 |
|
|
( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax ) |
96 |
jmc |
1.1 |
fi |
97 |
jmc |
1.6 |
echo "" >> tr_clean_$tt.log |
98 |
jmc |
1.1 |
|
99 |
jmc |
1.6 |
echo "==========================================================================" \ |
100 |
|
|
>> tr_clean_$tt.log |
101 |
|
|
echo " Update MITgcm code in dir: $gcmDIR using 'git pull':" | tee -a tr_clean_$tt.log |
102 |
jmc |
1.1 |
set -x |
103 |
|
|
#- update the code: |
104 |
jmc |
1.7 |
( cd $gcmDIR ; git pull ) >> tr_clean_$tt.log 2>&1 ; retv=$? |
105 |
jmc |
1.1 |
set +x |
106 |
jmc |
1.5 |
if test $retv != 0 ; then |
107 |
jmc |
1.6 |
echo "'git pull' in $gcmDIR fail (return val=$retv) => skip" | tee -a tr_clean_$tt.log |
108 |
jmc |
1.5 |
continue |
109 |
|
|
fi |
110 |
jmc |
1.7 |
echo " and checkout master:" | tee -a tr_clean_$tt.log |
111 |
|
|
set -x |
112 |
|
|
( cd $gcmDIR ; git checkout master -- . ) >> tr_clean_$tt.log 2>&1 |
113 |
|
|
set +x |
114 |
jmc |
1.1 |
else |
115 |
jmc |
1.6 |
echo "Missing '$gcmDIR/.git/config' or dir '$gcmDIR/verification'" >> tr_clean_$tt.log |
116 |
|
|
if test -e $gcmDIR ; then |
117 |
|
|
echo -n " removing working copy: $gcmDIR ..." >> tr_clean_$tt.log |
118 |
|
|
rm -rf $gcmDIR |
119 |
|
|
echo " done" >> tr_clean_$tt.log |
120 |
|
|
fi |
121 |
jmc |
1.1 |
#- download new code: |
122 |
jmc |
1.6 |
echo "==========================================================================" \ |
123 |
|
|
>> tr_clean_$tt.log |
124 |
|
|
echo "Make a clone of $git_code from repo: $git_repo into: $gcmDIR ..." | tee -a tr_clean_$tt.log |
125 |
jmc |
1.1 |
set -x |
126 |
jmc |
1.6 |
git clone https://github.com/$git_repo/${git_code}.git $gcmDIR 2> $tmpFil |
127 |
|
|
retv=$? |
128 |
jmc |
1.1 |
set +x |
129 |
jmc |
1.6 |
if test $retv = 0 ; then |
130 |
|
|
echo ' done' >> tr_clean_$tt.log ; rm -f $tmpFil |
131 |
|
|
else |
132 |
|
|
echo "'git clone' into $gcmDIR failed (return: $retv) => skip" | tee -a tr_clean_$tt.log |
133 |
|
|
cat $tmpFil >> tr_clean_$tt.log ; rm -f $tmpFil |
134 |
jmc |
1.5 |
continue |
135 |
|
|
fi |
136 |
jmc |
1.1 |
fi |
137 |
|
|
echo "" |
138 |
|
|
echo "==========================================================================" |
139 |
|
|
|
140 |
jmc |
1.6 |
if test -d $gcmDIR/verification ; then |
141 |
jmc |
1.1 |
if test -e tr_run_$tt.log ; then mv -f tr_run_$tt.log tr_run_$tt.log_bak ; fi |
142 |
jmc |
1.6 |
cd $gcmDIR/verification |
143 |
jmc |
1.1 |
|
144 |
|
|
date |
145 |
|
|
# verbose mode: |
146 |
|
|
set -x |
147 |
|
|
pwd |
148 |
|
|
test -e tr_out.txt && mv -f tr_out.txt tr_out.sav |
149 |
|
|
|
150 |
|
|
case $tt in |
151 |
|
|
'iadm' ) |
152 |
|
|
|
153 |
|
|
./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_ifort11 \ |
154 |
|
|
-devel -nc -ncad -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1 |
155 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
156 |
|
|
|
157 |
|
|
./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_ifort11 \ |
158 |
jmc |
1.6 |
-devel -q -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
159 |
jmc |
1.1 |
|
160 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
161 |
|
|
;; |
162 |
|
|
|
163 |
|
|
'iad4' ) |
164 |
|
|
|
165 |
|
|
./testreport -MPI 3 -ur4 -adm -of ../tools/build_options/linux_amd64_ifort11 \ |
166 |
|
|
-devel -nc -ncad -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1 |
167 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
168 |
|
|
|
169 |
|
|
./testreport -MPI 3 -ur4 -adm -of ../tools/build_options/linux_amd64_ifort11 \ |
170 |
jmc |
1.6 |
-devel -q -match 5 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
171 |
jmc |
1.1 |
|
172 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
173 |
|
|
;; |
174 |
|
|
|
175 |
|
|
'imp2') |
176 |
|
|
|
177 |
|
|
export OMP_NUM_THREADS=2 |
178 |
|
|
export KMP_STACKSIZE=400m |
179 |
|
|
|
180 |
|
|
./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_ifort11 \ |
181 |
|
|
-devel -nc -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1 |
182 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
183 |
|
|
|
184 |
|
|
./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_ifort11 \ |
185 |
jmc |
1.6 |
-devel -q -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
186 |
jmc |
1.1 |
|
187 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
188 |
|
|
|
189 |
|
|
#- test restart: |
190 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
191 |
jmc |
1.6 |
../tools/do_tst_2+2 -mpi -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
192 |
jmc |
1.1 |
;; |
193 |
|
|
|
194 |
|
|
'iur4') |
195 |
|
|
|
196 |
|
|
./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_ifort11 \ |
197 |
|
|
-devel -nc -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1 |
198 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
199 |
|
|
|
200 |
|
|
./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_ifort11 \ |
201 |
jmc |
1.6 |
-devel -q -match 5 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
202 |
jmc |
1.1 |
|
203 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
204 |
|
|
|
205 |
|
|
#- test restart: |
206 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
207 |
jmc |
1.6 |
../tools/do_tst_2+2 -mpi -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
208 |
jmc |
1.1 |
;; |
209 |
|
|
|
210 |
|
|
'gadm') |
211 |
|
|
|
212 |
|
|
./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_gfortran \ |
213 |
jmc |
1.6 |
-devel -ncad -nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
214 |
jmc |
1.1 |
|
215 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
216 |
|
|
;; |
217 |
|
|
|
218 |
|
|
'gads') |
219 |
|
|
|
220 |
|
|
./testreport -adm -of ../tools/build_options/linux_amd64_gfortran \ |
221 |
jmc |
1.6 |
-devel -ncad -nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
222 |
jmc |
1.1 |
|
223 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
224 |
|
|
;; |
225 |
|
|
|
226 |
|
|
'gad4') |
227 |
|
|
|
228 |
|
|
./testreport -adm -ur4 -of ../tools/build_options/linux_amd64_gfortran \ |
229 |
jmc |
1.6 |
-devel -ncad -nc -match 5 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
230 |
jmc |
1.1 |
|
231 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
232 |
|
|
;; |
233 |
|
|
|
234 |
|
|
'gmp2') |
235 |
|
|
|
236 |
|
|
export OMP_NUM_THREADS=2 |
237 |
|
|
export GOMP_STACKSIZE=400m |
238 |
|
|
|
239 |
|
|
./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_gfortran \ |
240 |
jmc |
1.6 |
-devel -nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
241 |
jmc |
1.1 |
|
242 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
243 |
|
|
|
244 |
|
|
#- test restart: |
245 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
246 |
jmc |
1.6 |
../tools/do_tst_2+2 -mpi -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
247 |
jmc |
1.1 |
;; |
248 |
|
|
|
249 |
|
|
'gmpi') |
250 |
|
|
|
251 |
|
|
./testreport -MPI 3 -of ../tools/build_options/linux_amd64_gfortran \ |
252 |
jmc |
1.6 |
-devel -nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
253 |
jmc |
1.1 |
|
254 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
255 |
|
|
|
256 |
|
|
#- test restart: |
257 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
258 |
jmc |
1.6 |
../tools/do_tst_2+2 -mpi -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
259 |
jmc |
1.1 |
;; |
260 |
|
|
|
261 |
|
|
'gmp4') |
262 |
|
|
|
263 |
|
|
./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_gfortran \ |
264 |
jmc |
1.6 |
-devel -nc -match 5 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
265 |
jmc |
1.1 |
|
266 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
267 |
|
|
|
268 |
|
|
#- test restart: |
269 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
270 |
jmc |
1.6 |
../tools/do_tst_2+2 -mpi -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
271 |
jmc |
1.1 |
;; |
272 |
|
|
|
273 |
|
|
'gfo') |
274 |
|
|
|
275 |
|
|
./testreport -of ../tools/build_options/linux_amd64_gfortran \ |
276 |
jmc |
1.6 |
-devel -nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
277 |
jmc |
1.1 |
|
278 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
279 |
|
|
|
280 |
|
|
#- test restart: |
281 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
282 |
jmc |
1.6 |
../tools/do_tst_2+2 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
283 |
jmc |
1.1 |
;; |
284 |
|
|
|
285 |
|
|
'gfo4') |
286 |
|
|
|
287 |
|
|
./testreport -ur4 -of ../tools/build_options/linux_amd64_gfortran \ |
288 |
jmc |
1.6 |
-devel -nc -match 5 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
289 |
jmc |
1.1 |
|
290 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
291 |
|
|
|
292 |
|
|
#- test restart: |
293 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
294 |
jmc |
1.6 |
../tools/do_tst_2+2 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
295 |
jmc |
1.1 |
;; |
296 |
|
|
|
297 |
|
|
'g77') |
298 |
|
|
|
299 |
|
|
./testreport -of ../tools/build_options/linux_amd64_g77 \ |
300 |
|
|
-skd 'fizhi-cs-32x32x40 fizhi-cs-aqualev20' \ |
301 |
jmc |
1.6 |
-nc -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
302 |
jmc |
1.1 |
|
303 |
|
|
sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log |
304 |
|
|
|
305 |
|
|
#- test restart: |
306 |
|
|
echo '' >> ../../tr_run_$tt.log 2>&1 |
307 |
jmc |
1.6 |
../tools/do_tst_2+2 -a $mAddr >> ../../tr_run_$tt.log 2>&1 |
308 |
jmc |
1.1 |
;; |
309 |
|
|
|
310 |
|
|
*) echo "unrecognized test suffix '$tt' <== skipped" ;; |
311 |
|
|
esac |
312 |
|
|
|
313 |
|
|
set +x |
314 |
|
|
cd ../.. |
315 |
|
|
|
316 |
|
|
else |
317 |
jmc |
1.6 |
echo "error: missing dir $gcmDIR/verification" |
318 |
jmc |
1.1 |
fi |
319 |
|
|
|
320 |
|
|
done |