/[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.1 - (hide annotations) (download)
Fri Feb 2 14:35:57 2018 UTC (7 years, 5 months ago) by jmc
Branch: MAIN
new version of testing script run daily on villon.mit.edu,
 getting the MITgcm code from GitHub

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

  ViewVC Help
Powered by ViewVC 1.1.22