/[MITgcm]/MITgcm_contrib/test_scripts/ref_machine/test_batsi
ViewVC logotype

Annotation of /MITgcm_contrib/test_scripts/ref_machine/test_batsi

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


Revision 1.16 - (hide annotations) (download)
Sun Dec 24 18:00:27 2023 UTC (18 months, 3 weeks ago) by jmc
Branch: MAIN
Changes since 1.15: +3 -2 lines
add "-ncad" to try

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.16 # $Header: /u/gcmpack/MITgcm_contrib/test_scripts/ref_machine/test_batsi,v 1.15 2021/02/17 16:51:57 jmc Exp $
4 jmc 1.1
5     # Test script for MITgcm that should work on most of the x86_64 Linux machines.
6    
7     tst_grp=0 ; if test $# = 1 ; then tst_grp=$1 ; fi
8     if test $tst_grp != 'a' -a $tst_grp != 'b' ; then
9     echo "missing or invalid argument (expect: 'a' or 'b') ==> exit"
10     exit 1
11     fi
12    
13     #- defaults
14     #export PATH="$PATH:/usr/local/bin"
15     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
16     #- to get case insensitive "ls" (and order of tested experiments)
17     export LC_ALL="en_US.UTF-8"
18     # Turn off stack limit for FIZHI & AD-tests
19     ulimit -s unlimited
20     # MPI test (for now, only with gfortran)
21 jmc 1.7 source $HOME/bin/openmpi.sh
22 jmc 1.1
23     #- method to access CVS:
24     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack'
25     # cmdCVS='cvs -d /u/gcmpack'
26     # export CVS_RSH=ssh
27     # cmdCVS='cvs -q -d :ext:jmc@mitgcm.org:/u/gcmpack'
28    
29     #- which GitHub repository to use and how to access it:
30     git_repo='MITgcm'; git_code='MITgcm' ; git_other='verification_other'
31     #git_repo='altMITgcm'; #git_code='MITgcm66h'
32     #--
33     git_repo="https://github.com/$git_repo"
34     #git_repo="git://github.com/$git_repo"
35     #git_repo="git@github.com:$git_repo"
36    
37 jmc 1.5 #-------------------------------------------------------------------
38 jmc 1.1 # checkOut=3 : clone from GitHub and make a new copy (if sepDir)
39 jmc 1.5 # =2 : update (git pull) repo and make a new copy code (switch to 3 if no repo)
40 jmc 1.1 # =1 : skip update but use a new copy (if sepDir)
41     # =0 : use existing test code ( switch to 1 if missing test code )
42     dInWeek=`date +%a`
43    
44     dNam=`hostname -s | tr '[:upper:]' '[:lower:]'`
45     TESTDIR="$HOME/test_${dNam}"
46     #TESTDIR="/scratch/jmc/test_${dNam}"
47 jmc 1.6 #MC=13 ; outDir="${dNam}-${tst_grp}"
48     MC=11 ; outDir=$dNam
49 jmc 1.1 sepDir=1
50     option=
51    
52     if test $tst_grp = 'a' ; then
53     checkOut=2
54 jmc 1.15 tst_list=''
55     tst_list="$tst_list mpa adm mpi"
56     tst_list="$tst_list mth+rs gfo+rs"
57 jmc 1.1 else
58     checkOut=1
59     tst_list='adm g77 gfo+rs ifc'
60     if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi
61     fi
62     echo " test: $outDir ; list='$tst_list'"
63    
64     #option="-nc" ; checkOut=0
65     #option="-q" ; checkOut=0
66    
67     TODAY=`date +%d`
68     tmpFil="/tmp/"`basename $0`".$$"
69     tdir=$TESTDIR
70     updFile='updated_code' ; today=`date +%Y%m%d`
71    
72     if [ $checkOut -le 1 ] ; then
73     if test -e $tdir/MITgcm_today/doc ; then
74     echo $tdir/MITgcm_today/doc 'exist'
75     else
76     echo -n $tdir/MITgcm_today 'missing ; '
77     checkOut=2
78     echo "will make a new copy ( checkOut=$checkOut )"
79     fi
80     fi
81    
82     if [ $checkOut -ge 2 ] ; then
83     #---- cleaning:
84     if test -e $tdir ; then
85     #- remove date/lock-file:
86     if test -f $tdir/$updFile ; then rm -f $tdir/$updFile ; sleep 2 ; fi
87     echo -n "Removing working copy: $tdir/MITgcm_today ..."
88     test -e $tdir/MITgcm_today && rm -rf $tdir/MITgcm_today
89     else
90     echo -n "Creating a working dir: $tdir ..."
91     mkdir $tdir
92     fi
93     echo " done"
94     cd $tdir
95    
96     #---- Making a new clone or updating existing one:
97     if [ $checkOut -eq 2 ] ; then
98     if test -e $git_code/.git/config ; then
99     echo $git_code/.git/config 'exist'
100     else
101     echo -n $git_code/.git/config 'missing ; '
102     checkOut=3
103     echo "will get new clone ( checkOut=$checkOut )"
104     fi
105     if test -e $git_other/.git/config ; then
106     echo $git_other/.git/config 'exist'
107     else
108     echo -n $git_other/.git/config 'missing ; '
109     checkOut=3
110     echo "will get new clone ( checkOut=$checkOut )"
111     fi
112     fi
113     if [ $checkOut -eq 3 ] ; then
114     test -e $git_code && rm -rf $git_code
115     echo "Make a clone of $git_code from repo: $git_repo ..."
116     git clone $git_repo/${git_code}.git 2> $tmpFil
117     retVal=$?
118     if test $retVal = 0 ; then
119     echo ' --> done!'
120     rm -f $tmpFil
121     else
122     echo " Error: 'git clone' returned: $retVal"
123     cat $tmpFil
124     rm -f $tmpFil
125     exit 2
126     fi
127     test -e $git_other && rm -rf $git_other
128     echo "Make a clone of $git_other from repo: $git_repo ..."
129     git clone $git_repo/${git_other}.git 2> $tmpFil
130     retVal=$?
131     if test $retVal = 0 ; then
132     echo ' --> done!'
133     rm -f $tmpFil
134     else
135     echo " Error: 'git clone' returned: $retVal"
136     cat $tmpFil
137     rm -f $tmpFil
138     exit 2
139     fi
140     else
141     echo "Updating current clone ( $git_code ) ..."
142     ( cd $git_code ; git pull )
143     retVal=$?
144     if test $retVal = 0 ; then
145     echo ' --> done!'
146     else
147     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
148     exit 3
149     fi
150     ( cd $git_code ; git checkout master -- . )
151     echo "Updating current clone ( $git_other ) ..."
152     ( cd $git_other ; git pull )
153     retVal=$?
154     if test $retVal = 0 ; then
155     echo ' --> done!'
156     else
157     echo "git pull on '"`hostname`"' fail (return val=$retVal) => exit"
158     exit 3
159     fi
160     ( cd $git_other ; git checkout master -- . )
161     fi
162     #---- making a new working copy: MITgcm_today
163     rsync -a $git_code/ MITgcm_today --exclude '.git'
164     if test $sepDir = 0 ; then
165     echo -n " make a local copy of $git_other in MITgcm_today ..." | tee -a $tdir/output_$tt
166     ( cd MITgcm_today
167     rsync -a ../$git_other/ $git_other --exclude '.git' )
168     echo " done" | tee -a $tdir/output_$tt
169     fi
170     #---- updating "other_input" dir
171     if test -d other_input ; then
172     list_dirs=`(cd other_input ; ls 2> /dev/null )`
173     echo "Updating ( $cmdCVS update -P -d ) 'other_input' extra dirs:"
174     for exd in $list_dirs ; do
175     if test -d other_input/$exd/CVS ; then echo " $exd"
176     ( cd other_input/$exd ; $cmdCVS update -P -d )
177     fi
178     done
179     echo " <-- update of 'other_input' dirs done"
180     fi
181     #---- update date/lock-file:
182     echo $today > $updFile ; sleep 2 ; ls -l $updFile
183     else
184     cd $tdir
185     fi
186    
187     #------------------------------------------------------------------------
188    
189     firstTst=`echo $tst_list | awk '{print $1}'`
190     last_Tst=`echo $tst_list | awk '{print $NF}'`
191     for tt in $tst_list
192     do
193    
194     echo "================================================================"
195     typ=`echo $tt | sed 's/+rs//'`
196     #- define list of additional experiences to test:
197     addExp=''
198     if test $typ = 'mpi' ; then
199 jmc 1.2 addExp="offline_cheapaml atm_gray atm_strato"
200 jmc 1.15 addExp="$addExp global_ocean.gm_k3d"
201     addExp="$addExp global_ocean.gm_res"
202     addExp="$addExp global_oce_cs32"
203 jmc 1.1 fi
204     if test $typ = 'gfo' -o $typ = 'ifc' ; then
205     addExp="$addExp shelfice_remeshing"
206     fi
207     #- check day and time:
208     curDay=`date +%d` ; curHour=`date +%H`
209     if [ $curDay -ne $TODAY ] ; then
210     date ; echo "day is over => skip test $typ"
211     continue
212     fi
213     if [ $curHour -ge 18 ] ; then
214     date ; echo "too late to run test $typ"
215     continue
216     fi
217     if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then
218     echo "using option='$option' prevent multi-tests => skip test $typ"
219     continue
220     fi
221     #- clean-up old output files
222     if test -d $tdir/prev ; then
223     mv -f $tdir/output_${typ}* $tdir/prev
224     else
225     rm -f $tdir/output_${typ}*
226     fi
227     touch $tdir/output_$tt
228     echo -n "-- Starting test: $tt at: " >> $tdir/output_$tt
229     date >> $tdir/output_$tt
230     echo " typ='$typ', addExp='$addExp'" >> $tdir/output_$tt
231     if test $sepDir = 1 ; then
232     new_dir="MITgcm_$typ"
233     reUse=0 ; if [ $checkOut -le 0 ] ; then reUse=1 ; fi
234 jmc 1.5 if test -d $new_dir/doc -a $reUse = 1 ; then
235 jmc 1.1 cd $tdir/$new_dir
236     if test $tt != $typ ; then
237     ( cd verification ; ../tools/do_tst_2+2 -clean )
238     fi
239     else
240     if test -d prev ; then
241     #-- save previous summary:
242     oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1`
243     if test "x$oldS" != x ; then
244     cat $oldS | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > prev/tr_out.$typ
245     touch -r $oldS prev/tr_out.$typ
246     fi
247     if test $tt != $typ ; then
248     oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1`
249     if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi
250     fi
251     fi
252     echo " remove dir: $new_dir and make new one" >> $tdir/output_$tt
253     test -e $new_dir && rm -rf $new_dir
254     mkdir $new_dir
255     #- before making a copy, check that code has been updated
256     nCount=0; today=`date +%Y%m%d`
257     updDate=0 ; test -f $updFile && updDate=`cat $updFile`
258     while [ $today -gt $updDate ] ; do
259     nCount=`expr $nCount + 1`
260     if [ $nCount -gt 40 ] ; then
261     echo " waiting too long (nCount=$nCount) for updated code"
262     echo " today=$today , updDate=$updDate "
263     ls -l $updFile
264     exit
265     fi
266     sleep 60
267     updDate=0 ; test -f $updFile && updDate=`cat $updFile`
268     done
269     ls -l $updFile | tee -a $tdir/output_$tt
270     echo " waited nCount=$nCount for updated code ($updDate) to copy" | tee -a $tdir/output_$tt
271     #-----------------------------
272     if test -d MITgcm_today -a -d $new_dir ; then
273     echo " copy main code from MITgcm_today to $new_dir" | tee -a $tdir/output_$tt
274     cp -ra MITgcm_today/* $new_dir 2>&1 | tee -a $tdir/output_$tt
275     else
276     if test -d MITgcm_today ; then
277     echo " missing dir $new_dir --> end test $tt" | tee -a $tdir/output_$tt
278     else
279     echo " missing dir MITgcm_today --> end test $tt" | tee -a $tdir/output_$tt
280     fi
281     continue
282     fi
283     echo -n " cd $tdir/$new_dir " | tee -a $tdir/output_$tt
284     cd $tdir/$new_dir
285     retVal=$?
286     ( echo "(retVal= $retVal )" ; pwd ) | tee -a $tdir/output_$tt
287     if test -d verification ; then
288     echo " check: dir verification exist" | tee -a $tdir/output_$tt
289     else
290     echo " missing dir verification --> end test $tt" | tee -a $tdir/output_$tt
291     continue
292     fi
293     if test "x$addExp" != x ; then
294     echo -n " make a local copy of $git_other ..." | tee -a $tdir/output_$tt
295     rsync -a $tdir/$git_other/ $git_other --exclude '.git'
296     echo " done" | tee -a $tdir/output_$tt
297     fi
298     #-- add additional experience from $git_other
299     for exp2add in $addExp ; do
300     echo " add link: $exp2add (from $git_other )" | tee -a $tdir/output_$tt
301     ( cd verification ; ln -s ../$git_other/$exp2add . )
302     if test $exp2add = 'global_oce_cs32' ; then
303     echo " link dir 'other_input/core2_cnyf' in here" | tee -a $tdir/output_$tt
304 jmc 1.8 ( cd ${git_other}/${exp2add}
305 jmc 1.1 ln -s ../../../other_input/core2_cnyf . )
306     fi
307     #if test $exp2add = 'shelfice_remeshing' ; then
308     # echo " link dir 'other_input/remeshing_code' to 'extra_code'" | tee -a $tdir/output_$tt
309 jmc 1.15 # ( cd ${git_other}/${exp2add}
310 jmc 1.1 # ln -s ../../../other_input/remeshing_code extra_code )
311     #fi
312     done
313     fi
314     else
315     cd $tdir/MITgcm_today
316     fi
317     cd verification
318    
319     #-- set the testreport command:
320     comm="./testreport"
321     if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then
322 jmc 1.16 #comm="$comm -adm"
323     comm="$comm -adm -ncad"
324 jmc 1.1 elif test $typ = 'oad' ; then
325     comm="$comm -oad"
326     elif test $typ = 'tlm' ; then
327     comm="$comm -tlm"
328     elif test $typ = 'mth' -o $typ = 'mp2' ; then
329     export GOMP_STACKSIZE=400m
330     export OMP_NUM_THREADS=2
331     comm="$comm -mth"
332     else
333     comm="$comm -md cyrus-makedepend"
334     fi
335     comm="$comm -odir $outDir -a jm_c@mitgcm.org"
336     #-- set the optfile (+ mpi & match-precision)
337     MPI=0
338     case $typ in
339     'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;;
340 jmc 1.12 'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -devel"
341     #comm="$comm -match $MC"
342 jmc 1.1 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
343     'ifc') comm="$comm -devel"
344     OPTFILE='../tools/build_options/linux_amd64_ifort11' ;;
345     'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;
346 jmc 1.14 'mpa'|'mpi'|'mp2') comm="$comm -devel"
347     if test $typ = 'mp2' ; then MPI=3 ; else MPI=8 ; fi
348 jmc 1.13 #comm="$comm -match $MC"
349 jmc 1.1 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
350     *) OPTFILE= ;;
351     esac
352 jmc 1.11 if test $typ = 'g7a' ; then
353     #- pkg/ecco does not compile with g77 + no NetCDF here => no pkg/profiles
354     comm="$comm -skd global_oce_biogeo_bling"
355     fi
356 jmc 1.14 #-- set MPI command: Use default (Dec 2020) which is the same since testreport update on Sep 2013
357 jmc 1.1 #-- set specific Env Vars:
358     if test $typ = 'oad' ; then
359     #- for some reasons, "source ScriptFile | tee -a LogFile"
360     # does run the script but does not keep the env-var settings
361     source $HOME/mitgcm/bin/setenv_OpenAD.sh >> $tdir/output_$tt
362     fi
363     if test $typ = 'ifc' ; then
364     source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64
365     fi
366     if test $typ = 'pgi' ; then
367     #listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20'
368     export PGI=/srv/software/pgi/pgi-10.9
369     export PATH="$PATH:$PGI/linux86-64/10.9/bin"
370     export LM_LICENSE_FILE=$PGI/license.dat
371     fi
372    
373     if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut = 0 ; then
374     #-- cleaning:
375     echo "======================"
376     echo "Cleaning test directories:" | tee -a $tdir/output_$tt
377     cmdCLN="./testreport -clean"
378     echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
379     $cmdCLN >> $tdir/output_$tt 2>&1
380     echo "======================"
381     echo "" | tee -a $tdir/output_$tt
382     fi
383    
384     #-- run the testreport command:
385     echo -n "Running testreport using:" | tee -a $tdir/output_$tt
386     if test "x$OPTFILE" != x ; then
387     comm="$comm -of=$OPTFILE"
388     fi
389 jmc 1.14 echo '' | tee -a $tdir/output_$tt
390     if test $MPI != 0 ; then comm="$comm -MPI $MPI" ; fi
391 jmc 1.1 if test "x$option" != x ; then comm="$comm $option" ; fi
392     #if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi
393     echo " \"eval $comm\"" | tee -a $tdir/output_$tt
394     echo "======================"
395     eval $comm >> $tdir/output_$tt 2>&1
396     sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt
397     echo "" | tee -a $tdir/output_$tt
398    
399     #-- also test restart (test 2+2=4)
400     if test $tt != $typ
401     then
402     echo "testing restart using:" | tee -a $tdir/output_$tt
403     comm="../tools/do_tst_2+2 -o $outDir -a jm_c@mitgcm.org"
404     if test $MPI = 0 ; then
405     echo " \"$comm\"" | tee -a $tdir/output_$tt
406     echo "======================"
407     $comm >> $tdir/output_$tt 2>&1
408     else
409 jmc 1.14 echo " \"$comm -mpi\"" | tee -a $tdir/output_$tt
410 jmc 1.1 echo "======================"
411 jmc 1.14 $comm -mpi >> $tdir/output_$tt 2>&1
412 jmc 1.1 fi
413     echo ; cat tst_2+2_out.txt
414     echo
415     fi
416     export OMP_NUM_THREADS=1
417    
418     if test $sepDir = 0 ; then
419     #-- cleaning:
420     echo "======================"
421     echo "Cleaning test directories:" | tee -a $tdir/output_$tt
422     if test $tt != $typ ; then
423     cmdCLN="../tools/do_tst_2+2 -clean"
424     echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt
425     $cmdCLN >> $tdir/output_$tt 2>&1
426     fi
427     if test $tt != $last_Tst ; then
428     cmdCLN="./testreport -clean"
429     echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
430     $cmdCLN >> $tdir/output_$tt 2>&1
431     fi
432     echo "======================"
433     echo
434     fi
435     cd $tdir
436    
437     done

  ViewVC Help
Powered by ViewVC 1.1.22