/[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.17 - (hide annotations) (download)
Mon Oct 2 13:02:27 2023 UTC (21 months, 1 week ago) by jmc
Branch: MAIN
Changes since 1.16: +8 -6 lines
set matching criteria to 13 for Tapenade tests (since this is the reference test)

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

  ViewVC Help
Powered by ViewVC 1.1.22