/[MITgcm]/MITgcm_contrib/test_scripts/other/test_local
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/other/test_local

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (hide annotations) (download)
Sun Oct 1 16:00:51 2023 UTC (21 months, 1 week ago) by jmc
Branch: MAIN
Changes since 1.15: +6 -6 lines
Fix cleaning option (since version 1.13)

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.16 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/other/test_local,v 1.15 2023/06/14 04:18:20 jmc Exp $
4 jmc 1.1 # $Name: $
5    
6 jmc 1.13 #-------------------------------------------------------------------------------
7     #-- process argument list:
8 jmc 1.1 if test $# = 0 ; then
9     echo 'need 1 argument'
10     exit
11     else
12     if test $1 = ifort ; then
13     # tst_list='iadm imp2 iur4'
14     tst_list='iad4 imp2 iur4'
15     dd1=`date +%d -d "1 day"`
16 jmc 1.2 # if test $dd1 != '01' ; then echo 'not last day of month'; exit ; fi
17 jmc 1.1 elif test $1 = gfort ; then
18 jmc 1.12 tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4'
19     # tst_list="$tst_list g77 g7a"
20 jmc 1.13 elif test $1 = tap ; then
21     tst_list='tapAD tapTL'
22 jmc 1.3 elif test $1 = gfor8 ; then
23 jmc 1.1 # tst_list='gadm gads gmp2 gmpi gfo g77'
24     tst_list='gadm gads gmp2 gfo'
25     elif test $1 = gfor4 ; then
26     tst_list='gad4 gmp4 gfo4 g77'
27     else
28     tst_list=$*
29     fi
30     fi
31    
32 jmc 1.13 #-------------------------------------------------------------------------------
33     #-- general setting + MITgcm ref clone update:
34     #
35 jmc 1.1 #- to get case insensitive "ls" (and order of tested experiments)
36     #export LC_ALL="en_US.UTF-8"
37     #- Turn off stack limit for FIZHI & AD-tests
38     ulimit -s unlimited
39     #- method to acces CVS:
40 jmc 1.6 cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack -q'
41     #- and which GitHub repository to use:
42     git_repo='MITgcm'; git_code='MITgcm'
43     #git_repo='altMITgcm'; #git_code='MITgcm66h'
44     #- other settings:
45     tmpFil="/tmp/"`basename $0`".$$"
46 jmc 1.14 logFile='check_update.log'
47 jmc 1.8 sendCmd='-a jm_c@mitgcm.org'
48     sendCmd='-send scp -a jm_c@mitgcm.org:testing/MITgcm-test'
49 jmc 1.1
50 jmc 1.14 echo "-- run: \""`basename $0` $*"\" on:" `date` >> $logFile
51 jmc 1.13 gcmDIR="MITgcm"
52 jmc 1.15 if test -e $gcmDIR/.git/config ; then : ; else
53 jmc 1.14 echo " No current clone ==> get a fresh clone" >> $logFile
54 jmc 1.15 #rm -f git_Hash prevHash
55 jmc 1.13 if test -d $gcmDIR ; then /bin/rm -rf $gcmDIR ; fi
56     git clone https://github.com/$git_repo/${git_code}.git $gcmDIR
57     ( cd $gcmDIR ; git rev-parse HEAD > ../git_Hash )
58     fi
59    
60     #-------------------------------------------------------------------------------
61     #-- check particular set of tests:
62     if test $1 = tap ; then
63     #- Only run this pair of test if MITgcm code got updated:
64 jmc 1.15 if test -f git_Hash -a -f prevHash ; then
65 jmc 1.13 #ls -l prevHash >> $logFile
66     diff -q git_Hash prevHash > /dev/null 2>&1
67     retv=$?
68     if test $retv = 0 ; then
69     echo " No update in repos since previous test ==> skip '$1' set of tests" >> $logFile
70     exit 0
71     else
72     echo " Will run '$1' set of tests since repos has been updated" >> $logFile
73     echo -n ' prevHash: ' >> $logFile
74     cat prevHash >> $logFile
75     echo -n ' git_Hash: ' >> $logFile
76     cat git_Hash >> $logFile
77     fi
78     else
79     echo " No file 'prevHash' --> will run '$1' set of tests" >> $logFile
80     fi
81 jmc 1.14 elif test $1 = gfort ; then
82     #- to force to skip "tap" test while "gfort" is running:
83     if test -f prevHash ; then
84     cp -p prevHash git_Hash
85     else
86     cp -p git_Hash prevHash
87     fi
88 jmc 1.13 fi
89    
90     echo "run: \""`basename $0` $*"\" on:" `date`
91     echo " tst_list='$tst_list'"
92    
93     #- to get ~/bin in the patch (for staf) when run on cron:
94     if [ -d ~/bin ]; then
95     echo 'add ~/bin to $PATH'
96     export PATH=$PATH:~/bin
97     #- and for Tapenade:
98     echo $tst_list | grep '\<tap' > /dev/null 2>&1 ; retv=$?
99     if test $retv = 0 ; then
100     source ~jmc/bin/set_tapenade.sh
101     fi
102     fi
103    
104     #- for now, cannot mix ifort/gfortran tests:
105 jmc 1.1 gfort=1
106     for tt in $tst_list
107     do
108 jmc 1.13 echo $tt | grep '^tap' > /dev/null 2>&1 ; retv=$?
109 jmc 1.14 if [ $retv -ne 0 ] ; then
110 jmc 1.13 echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$?
111     fi
112 jmc 1.1 if [ $retv -eq 0 -a $gfort -ge 1 ] ; then gfort=2
113     elif [ $retv -ne 0 -a $gfort -le 1 ] ; then gfort=0
114     else echo 'cannot mix ifort/gfortran' ; exit
115     fi
116     done
117     if [ $gfort -eq 0 ] ; then
118     #echo 'source ~jmc/bin/intel_v14.sh'
119     #source ~jmc/bin/intel_v14.sh
120     echo 'source ~jmc/bin/intel_v15.sh'
121     source ~jmc/bin/intel_v15.sh
122     fi
123     if [ $gfort -eq 2 ] ; then
124     echo 'source ~jmc/bin/openmpi.sh'
125     source ~jmc/bin/openmpi.sh
126     fi
127    
128 jmc 1.13 #-------------------------------------------------------------------------------
129     #-- Update & Run individual test:
130 jmc 1.1 for tt in $tst_list
131     do
132    
133 jmc 1.13 #- Clean and Update testing clone: ---------------------------------------------
134 jmc 1.6 gcmDIR="MITgcm_$tt"
135 jmc 1.1 echo "=========================================================================="
136     # set -x
137     rm -f tr_clean_$tt.log
138     echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$?
139 jmc 1.13 echo $tt | grep '^tap' > /dev/null 2>&1 ; tap=$?
140 jmc 1.16 if test $tt = g7a ; then fwd=0 ; fi
141     echo " testing tt= $tt , fwd= $fwd , tap= $tap"
142 jmc 1.6 if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then
143 jmc 1.1 #- cleaning previous testreport run and updating the code:
144 jmc 1.16 if [ $fwd -eq 0 -o $tap -eq 0 ] ; then
145     if test $tt = 'tapTL' ; then clOpt='-tlm' ; else clOpt='-adm' ; fi
146     if [ $tap -eq 0 ] ; then clOpt="-tap $clOpt" ; fi
147 jmc 1.1 set -x
148     #- cleanup previous test:
149 jmc 1.13 ( cd $gcmDIR/verification ; ./testreport $clOpt -clean > ../../tr_clean_$tt.log 2>&1 )
150 jmc 1.1 set +x
151     else
152     set -x
153     #- cleanup previous restart:
154 jmc 1.6 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean > ../../tr_clean_$tt.log 2>&1 )
155 jmc 1.1 #- cleanup previous test:
156 jmc 1.6 ( cd $gcmDIR/verification ; ./testreport -clean >> ../../tr_clean_$tt.log 2>&1 )
157 jmc 1.1 set +x
158     fi
159     if [ $gfort -eq 0 ] ; then
160 jmc 1.6 echo ' remove all Makefile_syntax' >> tr_clean_$tt.log
161     ( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax )
162 jmc 1.1 fi
163 jmc 1.6 echo "" >> tr_clean_$tt.log
164 jmc 1.1
165 jmc 1.6 echo "==========================================================================" \
166     >> tr_clean_$tt.log
167     echo " Update MITgcm code in dir: $gcmDIR using 'git pull':" | tee -a tr_clean_$tt.log
168 jmc 1.1 set -x
169     #- update the code:
170 jmc 1.7 ( cd $gcmDIR ; git pull ) >> tr_clean_$tt.log 2>&1 ; retv=$?
171 jmc 1.1 set +x
172 jmc 1.5 if test $retv != 0 ; then
173 jmc 1.6 echo "'git pull' in $gcmDIR fail (return val=$retv) => skip" | tee -a tr_clean_$tt.log
174 jmc 1.5 continue
175     fi
176 jmc 1.7 echo " and checkout master:" | tee -a tr_clean_$tt.log
177     set -x
178     ( cd $gcmDIR ; git checkout master -- . ) >> tr_clean_$tt.log 2>&1
179     set +x
180 jmc 1.1 else
181 jmc 1.6 echo "Missing '$gcmDIR/.git/config' or dir '$gcmDIR/verification'" >> tr_clean_$tt.log
182     if test -e $gcmDIR ; then
183     echo -n " removing working copy: $gcmDIR ..." >> tr_clean_$tt.log
184     rm -rf $gcmDIR
185     echo " done" >> tr_clean_$tt.log
186     fi
187 jmc 1.1 #- download new code:
188 jmc 1.6 echo "==========================================================================" \
189     >> tr_clean_$tt.log
190     echo "Make a clone of $git_code from repo: $git_repo into: $gcmDIR ..." | tee -a tr_clean_$tt.log
191 jmc 1.1 set -x
192 jmc 1.6 git clone https://github.com/$git_repo/${git_code}.git $gcmDIR 2> $tmpFil
193     retv=$?
194 jmc 1.1 set +x
195 jmc 1.6 if test $retv = 0 ; then
196     echo ' done' >> tr_clean_$tt.log ; rm -f $tmpFil
197     else
198     echo "'git clone' into $gcmDIR failed (return: $retv) => skip" | tee -a tr_clean_$tt.log
199     cat $tmpFil >> tr_clean_$tt.log ; rm -f $tmpFil
200 jmc 1.5 continue
201     fi
202 jmc 1.1 fi
203     echo ""
204     echo "=========================================================================="
205    
206 jmc 1.6 if test -d $gcmDIR/verification ; then
207 jmc 1.1 if test -e tr_run_$tt.log ; then mv -f tr_run_$tt.log tr_run_$tt.log_bak ; fi
208 jmc 1.6 cd $gcmDIR/verification
209 jmc 1.1
210     date
211     # verbose mode:
212     set -x
213     pwd
214     test -e tr_out.txt && mv -f tr_out.txt tr_out.sav
215    
216 jmc 1.13 #- Run test in corresponding clone: --------------------------------------------
217 jmc 1.1 case $tt in
218     'iadm' )
219    
220     ./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_ifort11 \
221     -devel -nc -ncad -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1
222     echo '' >> ../../tr_run_$tt.log 2>&1
223    
224     ./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_ifort11 \
225 jmc 1.8 -devel -q $sendCmd >> ../../tr_run_$tt.log 2>&1
226 jmc 1.1
227     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
228     ;;
229    
230     'iad4' )
231    
232     ./testreport -MPI 3 -ur4 -adm -of ../tools/build_options/linux_amd64_ifort11 \
233     -devel -nc -ncad -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1
234     echo '' >> ../../tr_run_$tt.log 2>&1
235    
236     ./testreport -MPI 3 -ur4 -adm -of ../tools/build_options/linux_amd64_ifort11 \
237 jmc 1.8 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
238 jmc 1.1
239     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
240     ;;
241    
242     'imp2')
243    
244     export OMP_NUM_THREADS=2
245     export KMP_STACKSIZE=400m
246    
247     ./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_ifort11 \
248     -devel -nc -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1
249     echo '' >> ../../tr_run_$tt.log 2>&1
250    
251     ./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_ifort11 \
252 jmc 1.8 -devel -q $sendCmd >> ../../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.8 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
259 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
260 jmc 1.1 ;;
261    
262     'iur4')
263    
264     ./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_ifort11 \
265     -devel -nc -repl_mk do_make_syntax.sh -obj -dd > ../../tr_run_$tt.log 2>&1
266     echo '' >> ../../tr_run_$tt.log 2>&1
267    
268     ./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_ifort11 \
269 jmc 1.8 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
270 jmc 1.1
271     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
272    
273     #- test restart:
274     echo '' >> ../../tr_run_$tt.log 2>&1
275 jmc 1.8 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
276 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
277 jmc 1.1 ;;
278    
279     'gadm')
280    
281     ./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_gfortran \
282 jmc 1.8 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
283 jmc 1.1
284     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
285     ;;
286    
287     'gads')
288    
289     ./testreport -adm -of ../tools/build_options/linux_amd64_gfortran \
290 jmc 1.8 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
291 jmc 1.1
292     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
293     ;;
294    
295     'gad4')
296    
297     ./testreport -adm -ur4 -of ../tools/build_options/linux_amd64_gfortran \
298 jmc 1.8 -devel -ncad -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
299 jmc 1.1
300     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
301     ;;
302    
303 jmc 1.13 'tapAD')
304    
305     ./testreport -tap -adm -of ../tools/build_options/linux_amd64_gfortran \
306     $sendCmd >> ../../tr_run_$tt.log 2>&1
307    
308     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
309     ;;
310    
311     'tapTL')
312    
313     ./testreport -tap -tlm -of ../tools/build_options/linux_amd64_gfortran \
314     $sendCmd >> ../../tr_run_$tt.log 2>&1
315    
316     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
317     ;;
318    
319 jmc 1.10 'g7a')
320    
321     ./testreport -adm -of ../tools/build_options/linux_amd64_g77 \
322 jmc 1.11 -skd 'halfpipe_streamice' \
323 jmc 1.10 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
324    
325     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
326     ;;
327    
328 jmc 1.1 'gmp2')
329    
330     export OMP_NUM_THREADS=2
331     export GOMP_STACKSIZE=400m
332    
333     ./testreport -MPI 2 -mth -of ../tools/build_options/linux_amd64_gfortran \
334 jmc 1.8 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
335 jmc 1.1
336     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
337    
338     #- test restart:
339     echo '' >> ../../tr_run_$tt.log 2>&1
340 jmc 1.8 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
341 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
342 jmc 1.1 ;;
343    
344     'gmpi')
345    
346     ./testreport -MPI 3 -of ../tools/build_options/linux_amd64_gfortran \
347 jmc 1.8 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
348 jmc 1.1
349     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
350    
351     #- test restart:
352     echo '' >> ../../tr_run_$tt.log 2>&1
353 jmc 1.8 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
354 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
355 jmc 1.1 ;;
356    
357     'gmp4')
358    
359     ./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_gfortran \
360 jmc 1.8 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
361 jmc 1.1
362     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
363    
364     #- test restart:
365     echo '' >> ../../tr_run_$tt.log 2>&1
366 jmc 1.8 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
367 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
368 jmc 1.1 ;;
369    
370     'gfo')
371    
372     ./testreport -of ../tools/build_options/linux_amd64_gfortran \
373 jmc 1.8 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
374 jmc 1.1
375     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
376    
377     #- test restart:
378     echo '' >> ../../tr_run_$tt.log 2>&1
379 jmc 1.8 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
380 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
381 jmc 1.1 ;;
382    
383     'gfo4')
384    
385     ./testreport -ur4 -of ../tools/build_options/linux_amd64_gfortran \
386 jmc 1.8 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
387 jmc 1.1
388     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
389    
390     #- test restart:
391     echo '' >> ../../tr_run_$tt.log 2>&1
392 jmc 1.8 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
393 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
394 jmc 1.1 ;;
395    
396     'g77')
397    
398     ./testreport -of ../tools/build_options/linux_amd64_g77 \
399 jmc 1.11 -skd 'fizhi-cs-32x32x40 fizhi-cs-aqualev20 halfpipe_streamice internal_wave tutorial_advection_in_gyre' \
400 jmc 1.8 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
401 jmc 1.1
402     sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
403    
404     #- test restart:
405     echo '' >> ../../tr_run_$tt.log 2>&1
406 jmc 1.8 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
407 jmc 1.9 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
408 jmc 1.1 ;;
409    
410     *) echo "unrecognized test suffix '$tt' <== skipped" ;;
411     esac
412    
413     set +x
414     cd ../..
415    
416     else
417 jmc 1.6 echo "error: missing dir $gcmDIR/verification"
418 jmc 1.1 fi
419    
420     done
421 jmc 1.14
422     if test $1 = gfort ; then
423     day=`date +%d`
424     echo " day in the month='${day}'"
425     if test $day = 01 -a -f git_Hash ; then
426     ls -l git_Hash
427     echo -n ' git_Hash: '
428     cat git_Hash
429     echo "Remove file 'git_Hash' to force tomorrow 'tap' testing"
430     rm -f git_Hash
431     fi
432     fi

  ViewVC Help
Powered by ViewVC 1.1.22