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

Contents of /MITgcm_contrib/test_scripts/other/test_local

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


Revision 1.13 - (show annotations) (download)
Wed May 31 13:51:39 2023 UTC (2 years, 6 months 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 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/other/test_local,v 1.12 2023/02/16 21:29:01 jmc Exp $
4 # $Name: $
5
6 #-------------------------------------------------------------------------------
7 #-- process argument list:
8 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 # if test $dd1 != '01' ; then echo 'not last day of month'; exit ; fi
17 elif test $1 = gfort ; then
18 tst_list='gadm gads gad4 gmp4 gmp2 gfo gfo4'
19 # tst_list="$tst_list g77 g7a"
20 elif test $1 = tap ; then
21 tst_list='tapAD tapTL'
22 elif test $1 = gfor8 ; then
23 # 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 #-------------------------------------------------------------------------------
33 #-- general setting + MITgcm ref clone update:
34 #
35 #- 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 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 sendCmd='-a jm_c@mitgcm.org'
47 sendCmd='-send scp -a jm_c@mitgcm.org:testing/MITgcm-test'
48
49 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 gfort=1
103 for tt in $tst_list
104 do
105 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 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 #-------------------------------------------------------------------------------
126 #-- Update & Run individual test:
127 for tt in $tst_list
128 do
129
130 #- Clean and Update testing clone: ---------------------------------------------
131 gcmDIR="MITgcm_$tt"
132 echo "=========================================================================="
133 # set -x
134 rm -f tr_clean_$tt.log
135 echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$?
136 echo $tt | grep '^tap' > /dev/null 2>&1 ; tap=$?
137 if test $tt = g7a -o $tap = 0 ; then fwd=0 ; clOpt='-adm' ; fi
138 echo " testing tt= $tt , fwd= $fwd"
139 if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then
140 #- cleaning previous testreport run and updating the code:
141 if [ $fwd -eq 0 ] ; then
142 if test $tt = 'tapAD' ; then clOpt='-tap -adm' ; fi
143 if test $tt = 'tapTL' ; then clOpt='-tap -tlm' ; fi
144 set -x
145 #- cleanup previous test:
146 ( cd $gcmDIR/verification ; ./testreport $clOpt -clean > ../../tr_clean_$tt.log 2>&1 )
147 set +x
148 else
149 set -x
150 #- cleanup previous restart:
151 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean > ../../tr_clean_$tt.log 2>&1 )
152 #- cleanup previous test:
153 ( cd $gcmDIR/verification ; ./testreport -clean >> ../../tr_clean_$tt.log 2>&1 )
154 set +x
155 fi
156 if [ $gfort -eq 0 ] ; then
157 echo ' remove all Makefile_syntax' >> tr_clean_$tt.log
158 ( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax )
159 fi
160 echo "" >> tr_clean_$tt.log
161
162 echo "==========================================================================" \
163 >> tr_clean_$tt.log
164 echo " Update MITgcm code in dir: $gcmDIR using 'git pull':" | tee -a tr_clean_$tt.log
165 set -x
166 #- update the code:
167 ( cd $gcmDIR ; git pull ) >> tr_clean_$tt.log 2>&1 ; retv=$?
168 set +x
169 if test $retv != 0 ; then
170 echo "'git pull' in $gcmDIR fail (return val=$retv) => skip" | tee -a tr_clean_$tt.log
171 continue
172 fi
173 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 else
178 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 #- download new code:
185 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 set -x
189 git clone https://github.com/$git_repo/${git_code}.git $gcmDIR 2> $tmpFil
190 retv=$?
191 set +x
192 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 continue
198 fi
199 fi
200 echo ""
201 echo "=========================================================================="
202
203 if test -d $gcmDIR/verification ; then
204 if test -e tr_run_$tt.log ; then mv -f tr_run_$tt.log tr_run_$tt.log_bak ; fi
205 cd $gcmDIR/verification
206
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 #- Run test in corresponding clone: --------------------------------------------
214 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 -devel -q $sendCmd >> ../../tr_run_$tt.log 2>&1
223
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 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
235
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 -devel -q $sendCmd >> ../../tr_run_$tt.log 2>&1
250
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
256 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
257 ;;
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 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
267
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
273 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
274 ;;
275
276 'gadm')
277
278 ./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_gfortran \
279 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
280
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 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
288
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 -devel -ncad -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
296
297 sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
298 ;;
299
300 '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 'g7a')
317
318 ./testreport -adm -of ../tools/build_options/linux_amd64_g77 \
319 -skd 'halfpipe_streamice' \
320 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
321
322 sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
323 ;;
324
325 '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 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
332
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
338 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
339 ;;
340
341 'gmpi')
342
343 ./testreport -MPI 3 -of ../tools/build_options/linux_amd64_gfortran \
344 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
345
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
351 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
352 ;;
353
354 'gmp4')
355
356 ./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_gfortran \
357 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
358
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
364 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
365 ;;
366
367 'gfo')
368
369 ./testreport -of ../tools/build_options/linux_amd64_gfortran \
370 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
371
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
377 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
378 ;;
379
380 'gfo4')
381
382 ./testreport -ur4 -of ../tools/build_options/linux_amd64_gfortran \
383 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
384
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
390 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
391 ;;
392
393 'g77')
394
395 ./testreport -of ../tools/build_options/linux_amd64_g77 \
396 -skd 'fizhi-cs-32x32x40 fizhi-cs-aqualev20 halfpipe_streamice internal_wave tutorial_advection_in_gyre' \
397 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
398
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
404 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
405 ;;
406
407 *) echo "unrecognized test suffix '$tt' <== skipped" ;;
408 esac
409
410 set +x
411 cd ../..
412
413 else
414 echo "error: missing dir $gcmDIR/verification"
415 fi
416
417 done

  ViewVC Help
Powered by ViewVC 1.1.22