11 |
|
|
12 |
testoutput_for_prop() |
testoutput_for_prop() |
13 |
{ |
{ |
14 |
# testoutput_for_prop dir s1 label |
# testoutput_for_prop dir s1 label subdir |
15 |
# |
# |
16 |
# compares files in $dir/input/output.txt and $dir/results.output.txt |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
17 |
# using search strings s1 and text label |
# using search strings s1 and text label |
18 |
|
|
19 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
20 |
echo testoutput_for_prop: grep "$2" $1/input/output.txt 1>&2 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
21 |
fi |
fi |
22 |
if [ -r $1/input/output.txt ]; then |
if [ -r $1/$4/output.txt ]; then |
23 |
grep "$2" $1/input/output.txt | sed 's/.*=//' | nl > tmp1.txt |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | nl > tmp1.txt |
24 |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
lncnt=`wc -l tmp1.txt | awk '{print $1}' ` |
25 |
if [ $lncnt -lt 3 ]; then |
if [ $lncnt -lt 3 ]; then |
26 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
84 |
|
|
85 |
testoutput() |
testoutput() |
86 |
{ |
{ |
87 |
# testoutput diretory |
# testoutput diretory subdir |
88 |
# |
# |
89 |
# test output in "directory" |
# test output in "directory" |
90 |
|
|
91 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
92 |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
93 |
fi |
fi |
94 |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual"; cg2dres=$? |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
95 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
96 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
97 |
fi |
fi |
98 |
|
|
99 |
if [ $longtest -gt 0 ]; then |
if [ $longtest -gt 0 ]; then |
100 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum"; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
101 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum"; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
102 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean"; tmean=$? |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
103 |
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d."; tsd=$? |
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
104 |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum"; smin=$? |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
105 |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum"; smax=$? |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
106 |
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean"; smean=$? |
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
107 |
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d."; ssd=$? |
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
108 |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum"; umin=$? |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
109 |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum"; umax=$? |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
110 |
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean"; umean=$? |
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
111 |
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d."; usd=$? |
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
112 |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum"; vmin=$? |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
113 |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum"; vmax=$? |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
114 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean"; vmean=$? |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
115 |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d."; vsd=$? |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
116 |
else |
else |
117 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum"; tmin=$? |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
118 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum"; tmax=$? |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
119 |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum"; smin=$? |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
120 |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum"; smax=$? |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
121 |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum"; umin=$? |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
122 |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum"; umax=$? |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
123 |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum"; vmin=$? |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
124 |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum"; vmax=$? |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
125 |
fi |
fi |
126 |
|
|
127 |
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
227 |
) |
) |
228 |
} |
} |
229 |
|
|
230 |
|
linkdata() |
231 |
|
{ |
232 |
|
# linkdata flag |
233 |
|
# symbolically link data files to run directory |
234 |
|
if [ $1 -ne 0 ]; then |
235 |
|
# if [ ! -r $2 ]; then |
236 |
|
# mkdir $2 |
237 |
|
# fi |
238 |
|
( cd $2; ln -sf ../input/* .) |
239 |
|
fi |
240 |
|
} |
241 |
|
|
242 |
runmodel() |
runmodel() |
243 |
{ |
{ |
244 |
# runmodel directory exe |
# runmodel directory exe |
251 |
rm -f output.txt |
rm -f output.txt |
252 |
fi |
fi |
253 |
printf 'runmodel: ' 1>&2 |
printf 'runmodel: ' 1>&2 |
254 |
make output.txt && return 0 |
make output.txt && return 0 |
255 |
# if [ ! -r output.txt -o $quick -eq 0 ]; then |
return 1 |
|
# echo runmodel: running... 1>&2 |
|
|
# ( ./$2 > output.txt 2>&1 ) && return 0 |
|
|
# rm -f output.txt |
|
|
# ( make output.txt ) && return 0 |
|
|
# return 1 |
|
|
# else |
|
|
# echo runmodel: output.txt is newer than executable 1>&2 |
|
|
# ( make output.txt ) && return 0 |
|
|
# return 0 |
|
|
# fi |
|
|
# else |
|
|
# echo runmodel: executable \"$1/$2\" is missing 1>&2 |
|
|
# return 1 |
|
256 |
fi |
fi |
257 |
) |
) |
258 |
} |
} |
353 |
{ |
{ |
354 |
# Find all executables, object files, CPP'd source and model output |
# Find all executables, object files, CPP'd source and model output |
355 |
# and DELETE it. |
# and DELETE it. |
356 |
for opt in '-name mitgcmuv*' '-name *.o' '-name *.f' '-name *.c' '-path *results -prune -o -name *.meta' '-path *results -prune -o -name *.data' '-type l' |
for opt in '-name "mitgcmuv*"' '-name "*.o"' '-name "*.f"' '-name "*.c"' '-name "fort.*"' '-name "make.log"' '-path *results -prune -o -name "*.meta"' '-path *results -prune -o -name "*.data"' '-type l' |
357 |
do |
do |
358 |
echo Cleaning: find . $opt -exec rm {} \; |
echo Cleaning: find . $opt -exec rm {} \; |
359 |
find . $opt -exec rm {} \; |
find . $opt -exec rm {} \; |
361 |
} |
} |
362 |
|
|
363 |
############################################################################### |
############################################################################### |
364 |
|
############################################################################### |
365 |
|
############################################################################### |
366 |
|
|
367 |
# Main function |
# Main function |
368 |
|
|
446 |
else |
else |
447 |
results='-- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- --' |
448 |
fi |
fi |
449 |
genmakemodel $dir/input && genmake=Y \ |
if [ -r $dir/build ]; then |
450 |
&& makecleancompile $dir/input \ |
seperatebuilddir=1 |
451 |
&& makedependmodel $dir/input && makedepend=Y \ |
builddir=build |
452 |
&& makemodel $dir/input && make=Y \ |
rundir=build |
453 |
&& runmodel $dir/input mitgcmuv && run=Y \ |
(cd $dir/input; rm -f *.{o,f,c,F} work* output.txt Make* make.log; ) |
454 |
&& results=`testoutput $dir` \ |
(cd $dir/build; ln -sf ../input/* .) |
455 |
&& makecleanupafter $dir/input |
else |
456 |
|
seperatebuilddir=0 |
457 |
|
builddir=input |
458 |
|
rundir=input |
459 |
|
fi |
460 |
|
genmakemodel $dir/$builddir && genmake=Y \ |
461 |
|
&& makecleancompile $dir/$builddir \ |
462 |
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
463 |
|
&& makemodel $dir/$builddir && make=Y \ |
464 |
|
&& linkdata $seperatebuilddir $dir/$rundir \ |
465 |
|
&& runmodel $dir/$builddir mitgcmuv && run=Y \ |
466 |
|
&& results=`testoutput $dir $rundir` \ |
467 |
|
&& makecleanupafter $dir/$builddir |
468 |
echo |
echo |
469 |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results |
470 |
echo |
echo |