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

Annotation of /MITgcm_contrib/test_scripts/ref_machine/test_villon

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


Revision 1.8 - (hide annotations) (download)
Tue Sep 17 22:43:23 2019 UTC (5 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.7: +6 -7 lines
activate more tests

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

  ViewVC Help
Powered by ViewVC 1.1.22