/[MITgcm]/MITgcm/tools/example_scripts/csail/test_baudelaire
ViewVC logotype

Annotation of /MITgcm/tools/example_scripts/csail/test_baudelaire

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


Revision 1.34 - (hide annotations) (download)
Sat May 13 16:22:16 2017 UTC (6 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.33: +57 -9 lines
before making a copy, check that code has been updated

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

  ViewVC Help
Powered by ViewVC 1.1.22