1 |
edhill |
1.19 |
#! /usr/bin/env bash |
2 |
edhill |
1.1 |
# |
3 |
edhill |
1.43 |
# $Header: /u/gcmpack/MITgcm/verification/testreport,v 1.42 2004/07/08 15:47:19 jmc Exp $ |
4 |
edhill |
1.12 |
# $Name: $ |
5 |
edhill |
1.1 |
# |
6 |
|
|
|
7 |
|
|
usage() |
8 |
|
|
{ |
9 |
|
|
echo |
10 |
|
|
echo "Usage: $0 [OPTIONS]" |
11 |
|
|
echo |
12 |
|
|
echo "where possible OPTIONS are:" |
13 |
|
|
echo " (-help|-h) print usage" |
14 |
edhill |
1.7 |
echo " (-mpi) use MPI input files" |
15 |
edhill |
1.10 |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
16 |
edhill |
1.41 |
echo " (DEF=\"-ieee\")" |
17 |
edhill |
1.6 |
echo " (-optfile=|-of=)STRING list of optfiles to use" |
18 |
edhill |
1.20 |
echo " (-a|-addr) STRING list of email recipients" |
19 |
edhill |
1.6 |
echo " (DEF=\"edhill@mitgcm.org\")" |
20 |
edhill |
1.20 |
echo " (-t|-tdir) STRING list of test dirs to use" |
21 |
edhill |
1.6 |
echo " (DEF=\"\" which builds all)" |
22 |
edhill |
1.20 |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
23 |
|
|
echo " Bourne-compatible \"sh\" shell" |
24 |
|
|
echo " (DEF=\"\" for \"bash\")" |
25 |
edhill |
1.24 |
echo " (-adm|-ad) perform an adjoint run" |
26 |
edhill |
1.20 |
echo " (-command) STRING command to run" |
27 |
edhill |
1.6 |
echo " (DEF=\"make output.txt\")" |
28 |
edhill |
1.20 |
echo " (-m|-make) STRING command to use for \"make\"" |
29 |
edhill |
1.8 |
echo " (DEF=\"make\")" |
30 |
edhill |
1.43 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
31 |
edhill |
1.10 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
32 |
|
|
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
33 |
|
|
echo " (-nogenmake|-ng) skip the genmake stage" |
34 |
|
|
echo " (-noclean|-nc) skip the \"make clean\" stage" |
35 |
|
|
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
36 |
edhill |
1.40 |
echo " (-deldir|-dd) on success, delete the output directory" |
37 |
edhill |
1.6 |
echo |
38 |
|
|
echo "and where STRING follows a whitespace-delimited format" |
39 |
|
|
echo "such as:" |
40 |
|
|
echo " -t 'exp0 exp2 exp3' " |
41 |
|
|
echo " -addr='abc@123.com testing@home.org'" |
42 |
edhill |
1.1 |
echo |
43 |
|
|
exit 1 |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
# build the mpack utility |
47 |
|
|
build_mpack() |
48 |
|
|
{ |
49 |
edhill |
1.34 |
printf "building the mpack utility... " |
50 |
edhill |
1.1 |
if test ! -x "$MPACKDIR/mpack" ; then |
51 |
|
|
if test ! -d $MPACKDIR ; then |
52 |
edhill |
1.20 |
echo |
53 |
edhill |
1.1 |
echo "Error: can't find \"$MPACKDIR\"" |
54 |
|
|
echo " are you sure this program is being run in the correct " |
55 |
|
|
echo " (that is, \"MITGCM_ROOT\verification\") directory?" |
56 |
edhill |
1.20 |
echo |
57 |
|
|
HAVE_MPACK=f |
58 |
edhill |
1.1 |
fi |
59 |
edhill |
1.34 |
printf "building mpack... " |
60 |
edhill |
1.26 |
if test "x$CC" = x ; then |
61 |
|
|
export CC=cc |
62 |
|
|
fi |
63 |
edhill |
1.25 |
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
64 |
edhill |
1.1 |
RETVAL=$? |
65 |
|
|
if test "x$RETVAL" != x0 ; then |
66 |
|
|
echo |
67 |
|
|
echo "Error building the mpack tools at: $MPACK_DIR" |
68 |
edhill |
1.20 |
echo |
69 |
|
|
HAVE_MPACK=f |
70 |
|
|
else |
71 |
edhill |
1.25 |
rm -f tr_build_mpack.out |
72 |
edhill |
1.20 |
HAVE_MPACK=t |
73 |
edhill |
1.1 |
fi |
74 |
edhill |
1.20 |
else |
75 |
|
|
HAVE_MPACK=t |
76 |
edhill |
1.1 |
fi |
77 |
|
|
echo "OK" |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
testoutput_for_prop() |
81 |
|
|
{ |
82 |
edhill |
1.34 |
# testoutput_for_prop dir s1 label subdir extension |
83 |
edhill |
1.1 |
# |
84 |
|
|
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
85 |
|
|
# using search strings s1 and text label |
86 |
|
|
|
87 |
|
|
if [ $debug -gt 0 ]; then |
88 |
|
|
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
89 |
|
|
fi |
90 |
|
|
if [ -r $1/$4/output.txt ]; then |
91 |
edhill |
1.15 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
92 |
edhill |
1.1 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
93 |
|
|
if [ $lncnt -lt 3 ]; then |
94 |
|
|
if [ $verbose -gt 0 ]; then |
95 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
96 |
|
|
fi |
97 |
|
|
return 99 |
98 |
|
|
fi |
99 |
|
|
else |
100 |
|
|
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
101 |
|
|
return 99 |
102 |
|
|
fi |
103 |
|
|
if [ $debug -gt 0 ]; then |
104 |
edhill |
1.34 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
105 |
edhill |
1.1 |
fi |
106 |
edhill |
1.34 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
107 |
edhill |
1.1 |
lncnt=`wc -l tmp2.txt | awk '{print $1}' ` |
108 |
|
|
if [ $lncnt -lt 3 ]; then |
109 |
|
|
if [ $verbose -gt 0 ]; then |
110 |
|
|
echo Not enough lines of output when searching for "$2" 1>&2 |
111 |
|
|
fi |
112 |
|
|
return 99 |
113 |
|
|
fi |
114 |
|
|
if [ $debug -gt 0 ]; then |
115 |
|
|
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
116 |
|
|
fi |
117 |
|
|
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
118 |
|
|
if [ $debug -gt 0 ]; then |
119 |
|
|
echo testoutput_for_prop: compare_lines 1>&2 |
120 |
|
|
fi |
121 |
edhill |
1.22 |
if [ $verbose -gt 1 ]; then |
122 |
|
|
cat tmp3.txt 1>&2 |
123 |
|
|
fi |
124 |
|
|
echo "-1" >> tmp3.txt |
125 |
edhill |
1.23 |
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
126 |
|
|
cat tmp3.txt | sed -e 's|:||g' > tmp4.txt |
127 |
|
|
digits_of_similarity=`./tmp_cmpnum < tmp4.txt` |
128 |
edhill |
1.1 |
if [ $digits_of_similarity -eq 99 ]; then |
129 |
|
|
if [ $verbose -gt 0 ]; then |
130 |
|
|
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
131 |
|
|
fi |
132 |
|
|
digits_of_similarity=99 |
133 |
|
|
else |
134 |
|
|
if [ $verbose -gt 0 ]; then |
135 |
|
|
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
136 |
|
|
fi |
137 |
|
|
fi |
138 |
edhill |
1.23 |
rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt |
139 |
edhill |
1.1 |
|
140 |
|
|
return $digits_of_similarity |
141 |
|
|
} |
142 |
|
|
|
143 |
|
|
dashnum() |
144 |
|
|
{ |
145 |
|
|
# dashnum n1 n2 n3 ... |
146 |
|
|
# |
147 |
|
|
# print numbers using %3i format or "--" if number = 99 |
148 |
|
|
|
149 |
|
|
for num in $@ ; do |
150 |
|
|
if [ $num = 99 ]; then |
151 |
|
|
printf ' --' |
152 |
|
|
else |
153 |
|
|
printf '%3i' $num |
154 |
|
|
fi |
155 |
|
|
done |
156 |
|
|
} |
157 |
|
|
|
158 |
edhill |
1.24 |
testoutput_ad() |
159 |
|
|
{ |
160 |
|
|
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt |
161 |
|
|
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt |
162 |
|
|
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt |
163 |
|
|
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt |
164 |
|
|
join t05.txt t15.txt > t5.txt |
165 |
|
|
join t06.txt t16.txt > t6.txt |
166 |
|
|
echo "-1" >> t5.txt |
167 |
|
|
echo "-1" >> t6.txt |
168 |
|
|
digits_5=`./tmp_cmpnum < t5.txt` |
169 |
|
|
digits_6=`./tmp_cmpnum < t6.txt` |
170 |
|
|
dashnum $digits_5 $digits_6 |
171 |
|
|
rm -f t[01][56].txt t[56].txt |
172 |
|
|
} |
173 |
|
|
|
174 |
edhill |
1.1 |
testoutput() |
175 |
|
|
{ |
176 |
edhill |
1.34 |
# testoutput directory subdir extension |
177 |
edhill |
1.1 |
# |
178 |
|
|
# test output in "directory" |
179 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
180 |
|
|
if [ $debug -gt 0 ]; then |
181 |
|
|
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
182 |
|
|
fi |
183 |
edhill |
1.34 |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$? |
184 |
edhill |
1.24 |
if [ $debug -gt 0 ]; then |
185 |
|
|
echo testoutput: cg2dres=$cg2dres 1>&2 |
186 |
|
|
fi |
187 |
edhill |
1.34 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$? |
188 |
|
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$? |
189 |
|
|
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$? |
190 |
|
|
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$? |
191 |
|
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$? |
192 |
|
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$? |
193 |
|
|
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$? |
194 |
|
|
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$? |
195 |
|
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$? |
196 |
|
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$? |
197 |
|
|
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$? |
198 |
|
|
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$? |
199 |
|
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$? |
200 |
|
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
201 |
|
|
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
202 |
|
|
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? |
203 |
edhill |
1.24 |
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
204 |
|
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
205 |
|
|
else |
206 |
|
|
testoutput_ad $1 $2 "precision_grdchk_result" |
207 |
edhill |
1.1 |
fi |
208 |
|
|
} |
209 |
|
|
|
210 |
|
|
genmakemodel() |
211 |
|
|
{ |
212 |
|
|
# genmakemodel directory |
213 |
edhill |
1.10 |
if test "x$NOGENMAKE" = xt ; then |
214 |
|
|
echo "genmake skipped!" |
215 |
|
|
else |
216 |
edhill |
1.34 |
if test "x$BASH" = x ; then |
217 |
|
|
GENMAKE2="../../../tools/genmake2" |
218 |
|
|
else |
219 |
|
|
GENMAKE2="$BASH ../../../tools/genmake2 -bash $BASH" |
220 |
|
|
fi |
221 |
edhill |
1.10 |
( |
222 |
|
|
cd $1; |
223 |
edhill |
1.24 |
command="$GENMAKE2 -ds -m $MAKE" |
224 |
|
|
if test "x$ADM" = x ; then |
225 |
|
|
command="$command --mods=../code" |
226 |
|
|
else |
227 |
|
|
command="$command --mods=../code_ad" |
228 |
|
|
command="$command -adof=../../../tools/adjoint_options/adjoint_staf" |
229 |
|
|
fi |
230 |
edhill |
1.10 |
if test "x$OPTFILE" != xNONE ; then |
231 |
|
|
command="$command --optfile=$OPTFILE" |
232 |
|
|
fi |
233 |
|
|
if test "x$IEEE" != x ; then |
234 |
|
|
command="$command -ieee" |
235 |
|
|
fi |
236 |
|
|
printf 'genmake ... ' 1>&2 |
237 |
|
|
$command > make.log 2>&1 |
238 |
|
|
RETVAL=$? |
239 |
edhill |
1.21 |
cp Makefile $CDIR |
240 |
edhill |
1.10 |
if test "x$RETVAL" != x0 ; then |
241 |
|
|
tail make.log |
242 |
|
|
echo "genmakemodel: genmake failed" 1>&2 |
243 |
edhill |
1.21 |
cp genmake_* make.log $CDIR |
244 |
edhill |
1.10 |
return 1 |
245 |
|
|
else |
246 |
edhill |
1.20 |
echo "successful" 1>&2 |
247 |
edhill |
1.1 |
fi |
248 |
edhill |
1.10 |
) |
249 |
|
|
fi |
250 |
edhill |
1.1 |
} |
251 |
|
|
|
252 |
|
|
makeclean() |
253 |
|
|
{ |
254 |
|
|
# makeclean directory |
255 |
edhill |
1.10 |
if test "x$NOCLEAN" = xt ; then |
256 |
|
|
echo "make CLEAN skipped!" |
257 |
|
|
else |
258 |
|
|
( |
259 |
|
|
cd $1; |
260 |
|
|
if test -e output.txt ; then |
261 |
|
|
rm -f output.txt |
262 |
|
|
fi |
263 |
|
|
printf 'make CLEAN ... ' 2>&1 |
264 |
|
|
if test -r Makefile ; then |
265 |
|
|
$MAKE CLEAN >> make.log 2>&1 |
266 |
|
|
RETVAL=$? |
267 |
|
|
if test "x$RETVAL" != x0 ; then |
268 |
|
|
tail make.log |
269 |
|
|
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
270 |
|
|
cp make.log $CDIR"/make.log" |
271 |
|
|
return 1 |
272 |
|
|
fi |
273 |
|
|
fi |
274 |
edhill |
1.20 |
echo successful 1>&2 |
275 |
edhill |
1.10 |
exit 0 |
276 |
|
|
) |
277 |
|
|
fi |
278 |
|
|
} |
279 |
|
|
|
280 |
|
|
makedependmodel() |
281 |
|
|
{ |
282 |
|
|
# makedependmodel directory |
283 |
|
|
if test "x$NODEPEND" = xt ; then |
284 |
|
|
echo "make depend skipped!" |
285 |
|
|
else |
286 |
|
|
( |
287 |
|
|
cd $1; |
288 |
|
|
printf 'make depend ... ' 1>&2 |
289 |
|
|
$MAKE depend >> make.log 2>&1 |
290 |
edhill |
1.1 |
RETVAL=$? |
291 |
|
|
if test "x$RETVAL" != x0 ; then |
292 |
|
|
tail make.log |
293 |
edhill |
1.10 |
echo "makedependmodel: make depend failed" 1>&2 |
294 |
edhill |
1.1 |
cp make.log $CDIR"/make.log" |
295 |
|
|
return 1 |
296 |
edhill |
1.10 |
else |
297 |
edhill |
1.20 |
echo successful 1>&2 |
298 |
edhill |
1.1 |
fi |
299 |
edhill |
1.10 |
) |
300 |
|
|
fi |
301 |
edhill |
1.1 |
} |
302 |
|
|
|
303 |
|
|
makemodel() |
304 |
|
|
{ |
305 |
|
|
# makemodel directory |
306 |
|
|
( |
307 |
|
|
cd $1; |
308 |
|
|
if test -r Makefile ; then |
309 |
|
|
printf 'make ... ' 1>&2 |
310 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
311 |
edhill |
1.43 |
if test "x$JOBS" = x ; then |
312 |
|
|
$MAKE >> make.log 2>&1 |
313 |
|
|
else |
314 |
|
|
$MAKE -j $JOBS >> make.log 2>&1 |
315 |
|
|
fi |
316 |
edhill |
1.24 |
else |
317 |
|
|
$MAKE adall >> make.log 2>&1 |
318 |
|
|
fi |
319 |
edhill |
1.1 |
RETVAL=$? |
320 |
|
|
if test "x$RETVAL" != x0 ; then |
321 |
|
|
tail make.log |
322 |
|
|
echo failed 1>&2 |
323 |
|
|
cp make.log $CDIR"/make.log" |
324 |
|
|
return 1 |
325 |
|
|
else |
326 |
edhill |
1.20 |
echo successful 1>&2 |
327 |
edhill |
1.1 |
fi |
328 |
|
|
fi |
329 |
|
|
) |
330 |
|
|
} |
331 |
|
|
|
332 |
edhill |
1.27 |
symlink_mpifiles() |
333 |
|
|
{ |
334 |
|
|
# Put special links so that MPI specific files are used |
335 |
|
|
# This MUST be invoked between makeclean and makelinks because |
336 |
|
|
# the Makefile will link to non-mpi files by default |
337 |
|
|
|
338 |
|
|
dir=$1 |
339 |
|
|
code_dir=$2 |
340 |
|
|
BUILD_DIR=$dir/$3 |
341 |
|
|
CODE_DIR=$dir/$code_dir |
342 |
|
|
|
343 |
|
|
# These are files that should replace their counter-part when using -mpi |
344 |
|
|
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
345 |
|
|
|
346 |
|
|
# Is this an MPI run? |
347 |
|
|
if test "x$MPI" = xt ; then |
348 |
|
|
# YES: We symbolically link these files to the build |
349 |
|
|
# dir so long as there is no real file in place |
350 |
|
|
for ii in $MPI_FILES ; do |
351 |
|
|
i=`echo $ii | sed 's:^\./::'` |
352 |
|
|
name=`echo $i | sed 's:_mpi::' ` |
353 |
|
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
354 |
|
|
RETVAL=$? |
355 |
|
|
if test "x$RETVAL" != x0 ; then |
356 |
|
|
if ! test -f $BUILD_DIR/$i ; then |
357 |
|
|
#echo Linking $name to $i |
358 |
|
|
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
359 |
|
|
fi |
360 |
|
|
fi |
361 |
|
|
done |
362 |
|
|
else |
363 |
|
|
# NO: We undo any _mpi symbolically linked files |
364 |
|
|
for ii in $MPI_FILES ; do |
365 |
|
|
i=`echo $ii | sed 's:^\./::'` |
366 |
|
|
name=`echo $i | sed 's:_mpi::' ` |
367 |
|
|
if test -L $BUILD_DIR/$name ; then |
368 |
|
|
linktarg=`(cd $BUILD_DIR; readlink $name)` |
369 |
|
|
if test $linktarg = "../$code_dir/$name"_mpi ; then |
370 |
|
|
#echo Un-linking $name from $linktarg |
371 |
|
|
rm -f $BUILD_DIR/$name |
372 |
|
|
fi |
373 |
|
|
fi |
374 |
|
|
done |
375 |
|
|
fi |
376 |
|
|
|
377 |
|
|
} |
378 |
|
|
|
379 |
edhill |
1.1 |
linkdata() |
380 |
|
|
{ |
381 |
|
|
# linkdata flag |
382 |
|
|
# |
383 |
|
|
# symbolically link data files to run directory |
384 |
edhill |
1.12 |
if test "x$1" = x1 ; then |
385 |
|
|
( |
386 |
|
|
cd $2 |
387 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
388 |
|
|
files=`( cd ../input ; ls -1 | grep -v CVS )` |
389 |
|
|
for i in $files ; do |
390 |
|
|
if test ! -d "../input/"$i ; then |
391 |
|
|
ln -sf "../input/"$i $i |
392 |
|
|
fi |
393 |
|
|
done |
394 |
|
|
else |
395 |
|
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
396 |
|
|
for i in $files ; do |
397 |
|
|
if test ! -d "../input/"$i ; then |
398 |
|
|
ln -sf "../input/"$i $i |
399 |
|
|
fi |
400 |
|
|
done |
401 |
|
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
402 |
|
|
for i in $files ; do |
403 |
|
|
if test ! -d "../input_ad/"$i ; then |
404 |
|
|
ln -sf "../input_ad/"$i $i |
405 |
|
|
fi |
406 |
|
|
done |
407 |
|
|
fi |
408 |
edhill |
1.12 |
) |
409 |
edhill |
1.1 |
fi |
410 |
|
|
} |
411 |
|
|
|
412 |
|
|
runmodel() |
413 |
|
|
{ |
414 |
edhill |
1.6 |
# runmodel directory |
415 |
edhill |
1.1 |
# |
416 |
edhill |
1.24 |
# runs "$COMMAND in "directory" |
417 |
edhill |
1.6 |
# (where "$COMMAND" is relative to "directory") |
418 |
edhill |
1.1 |
( |
419 |
|
|
cd $1 |
420 |
edhill |
1.20 |
printf 'runmodel ... ' 1>&2 |
421 |
edhill |
1.6 |
# make output.txt |
422 |
edhill |
1.38 |
echo |
423 |
edhill |
1.39 |
# echo "COMMAND='$COMMAND'" |
424 |
|
|
# echo "pwd='"`pwd`"'" |
425 |
edhill |
1.38 |
( eval $COMMAND ) >> run.log 2>&1 |
426 |
edhill |
1.6 |
RETVAL=$? |
427 |
|
|
if test "x$RETVAL" = x0 ; then |
428 |
edhill |
1.20 |
echo successful 1>&2 |
429 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
430 |
|
|
cp output.txt $CDIR"/output.txt" |
431 |
|
|
else |
432 |
|
|
cp output.txt_adm $CDIR"/output.txt_adm" |
433 |
|
|
fi |
434 |
edhill |
1.6 |
return 0 |
435 |
|
|
else |
436 |
edhill |
1.20 |
tail run.log |
437 |
|
|
echo failed 1>&2 |
438 |
|
|
cp run.log $CDIR"/run.log" |
439 |
edhill |
1.6 |
return 1 |
440 |
edhill |
1.1 |
fi |
441 |
|
|
) |
442 |
|
|
} |
443 |
|
|
|
444 |
|
|
createcodelet() |
445 |
|
|
{ |
446 |
|
|
# create codelet for comparing model output |
447 |
|
|
|
448 |
edhill |
1.34 |
printf "creating the comparison code... " |
449 |
edhill |
1.22 |
cat > tmp_cmpnum.c <<EOF |
450 |
|
|
#include <stdio.h> |
451 |
|
|
#include <math.h> |
452 |
|
|
int main( int argc, char** argv ) { |
453 |
adcroft |
1.33 |
int linnum,best,lncnt; |
454 |
edhill |
1.22 |
double a,b,diff; |
455 |
|
|
best = -16; |
456 |
adcroft |
1.33 |
lncnt = 0; |
457 |
|
|
while( 1 & (lncnt+=1) < 999 ) { |
458 |
edhill |
1.22 |
scanf("%d", &linnum); |
459 |
|
|
if (linnum == -1) break; |
460 |
|
|
scanf("%lf", &a); scanf("%lf", &b); |
461 |
|
|
diff = 0.5*(fabs(a)+fabs(b)); |
462 |
|
|
if (diff > 1.e-12) { |
463 |
|
|
diff=fabs(a-b)/diff; |
464 |
|
|
if (diff > 0.0) { |
465 |
|
|
linnum = (int)log10(diff); |
466 |
|
|
best = (best > linnum) ? best : linnum; |
467 |
|
|
} |
468 |
|
|
else { |
469 |
|
|
if (best == -16 && diff != 0) best = -22; |
470 |
|
|
} |
471 |
|
|
} |
472 |
|
|
} |
473 |
adcroft |
1.33 |
if (lncnt == 999) best=-29; |
474 |
edhill |
1.22 |
printf("%d\n", -best); |
475 |
|
|
return 0; |
476 |
|
|
} |
477 |
|
|
EOF |
478 |
|
|
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
479 |
edhill |
1.1 |
|
480 |
edhill |
1.22 |
if [ -x ./tmp_cmpnum ]; then |
481 |
edhill |
1.1 |
echo "OK" |
482 |
|
|
return 0 |
483 |
|
|
else |
484 |
|
|
echo |
485 |
edhill |
1.21 |
echo "ERROR: failed to compile comparison code" |
486 |
edhill |
1.1 |
exit 1 |
487 |
|
|
fi |
488 |
|
|
} |
489 |
|
|
|
490 |
|
|
formatresults() |
491 |
|
|
{ |
492 |
|
|
# formatresults expt genmake depend make run results* |
493 |
|
|
|
494 |
|
|
nm=$1 |
495 |
|
|
printf '%s %s %s %s' $2 $3 $4 $5 |
496 |
|
|
shift; shift; shift; shift; shift; |
497 |
|
|
printf '%3s' $@ |
498 |
|
|
|
499 |
|
|
if [ $1 = '--' ]; then |
500 |
|
|
printf ' N/O ' |
501 |
|
|
else |
502 |
|
|
if [ $1 -gt 12 ]; then |
503 |
|
|
printf ' pass' |
504 |
|
|
else |
505 |
|
|
printf ' FAIL' |
506 |
|
|
fi |
507 |
|
|
fi |
508 |
|
|
printf ' %s' $nm |
509 |
|
|
printf '\n' |
510 |
|
|
|
511 |
|
|
} |
512 |
|
|
|
513 |
|
|
show_help() |
514 |
|
|
{ |
515 |
|
|
cat - << EOF |
516 |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
517 |
edhill |
1.10 |
|
518 |
|
|
-help|-h Show this help message |
519 |
edhill |
1.1 |
-quiet Reduce the amount of output |
520 |
|
|
-verbose Produce copious amounts of output |
521 |
|
|
-debug Produce even more output which will mean nothing to most |
522 |
|
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
523 |
|
|
-clean Do "make CLEAN" after compiling and testing. |
524 |
|
|
-cleanup Aggresively removes all model output, executables and object files |
525 |
|
|
and then exits. Use with care. |
526 |
|
|
|
527 |
|
|
Normal usage: |
528 |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
529 |
|
|
EOF |
530 |
|
|
} |
531 |
|
|
|
532 |
|
|
scandirs() |
533 |
|
|
{ |
534 |
|
|
if [ $# -eq 0 ]; then |
535 |
|
|
for arg in * ; do |
536 |
|
|
test -d $arg/input && echo $arg |
537 |
|
|
done |
538 |
|
|
else |
539 |
|
|
echo $* |
540 |
|
|
fi |
541 |
|
|
} |
542 |
|
|
|
543 |
|
|
|
544 |
|
|
############################################################################### |
545 |
|
|
|
546 |
|
|
|
547 |
|
|
# Default properties |
548 |
|
|
debug=0 |
549 |
|
|
verbose=1 |
550 |
|
|
clean=0 |
551 |
|
|
expts='' |
552 |
edhill |
1.6 |
# ieee=1 |
553 |
edhill |
1.10 |
|
554 |
edhill |
1.40 |
IEEE=true |
555 |
edhill |
1.10 |
if test "x$MITGCM_IEEE" != x ; then |
556 |
|
|
IEEE=$MITGCM_IEEE |
557 |
|
|
fi |
558 |
|
|
|
559 |
|
|
|
560 |
|
|
CLEANUP=f |
561 |
|
|
QUICK=f |
562 |
|
|
NOGENMAKE=f |
563 |
|
|
NOCLEAN=f |
564 |
|
|
NODEPEND=f |
565 |
edhill |
1.1 |
|
566 |
edhill |
1.4 |
BASH= |
567 |
edhill |
1.10 |
OPTFILE=NONE |
568 |
|
|
ADDRESSES= |
569 |
edhill |
1.1 |
TESTDIRS= |
570 |
|
|
MPACKDIR="../tools/mpack-1.6" |
571 |
edhill |
1.20 |
HAVE_MPACK= |
572 |
edhill |
1.1 |
MPACK="$MPACKDIR/mpack" |
573 |
edhill |
1.24 |
COMMAND= |
574 |
edhill |
1.8 |
MAKE=make |
575 |
edhill |
1.43 |
JOBS= |
576 |
edhill |
1.7 |
MPI=f |
577 |
edhill |
1.40 |
DELDIR= |
578 |
edhill |
1.1 |
|
579 |
edhill |
1.24 |
ADM= |
580 |
|
|
|
581 |
edhill |
1.34 |
printf "parsing options... " |
582 |
edhill |
1.1 |
|
583 |
|
|
ac_prev= |
584 |
|
|
for ac_option ; do |
585 |
|
|
|
586 |
|
|
# If the previous option needs an argument, assign it. |
587 |
|
|
if test -n "$ac_prev"; then |
588 |
|
|
eval "$ac_prev=\$ac_option" |
589 |
|
|
ac_prev= |
590 |
|
|
continue |
591 |
|
|
fi |
592 |
|
|
|
593 |
|
|
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
594 |
|
|
|
595 |
|
|
case $ac_option in |
596 |
|
|
|
597 |
|
|
-help | --help | -h | --h) |
598 |
|
|
usage ;; |
599 |
|
|
|
600 |
edhill |
1.2 |
-optfile | --optfile | -of | --of) |
601 |
edhill |
1.10 |
ac_prev=OPTFILE ;; |
602 |
edhill |
1.2 |
-optfile=* | --optfile=* | -of=* | --of=*) |
603 |
edhill |
1.10 |
OPTFILE=$ac_optarg ;; |
604 |
edhill |
1.1 |
|
605 |
|
|
-addr | --addr | -a | --a) |
606 |
|
|
ac_prev=ADDRESSES ;; |
607 |
|
|
-addr=* | --addr=*) |
608 |
|
|
ADDRESSES=$ac_optarg ;; |
609 |
|
|
|
610 |
|
|
-tdir | --tdir | -t | --t) |
611 |
|
|
ac_prev=TESTDIRS ;; |
612 |
|
|
-tdir=* | --tdir=*) |
613 |
|
|
TESTDIRS=$ac_optarg ;; |
614 |
edhill |
1.4 |
|
615 |
|
|
-bash | --bash | -b | --b) |
616 |
|
|
ac_prev=BASH ;; |
617 |
|
|
-bash=* | --bash=*) |
618 |
|
|
BASH=$ac_optarg ;; |
619 |
edhill |
1.5 |
|
620 |
edhill |
1.6 |
-command | --command | -c | --c) |
621 |
|
|
ac_prev=COMMAND ;; |
622 |
|
|
-command=* | --command=*) |
623 |
|
|
COMMAND=$ac_optarg ;; |
624 |
edhill |
1.8 |
|
625 |
|
|
-make | --make | -m | --m) |
626 |
|
|
ac_prev=MAKE ;; |
627 |
|
|
-make=* | --make=*) |
628 |
|
|
MAKE=$ac_optarg ;; |
629 |
edhill |
1.1 |
|
630 |
edhill |
1.43 |
-j) ac_prev=JOBS ;; |
631 |
|
|
-j=*) JOBS=$ac_optarg ;; |
632 |
|
|
|
633 |
edhill |
1.10 |
-clean | --clean) |
634 |
|
|
CLEANUP=t ;; |
635 |
|
|
|
636 |
|
|
-quick | --quick | -q | --q) |
637 |
|
|
QUICK=t ;; |
638 |
|
|
-nogenmake | --nogenmake | -ng | --ng) |
639 |
|
|
NOGENMAKE=t ;; |
640 |
|
|
-noclean | --noclean | -nc | --nc) |
641 |
|
|
NOCLEAN=t ;; |
642 |
|
|
-nodepend | --nodepend | -nd | --nd) |
643 |
|
|
NODEPEND=t ;; |
644 |
|
|
|
645 |
edhill |
1.18 |
-mpi) MPI=t ;; |
646 |
edhill |
1.10 |
|
647 |
edhill |
1.24 |
-adm | -ad) ADM=t ;; |
648 |
|
|
|
649 |
edhill |
1.10 |
-ieee) IEEE=true ;; |
650 |
|
|
-noieee) IEEE= ;; |
651 |
|
|
|
652 |
edhill |
1.1 |
-verbose) verbose=2 ;; |
653 |
|
|
-debug) debug=1 ;; |
654 |
|
|
-quiet) verbose=0 ;; |
655 |
|
|
|
656 |
edhill |
1.40 |
-deldir | -dd) DELDIR=t ;; |
657 |
|
|
|
658 |
edhill |
1.1 |
-*) |
659 |
|
|
echo "Error: unrecognized option: "$ac_option |
660 |
|
|
usage |
661 |
|
|
;; |
662 |
|
|
|
663 |
|
|
*) |
664 |
|
|
echo "Error: unrecognized argument: "$ac_option |
665 |
|
|
usage |
666 |
|
|
;; |
667 |
|
|
|
668 |
|
|
esac |
669 |
|
|
|
670 |
|
|
done |
671 |
|
|
|
672 |
edhill |
1.10 |
if test "x$QUICK" = xt ; then |
673 |
|
|
NOGENMAKE=t |
674 |
|
|
NOCLEAN=t |
675 |
|
|
NODEPEND=t |
676 |
|
|
fi |
677 |
|
|
|
678 |
edhill |
1.1 |
if test "x$TESTDIRS" = x ; then |
679 |
|
|
TESTDIRS=`scandirs` |
680 |
|
|
fi |
681 |
|
|
|
682 |
edhill |
1.10 |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
683 |
|
|
OPTFILE=$MITGCM_OF |
684 |
|
|
fi |
685 |
|
|
|
686 |
edhill |
1.24 |
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
687 |
|
|
COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1" |
688 |
|
|
fi |
689 |
|
|
|
690 |
|
|
if test "x$COMMAND" = x ; then |
691 |
|
|
COMMAND="make output.txt" |
692 |
|
|
fi |
693 |
|
|
|
694 |
edhill |
1.1 |
echo "OK" |
695 |
|
|
|
696 |
|
|
# create the FORTRAN comparison code |
697 |
|
|
createcodelet |
698 |
|
|
|
699 |
|
|
# build the mpack utility |
700 |
edhill |
1.31 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
701 |
edhill |
1.32 |
echo "skipping mpack build" |
702 |
|
|
else |
703 |
edhill |
1.31 |
build_mpack |
704 |
|
|
fi |
705 |
edhill |
1.1 |
|
706 |
|
|
# Create a uniquely named directory to store results |
707 |
|
|
MACH=`hostname` |
708 |
edhill |
1.2 |
UNAMEA=`uname -a` |
709 |
edhill |
1.1 |
DATE=`date +%Y%m%d` |
710 |
edhill |
1.25 |
BASE="tr_"$MACH"_"$DATE"_" |
711 |
edhill |
1.1 |
DNUM=0 |
712 |
|
|
DRESULTS="$BASE$DNUM" |
713 |
|
|
while test -e $DRESULTS ; do |
714 |
|
|
DNUM=$(( $DNUM + 1 )) |
715 |
|
|
DRESULTS="$BASE$DNUM" |
716 |
|
|
done |
717 |
|
|
mkdir $DRESULTS |
718 |
|
|
RETVAL=$? |
719 |
|
|
if test "x$RETVAL" != x0 ; then |
720 |
edhill |
1.20 |
echo "ERROR: Can't create results directory \"./$DRESULTS\"" |
721 |
edhill |
1.1 |
exit 1 |
722 |
|
|
fi |
723 |
|
|
SUMMARY="$DRESULTS/summary.txt" |
724 |
edhill |
1.34 |
printf "Start time: " >> $SUMMARY |
725 |
edhill |
1.16 |
start_date=`date` |
726 |
edhill |
1.17 |
echo $start_date > $SUMMARY |
727 |
edhill |
1.1 |
|
728 |
edhill |
1.11 |
of_path= |
729 |
edhill |
1.10 |
if test "x$OPTFILE" != xNONE ; then |
730 |
|
|
if test -r $OPTFILE ; then |
731 |
edhill |
1.11 |
# get the path |
732 |
|
|
path=${OPTFILE%/*} |
733 |
|
|
if test "x$path" = x ; then |
734 |
|
|
of_path=`pwd` |
735 |
|
|
else |
736 |
|
|
of_path=`( cd $path > /dev/null 2>&1 ; pwd )` |
737 |
|
|
fi |
738 |
|
|
file=${OPTFILE##*/} |
739 |
|
|
OPTFILE=$of_path/$file |
740 |
edhill |
1.21 |
cp $OPTFILE $DRESULTS |
741 |
|
|
echo >> $SUMMARY |
742 |
|
|
echo " OPTFILE=$OPTFILE" >> $SUMMARY |
743 |
edhill |
1.11 |
else |
744 |
edhill |
1.21 |
echo | tee $SUMMARY |
745 |
|
|
echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY |
746 |
|
|
exit 1 |
747 |
edhill |
1.10 |
fi |
748 |
edhill |
1.21 |
else |
749 |
|
|
echo >> $SUMMARY |
750 |
|
|
echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY |
751 |
|
|
echo " so the genmake default will be used." >> $SUMMARY |
752 |
edhill |
1.10 |
fi |
753 |
|
|
echo |
754 |
|
|
echo >> $SUMMARY |
755 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
756 |
|
|
cat << EOF | tee -a $SUMMARY |
757 |
edhill |
1.21 |
T S U V |
758 |
|
|
G D M c m s m s m s m s |
759 |
|
|
E p a R g m m e . m m e . m m e . m m e . |
760 |
|
|
N n k u 2 i a a d i a a d i a a d i a a d |
761 |
|
|
2 d e n d n x n . n x n . n x n . n x n . |
762 |
|
|
|
763 |
|
|
EOF |
764 |
edhill |
1.24 |
else |
765 |
|
|
echo "ADJOINT=true" >> $SUMMARY |
766 |
|
|
echo >> $SUMMARY |
767 |
|
|
cat << EOF | tee -a $SUMMARY |
768 |
|
|
G D M C G |
769 |
|
|
E p a R o r |
770 |
|
|
N n k u s a |
771 |
|
|
2 d e n t d |
772 |
|
|
|
773 |
|
|
EOF |
774 |
|
|
fi |
775 |
edhill |
1.1 |
|
776 |
edhill |
1.10 |
# ...and each test directory... |
777 |
|
|
for dir in $TESTDIRS ; do |
778 |
|
|
|
779 |
|
|
# Cleanup only! |
780 |
|
|
if test "x$CLEANUP" = xt ; then |
781 |
|
|
if test -r $dir/build/Makefile ; then |
782 |
|
|
( cd $dir/build ; make CLEAN ) |
783 |
|
|
fi |
784 |
|
|
if test -r $dir/input/Makefile ; then |
785 |
|
|
( cd $dir/input ; make CLEAN ) |
786 |
|
|
fi |
787 |
|
|
continue |
788 |
edhill |
1.1 |
fi |
789 |
edhill |
1.3 |
|
790 |
edhill |
1.10 |
# Verify that the testdir exists and contains previous |
791 |
|
|
# results in the correct location--or skip this directory! |
792 |
edhill |
1.24 |
fout= |
793 |
|
|
if test "x$ADM" = x ; then |
794 |
|
|
fout=$dir"/results/output.txt" |
795 |
|
|
else |
796 |
|
|
fout=$dir"/results_ad/output.txt_adm" |
797 |
|
|
fi |
798 |
|
|
if test ! -r $fout ; then |
799 |
|
|
echo "can't read \"$fout\" -- skipping $dir" |
800 |
edhill |
1.10 |
continue |
801 |
|
|
fi |
802 |
edhill |
1.7 |
|
803 |
edhill |
1.12 |
builddir="input" |
804 |
|
|
rundir="input" |
805 |
|
|
use_seperate_build=0 |
806 |
|
|
if test -d $dir/build -a -r $dir/build ; then |
807 |
|
|
builddir="build" |
808 |
|
|
rundir="build" |
809 |
|
|
use_seperate_build=1 |
810 |
|
|
linkdata $use_seperate_build $dir/$rundir |
811 |
edhill |
1.10 |
fi |
812 |
|
|
|
813 |
edhill |
1.34 |
# Check whether there are "extra runs" for this testdir |
814 |
|
|
extra_runs= |
815 |
|
|
if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then |
816 |
|
|
ex_run_dirs=`( cd $dir ; echo input.* )` |
817 |
|
|
echo "ex_run_dirs='$ex_run_dirs'" |
818 |
|
|
for exd in $ex_run_dirs ; do |
819 |
|
|
name=`echo $exd | sed -e 's/input.//g'` |
820 |
|
|
outf="$dir/results/output.txt.$name" |
821 |
|
|
if test -f $outf -a -r $outf ; then |
822 |
|
|
extra_runs="$extra_runs $name" |
823 |
|
|
fi |
824 |
|
|
done |
825 |
|
|
fi |
826 |
|
|
|
827 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
828 |
edhill |
1.27 |
code_dir=code |
829 |
edhill |
1.24 |
CODE_DIR=$dir/code |
830 |
|
|
else |
831 |
edhill |
1.27 |
code_dir=code_ad |
832 |
edhill |
1.24 |
CODE_DIR=$dir/code_ad |
833 |
|
|
fi |
834 |
edhill |
1.10 |
BUILD_DIR=$dir/$builddir |
835 |
edhill |
1.28 |
|
836 |
edhill |
1.30 |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
837 |
edhill |
1.28 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
838 |
|
|
continue |
839 |
|
|
fi |
840 |
|
|
|
841 |
|
|
echo "-------------------------------------------------------------------------------" |
842 |
|
|
echo |
843 |
|
|
echo "Experiment: $dir" |
844 |
|
|
echo |
845 |
|
|
unset genmake makedepend make run |
846 |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
847 |
edhill |
1.10 |
|
848 |
|
|
# Create an output dir for each OPTFILE/tdir combination |
849 |
edhill |
1.20 |
rel_CDIR=$DRESULTS"/"$dir |
850 |
|
|
mkdir $rel_CDIR |
851 |
|
|
CDIR=`pwd`"/$rel_CDIR" |
852 |
edhill |
1.10 |
|
853 |
|
|
if test "x$CLEANUP" = xt ; then |
854 |
|
|
makeclean $dir/$builddir |
855 |
|
|
else |
856 |
edhill |
1.1 |
genmakemodel $dir/$builddir && genmake=Y \ |
857 |
|
|
&& makeclean $dir/$builddir \ |
858 |
edhill |
1.27 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
859 |
edhill |
1.1 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
860 |
|
|
&& makemodel $dir/$builddir && make=Y \ |
861 |
edhill |
1.12 |
&& linkdata $use_seperate_build $dir/$rundir \ |
862 |
|
|
&& runmodel $dir/$rundir && run=Y \ |
863 |
edhill |
1.1 |
&& results=`testoutput $dir $rundir` |
864 |
edhill |
1.10 |
fi |
865 |
|
|
|
866 |
|
|
echo |
867 |
edhill |
1.24 |
if test "x$ADM" = x ; then |
868 |
|
|
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
869 |
edhill |
1.34 |
echo |
870 |
|
|
echo "$fres" >> $SUMMARY |
871 |
|
|
echo "fresults='$fres'" > $CDIR"/summary.txt" |
872 |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
873 |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
874 |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
875 |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
876 |
|
|
|
877 |
edhill |
1.35 |
OLD_COMMAND=$COMMAND |
878 |
|
|
COMMAND="./mitgcmuv > output.txt" |
879 |
edhill |
1.34 |
for ex in $extra_runs ; do |
880 |
jmc |
1.42 |
test -e "$dir/tr_run.$ex" && rm -rf "$dir/tr_run.$ex" |
881 |
|
|
mkdir "$dir/tr_run.$ex" |
882 |
edhill |
1.36 |
links=`( cd "$dir/input" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
883 |
edhill |
1.34 |
( |
884 |
jmc |
1.42 |
cd "$dir/tr_run.$ex" |
885 |
edhill |
1.34 |
for i in $links; do |
886 |
|
|
ln -s ../input/$i $i |
887 |
|
|
done |
888 |
|
|
) |
889 |
edhill |
1.36 |
links=`( cd "$dir/input.$ex" > /dev/null 2>&1 ; ls -1 | grep -v CVS )` |
890 |
edhill |
1.34 |
( |
891 |
jmc |
1.42 |
cd "$dir/tr_run.$ex" |
892 |
edhill |
1.34 |
for i in $links; do |
893 |
|
|
test -e $i && rm -f $i |
894 |
|
|
ln -s ../input.$ex/$i $i |
895 |
|
|
done |
896 |
|
|
ln -s ../$builddir/mitgcmuv mitgcmuv |
897 |
|
|
) |
898 |
jmc |
1.42 |
runmodel $dir/tr_run.$ex && run=Y \ |
899 |
|
|
&& results=`testoutput $dir tr_run.$ex "."$ex` |
900 |
edhill |
1.34 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
901 |
|
|
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
902 |
|
|
fres="$fres.$ex" |
903 |
|
|
echo |
904 |
|
|
echo "$fres" >> $SUMMARY |
905 |
|
|
echo "fresults='$fres'" > $CDIR"/summary.txt" |
906 |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
907 |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
908 |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
909 |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
910 |
|
|
done |
911 |
edhill |
1.35 |
COMMAND=$OLD_COMMAND |
912 |
edhill |
1.24 |
else |
913 |
|
|
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
914 |
|
|
fres=$fres"$results $dir" |
915 |
edhill |
1.34 |
echo |
916 |
|
|
echo "$fres" >> $SUMMARY |
917 |
|
|
echo "fresults='$fres'" > $CDIR"/summary.txt" |
918 |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
919 |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
920 |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
921 |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
922 |
edhill |
1.24 |
fi |
923 |
edhill |
1.10 |
|
924 |
|
|
echo "-------------------------------------------------------------------------------" |
925 |
|
|
|
926 |
edhill |
1.1 |
done |
927 |
|
|
|
928 |
edhill |
1.34 |
printf "Start time: " >> $SUMMARY |
929 |
edhill |
1.16 |
echo $start_date >> $SUMMARY |
930 |
edhill |
1.34 |
printf "End time: " >> $SUMMARY |
931 |
edhill |
1.13 |
date >> $SUMMARY |
932 |
edhill |
1.20 |
|
933 |
|
|
# If addresses were supplied and mpack built successfully, then try |
934 |
|
|
# to send email using mpack. |
935 |
|
|
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
936 |
|
|
echo "No results email was sent." |
937 |
|
|
else |
938 |
|
|
if test "x$HAVE_MPACK" = xt ; then |
939 |
|
|
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
940 |
|
|
&& gzip $DRESULTS".tar" \ |
941 |
|
|
&& $MPACK -s MITgcm-test -m 1500000 $DRESULTS".tar.gz" $ADDRESSES |
942 |
|
|
RETVAL=$? |
943 |
|
|
if test "x$RETVAL" != x0 ; then |
944 |
|
|
echo |
945 |
|
|
echo "Warning: The tar, gzip, & mpack step failed. Please send email" |
946 |
|
|
echo " to <MITgcm-support@mitgcm.org> for help. You may copy the " |
947 |
|
|
echo " summary of results from the directory \"$DRESULTS\"." |
948 |
|
|
echo |
949 |
|
|
else |
950 |
|
|
echo |
951 |
|
|
echo "An email containing results was sent to the following addresses:" |
952 |
|
|
echo " \"$ADDRESSES\"" |
953 |
|
|
echo |
954 |
|
|
fi |
955 |
|
|
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
956 |
|
|
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
957 |
|
|
fi |
958 |
|
|
fi |
959 |
edhill |
1.13 |
|
960 |
edhill |
1.22 |
# rm -f tmp_cmpnum.f a.out |
961 |
|
|
rm -f tmp_cmpnum.c tmp_cmpnum |
962 |
edhill |
1.1 |
|
963 |
edhill |
1.12 |
if test "x$CLEANUP" != xt ; then |
964 |
|
|
cat $SUMMARY |
965 |
edhill |
1.25 |
if test -e tr_out.txt ; then |
966 |
|
|
mv tr_out.txt tr_out.txt.old |
967 |
edhill |
1.14 |
fi |
968 |
edhill |
1.25 |
cat $SUMMARY > tr_out.txt |
969 |
edhill |
1.12 |
fi |
970 |
edhill |
1.1 |
|
971 |
edhill |
1.40 |
if test "x$DELDIR" = xt ; then |
972 |
|
|
rm -rf $DRESULTS |
973 |
|
|
fi |
974 |
|
|
|