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

Contents of /MITgcm/tools/example_scripts/csail/test_baudelaire

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


Revision 1.38 - (show annotations) (download)
Mon Jan 29 21:59:01 2018 UTC (6 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: checkpoint66o, HEAD
Changes since 1.37: +38 -27 lines
download today code into "MITgcm_today" (instead of just "MITgcm")

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

  ViewVC Help
Powered by ViewVC 1.1.22