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

Annotation of /MITgcm_contrib/test_scripts/ref_machine/test_baudelaire

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


Revision 1.7 - (hide annotations) (download)
Thu Oct 11 19:12:07 2018 UTC (6 years, 9 months ago) by jmc
Branch: MAIN
Changes since 1.6: +51 -14 lines
take verification_other additional experiment from GitHub (instead of from
 MITgcm_contrib CVS repos)

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

  ViewVC Help
Powered by ViewVC 1.1.22