/[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.15 - (show annotations) (download)
Wed Jun 14 04:18:20 2023 UTC (2 years, 9 months ago) by jmc
Branch: MAIN
Changes since 1.14: +4 -3 lines
fix test syntax

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

  ViewVC Help
Powered by ViewVC 1.1.22