/[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.14 - (hide annotations) (download)
Sun Jun 4 14:00:29 2023 UTC (2 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.13: +25 -11 lines
adjust previous changes: now do the git-clone update (used to check for "yap" test)
in separate script "test_update_local" and save previous output.

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

  ViewVC Help
Powered by ViewVC 1.1.22