/[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.28 - (show annotations) (download)
Thu Jul 7 17:36:29 2016 UTC (7 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.27: +16 -2 lines
adjusted for modified shelfice_remeshing experiment

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.27 2016/06/29 16:27:23 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 outDir=`hostname -s`
39 TESTDIR="/scratch/jmc/test_${outDir}"
40 outDir="${outDir}-${tst_grp}"
41 MC=13
42 sepDir=1
43 option=
44 #tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc'
45 #if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi
46 if test $tst_grp = 'a' ; then
47 checkOut=2
48 tst_list='g7a mpa mth mp2+rs mpi oad'
49 else
50 checkOut=3
51 tst_list='adm g77 gfo+rs ifc'
52 if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi
53 fi
54 echo " test: $outDir ; list='$tst_list'"
55
56 #option="-nc" ; checkOut=1
57 #option="-q" ; checkOut=1
58
59 TODAY=`date +%d`
60 tdir=$TESTDIR
61 if test $checkOut != 2 ; then
62 if test -e $tdir/MITgcm/CVS ; then
63 echo $tdir/MITgcm/CVS 'exist'
64 if test $sepDir = 0 -a $checkOut = 1 ; then
65 echo -n "Update the MITgcm code using: $cmdCVS ..."
66 cd $tdir/MITgcm
67 $cmdCVS update -P -d
68 echo " done"
69 fi
70 else
71 echo -n $tdir/MITgcm 'missing ; '
72 checkOut=2
73 fi
74 fi
75 if test $checkOut = 2 ; then
76 if test -e $tdir ; then
77 echo -n "Removing working copy: $tdir/MITgcm ..."
78 test -e $tdir/MITgcm && rm -rf $tdir/MITgcm
79 else
80 echo -n "Creating a working dir: $tdir ..."
81 mkdir $tdir
82 fi
83 echo " done"
84 echo -n "Downloading the MITgcm code using: $cmdCVS ..."
85 cd $tdir
86 $cmdCVS co -P MITgcm > /dev/null
87 echo " done"
88 if test -d other_input ; then
89 list_dirs=`(cd other_input ; ls 2> /dev/null )`
90 echo -n "Updating other_input extra dirs: "
91 for exd in $list_dirs ; do
92 echo -n $exd
93 ( cd other_input/$exd ; $cmdCVS update -P -d )
94 done
95 echo " done"
96 fi
97 else
98 cd $tdir
99 fi
100
101 #------------------------------------------------------------------------
102
103 firstTst=`echo $tst_list | awk '{print $1}'`
104 last_Tst=`echo $tst_list | awk '{print $NF}'`
105 for tt in $tst_list
106 do
107
108 echo "================================================================"
109 typ=`echo $tt | sed 's/+rs//'`
110 #- define list of additional experiences to test:
111 addExp=''
112 if test $typ = 'mp2' -o $typ = 'ifc' ; then
113 addExp="offline_cheapaml atm_gray"
114 fi
115 if test $typ = 'gfo' -o $typ = 'ifc' ; then
116 addExp="$addExp global_oce_biogeo_bling"
117 fi
118 if test $typ = 'mpi' ; then
119 addExp="$addExp global_oce_cs32"
120 fi
121 if test $typ = 'gfo' ; then
122 addExp="$addExp shelfice_remeshing"
123 fi
124 #- check day and time:
125 curDay=`date +%d` ; curHour=`date +%H`
126 if [ $curDay -ne $TODAY ] ; then
127 date ; echo "day is over => skip test $typ"
128 continue
129 fi
130 if [ $curHour -ge 18 ] ; then
131 date ; echo "too late to run test $typ"
132 continue
133 fi
134 if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then
135 echo "using option='$option' prevent multi-tests => skip test $typ"
136 continue
137 fi
138 #- clean-up old output files
139 rm -f $tdir/output_${typ}*
140 touch $tdir/output_$tt
141 if test $sepDir = 1 ; then
142 new_dir="MITgcm_$typ"
143 reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi
144 if test -d $new_dir/CVS -a $reUse = 1 ; then
145 pushd $new_dir
146 if test $tt != $typ ; then
147 ( cd verification ; ../tools/do_tst_2+2 -clean )
148 fi
149 if test $checkOut = 1 ; then
150 echo -n "Update the MITgcm code using: $cmdCVS ..."
151 $cmdCVS update -P -d
152 echo " done"
153 fi
154 else
155 if test -d prev ; then
156 #-- save previous summary:
157 oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1`
158 if test "x$oldS" != x ; then cp -p -f $oldS prev/tr_out.$typ ; fi
159 if test $tt != $typ ; then
160 oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1`
161 if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi
162 fi
163 fi
164 test -e $new_dir && rm -rf $new_dir
165 mkdir $new_dir
166 pushd $new_dir
167 cp -ra ../MITgcm/* .
168 #-- download additional experience from Contrib:
169 for exp2add in $addExp ; do
170 echo " add dir: $exp2add (from Contrib:verification_other)"
171 ( cd verification ; $cmdCVS co -P -d $exp2add \
172 MITgcm_contrib/verification_other/$exp2add > /dev/null )
173 if test $exp2add = 'global_oce_cs32' ; then
174 echo " link dir 'other_input/gael_oce_cs32_input' to 'input_fields'"
175 ( cd verification/${exp2add}
176 ln -s ../../../other_input/gael_oce_cs32_input input_fields )
177 fi
178 if test $exp2add = 'shelfice_remeshing' ; then
179 echo " link dir 'other_input/remeshing_code' to 'extra_code'"
180 ( cd verification/${exp2add}
181 ln -s ../../../other_input/remeshing_code extra_code )
182 fi
183 done
184 fi
185 else
186 pushd MITgcm
187 fi
188 cd verification
189
190 #-- set the testreport command:
191 comm="./testreport"
192 if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then
193 comm="$comm -adm"
194 elif test $typ = 'oad' ; then
195 comm="$comm -oad"
196 elif test $typ = 'tlm' ; then
197 comm="$comm -tlm"
198 elif test $typ = 'mth' -o $typ = 'mp2' ; then
199 export GOMP_STACKSIZE=400m
200 export OMP_NUM_THREADS=2
201 comm="$comm -mth"
202 else
203 comm="$comm -md cyrus-makedepend"
204 fi
205 comm="$comm -odir $outDir -a jmc@mitgcm.org"
206 #-- set the optfile (+ mpi & match-precision)
207 MPI=0
208 case $typ in
209 'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;;
210 'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel"
211 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
212 'ifc') comm="$comm -devel"
213 OPTFILE='../tools/build_options/linux_amd64_ifort11' ;;
214 'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;
215 'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6
216 OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
217 *) OPTFILE= ;;
218 esac
219 #-- set MPI command:
220 if test $MPI != 0 ; then
221 if test $typ = 'mp2' ; then MPI=3 ; fi
222 if test $typ = 'mpa' ; then
223 EXE="mpirun -np TR_NPROC ./mitgcmuv_ad"
224 else
225 EXE="mpirun -np TR_NPROC ./mitgcmuv"
226 fi
227 fi
228
229 #-- set specific Env Vars:
230 if test $typ = 'oad' ; then
231 source ~jmc/mitgcm/bin/setenv_OpenAD.sh
232 fi
233 if test $typ = 'ifc' ; then
234 source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64
235 fi
236 if test $typ = 'pgi' ; then
237 #listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20'
238 export PGI=/srv/software/pgi/pgi-10.9
239 export PATH="$PATH:$PGI/linux86-64/10.9/bin"
240 export LM_LICENSE_FILE=$PGI/license.dat
241 fi
242
243 if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then
244 #-- cleaning:
245 echo "======================"
246 echo "Cleaning test directories:" | tee -a $tdir/output_$tt
247 cmdCLN="./testreport -clean"
248 echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
249 $cmdCLN >> $tdir/output_$tt 2>&1
250 echo "======================"
251 echo "" | tee -a $tdir/output_$tt
252 fi
253
254 #-- run the testreport command:
255 echo -n "Running testreport using:" | tee -a $tdir/output_$tt
256 if test "x$OPTFILE" != x ; then
257 comm="$comm -of=$OPTFILE"
258 fi
259 if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt
260 else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt
261 comm="$comm -MPI $MPI -command \"\$EXE\""
262 fi
263 if test "x$option" != x ; then comm="$comm $option" ; fi
264 #if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi
265 echo " \"eval $comm\"" | tee -a $tdir/output_$tt
266 echo "======================"
267 eval $comm >> $tdir/output_$tt 2>&1
268 sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt
269 echo "" | tee -a $tdir/output_$tt
270
271 #-- also test restart (test 2+2=4)
272 if test $tt != $typ
273 then
274 echo "testing restart using:" | tee -a $tdir/output_$tt
275 comm="../tools/do_tst_2+2 -o $outDir -a jmc@mitgcm.org"
276 if test $MPI = 0 ; then
277 echo " \"$comm\"" | tee -a $tdir/output_$tt
278 echo "======================"
279 $comm >> $tdir/output_$tt 2>&1
280 else
281 echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt
282 echo "======================"
283 $comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1
284 fi
285 echo ; cat tst_2+2_out.txt
286 echo
287 fi
288 export OMP_NUM_THREADS=1
289
290 if test $sepDir = 0 ; then
291 #-- cleaning:
292 echo "======================"
293 echo "Cleaning test directories:" | tee -a $tdir/output_$tt
294 if test $tt != $typ ; then
295 cmdCLN="../tools/do_tst_2+2 -clean"
296 echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt
297 $cmdCLN >> $tdir/output_$tt 2>&1
298 fi
299 if test $tt != $last_Tst ; then
300 cmdCLN="./testreport -clean"
301 echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
302 $cmdCLN >> $tdir/output_$tt 2>&1
303 fi
304 echo "======================"
305 echo
306 fi
307 popd
308
309 done

  ViewVC Help
Powered by ViewVC 1.1.22