/[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.3 - (hide annotations) (download)
Fri Feb 2 14:33:13 2018 UTC (7 years, 5 months ago) by jmc
Branch: MAIN
Changes since 1.2: +3 -3 lines
minor modif

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

  ViewVC Help
Powered by ViewVC 1.1.22