/[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.18 - (hide annotations) (download)
Sat Feb 3 16:43:07 2024 UTC (17 months, 1 week ago) by jmc
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +12 -7 lines
minor tweak

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

  ViewVC Help
Powered by ViewVC 1.1.22