/[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.13 - (hide annotations) (download)
Wed May 31 13:51:39 2023 UTC (2 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.12: +90 -13 lines
1) check if Git-Repos mater branch has any update since last time
   this script was run
2) Add Adjoint + Tang-Lin test with Tapenade
 - for now, without MPI, and using gfortran and default "-ieee".
 - skip Tapenade tests when Git-Repos has no update since last
   it was run.

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

  ViewVC Help
Powered by ViewVC 1.1.22