/[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.14 - (show annotations) (download)
Sun Jun 4 14:00:29 2023 UTC (3 years, 2 months 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 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/other/test_local,v 1.13 2023/05/31 13:51:39 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 logFile='check_update.log'
47 sendCmd='-a jm_c@mitgcm.org'
48 sendCmd='-send scp -a jm_c@mitgcm.org:testing/MITgcm-test'
49
50 echo "-- run: \""`basename $0` $*"\" on:" `date` >> $logFile
51 gcmDIR="MITgcm"
52 if test -e $gcmDIR/.git/config ; then : else
53 echo " No current clone ==> get a fresh clone" >> $logFile
54 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 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 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 gfort=1
105 for tt in $tst_list
106 do
107 echo $tt | grep '^tap' > /dev/null 2>&1 ; retv=$?
108 if [ $retv -ne 0 ] ; then
109 echo $tt | grep '^g' > /dev/null 2>&1 ; retv=$?
110 fi
111 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 #-------------------------------------------------------------------------------
128 #-- Update & Run individual test:
129 for tt in $tst_list
130 do
131
132 #- Clean and Update testing clone: ---------------------------------------------
133 gcmDIR="MITgcm_$tt"
134 echo "=========================================================================="
135 # set -x
136 rm -f tr_clean_$tt.log
137 echo $tt | grep '^.ad' > /dev/null 2>&1 ; fwd=$?
138 echo $tt | grep '^tap' > /dev/null 2>&1 ; tap=$?
139 if test $tt = g7a -o $tap = 0 ; then fwd=0 ; clOpt='-adm' ; fi
140 echo " testing tt= $tt , fwd= $fwd"
141 if test -e $gcmDIR/.git/config -a -d $gcmDIR/verification ; then
142 #- cleaning previous testreport run and updating the code:
143 if [ $fwd -eq 0 ] ; then
144 if test $tt = 'tapAD' ; then clOpt='-tap -adm' ; fi
145 if test $tt = 'tapTL' ; then clOpt='-tap -tlm' ; fi
146 set -x
147 #- cleanup previous test:
148 ( cd $gcmDIR/verification ; ./testreport $clOpt -clean > ../../tr_clean_$tt.log 2>&1 )
149 set +x
150 else
151 set -x
152 #- cleanup previous restart:
153 ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean > ../../tr_clean_$tt.log 2>&1 )
154 #- cleanup previous test:
155 ( cd $gcmDIR/verification ; ./testreport -clean >> ../../tr_clean_$tt.log 2>&1 )
156 set +x
157 fi
158 if [ $gfort -eq 0 ] ; then
159 echo ' remove all Makefile_syntax' >> tr_clean_$tt.log
160 ( cd $gcmDIR/verification ; rm -f */build/Makefile_syntax )
161 fi
162 echo "" >> tr_clean_$tt.log
163
164 echo "==========================================================================" \
165 >> tr_clean_$tt.log
166 echo " Update MITgcm code in dir: $gcmDIR using 'git pull':" | tee -a tr_clean_$tt.log
167 set -x
168 #- update the code:
169 ( cd $gcmDIR ; git pull ) >> tr_clean_$tt.log 2>&1 ; retv=$?
170 set +x
171 if test $retv != 0 ; then
172 echo "'git pull' in $gcmDIR fail (return val=$retv) => skip" | tee -a tr_clean_$tt.log
173 continue
174 fi
175 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 else
180 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 #- download new code:
187 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 set -x
191 git clone https://github.com/$git_repo/${git_code}.git $gcmDIR 2> $tmpFil
192 retv=$?
193 set +x
194 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 continue
200 fi
201 fi
202 echo ""
203 echo "=========================================================================="
204
205 if test -d $gcmDIR/verification ; then
206 if test -e tr_run_$tt.log ; then mv -f tr_run_$tt.log tr_run_$tt.log_bak ; fi
207 cd $gcmDIR/verification
208
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 #- Run test in corresponding clone: --------------------------------------------
216 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 -devel -q $sendCmd >> ../../tr_run_$tt.log 2>&1
225
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 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
237
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 -devel -q $sendCmd >> ../../tr_run_$tt.log 2>&1
252
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
258 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
259 ;;
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 -devel -q -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
269
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
275 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
276 ;;
277
278 'gadm')
279
280 ./testreport -MPI 3 -adm -of ../tools/build_options/linux_amd64_gfortran \
281 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
282
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 -devel -ncad -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
290
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 -devel -ncad -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
298
299 sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
300 ;;
301
302 '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 'g7a')
319
320 ./testreport -adm -of ../tools/build_options/linux_amd64_g77 \
321 -skd 'halfpipe_streamice' \
322 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
323
324 sed -n "/ email /,/^======== End of testreport / p" ../../tr_run_$tt.log
325 ;;
326
327 '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 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
334
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
340 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
341 ;;
342
343 'gmpi')
344
345 ./testreport -MPI 3 -of ../tools/build_options/linux_amd64_gfortran \
346 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
347
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
353 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
354 ;;
355
356 'gmp4')
357
358 ./testreport -MPI 3 -ur4 -of ../tools/build_options/linux_amd64_gfortran \
359 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
360
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 ../tools/do_tst_2+2 -mpi $sendCmd >> ../../tr_run_$tt.log 2>&1
366 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
367 ;;
368
369 'gfo')
370
371 ./testreport -of ../tools/build_options/linux_amd64_gfortran \
372 -devel -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
373
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
379 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
380 ;;
381
382 'gfo4')
383
384 ./testreport -ur4 -of ../tools/build_options/linux_amd64_gfortran \
385 -devel -nc -match 5 $sendCmd >> ../../tr_run_$tt.log 2>&1
386
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
392 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
393 ;;
394
395 'g77')
396
397 ./testreport -of ../tools/build_options/linux_amd64_g77 \
398 -skd 'fizhi-cs-32x32x40 fizhi-cs-aqualev20 halfpipe_streamice internal_wave tutorial_advection_in_gyre' \
399 -nc $sendCmd >> ../../tr_run_$tt.log 2>&1
400
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 ../tools/do_tst_2+2 $sendCmd >> ../../tr_run_$tt.log 2>&1
406 sed -n '/^===== Summary /,$ p' ../../tr_run_$tt.log
407 ;;
408
409 *) echo "unrecognized test suffix '$tt' <== skipped" ;;
410 esac
411
412 set +x
413 cd ../..
414
415 else
416 echo "error: missing dir $gcmDIR/verification"
417 fi
418
419 done
420
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