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

Contents of /MITgcm_contrib/test_scripts/ref_machine/test_baudelaire

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


Revision 1.5 - (show annotations) (download)
Mon Feb 26 21:15:14 2018 UTC (8 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.4: +8 -4 lines
change the way to access GitHub repos since https request from this old OS
is now refused (since Feb 23): switch to (old) "git://github.com/" way.

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

  ViewVC Help
Powered by ViewVC 1.1.22