22 |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
23 |
echo " Bourne-compatible \"sh\" shell" |
echo " Bourne-compatible \"sh\" shell" |
24 |
echo " (DEF=\"\" for \"bash\")" |
echo " (DEF=\"\" for \"bash\")" |
25 |
|
echo " (-adm|-ad) perform an adjoint run" |
26 |
echo " (-command) STRING command to run" |
echo " (-command) STRING command to run" |
27 |
echo " (DEF=\"make output.txt\")" |
echo " (DEF=\"make output.txt\")" |
28 |
echo " (-m|-make) STRING command to use for \"make\"" |
echo " (-m|-make) STRING command to use for \"make\"" |
55 |
HAVE_MPACK=f |
HAVE_MPACK=f |
56 |
fi |
fi |
57 |
echo -n "building mpack... " |
echo -n "building mpack... " |
58 |
( cd $MPACKDIR && ./configure && $MAKE ) > build_mpack.out 2>&1 |
if test "x$CC" = x ; then |
59 |
|
export CC=cc |
60 |
|
fi |
61 |
|
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
62 |
RETVAL=$? |
RETVAL=$? |
63 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
64 |
echo |
echo |
66 |
echo |
echo |
67 |
HAVE_MPACK=f |
HAVE_MPACK=f |
68 |
else |
else |
69 |
|
rm -f tr_build_mpack.out |
70 |
HAVE_MPACK=t |
HAVE_MPACK=t |
71 |
fi |
fi |
72 |
else |
else |
75 |
echo "OK" |
echo "OK" |
76 |
} |
} |
77 |
|
|
|
compare_lines() |
|
|
{ |
|
|
# use codelet to compare lines |
|
|
if [ $verbose -gt 1 ]; then |
|
|
cat tmp3.txt 1>&2 |
|
|
fi |
|
|
return `./a.out < tmp3.txt` |
|
|
} |
|
|
|
|
78 |
testoutput_for_prop() |
testoutput_for_prop() |
79 |
{ |
{ |
80 |
# testoutput_for_prop dir s1 label subdir |
# testoutput_for_prop dir s1 label subdir |
116 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
117 |
echo testoutput_for_prop: compare_lines 1>&2 |
echo testoutput_for_prop: compare_lines 1>&2 |
118 |
fi |
fi |
119 |
compare_lines |
if [ $verbose -gt 1 ]; then |
120 |
digits_of_similarity=$? |
cat tmp3.txt 1>&2 |
121 |
|
fi |
122 |
|
echo "-1" >> tmp3.txt |
123 |
|
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
124 |
|
cat tmp3.txt | sed -e 's|:||g' > tmp4.txt |
125 |
|
digits_of_similarity=`./tmp_cmpnum < tmp4.txt` |
126 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
127 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
128 |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
133 |
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
echo There were $digits_of_similarity decimal places of similarity for \"$2\" 1>&2 |
134 |
fi |
fi |
135 |
fi |
fi |
136 |
rm tmp1.txt tmp2.txt tmp3.txt |
rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt |
137 |
|
|
138 |
return $digits_of_similarity |
return $digits_of_similarity |
139 |
} |
} |
153 |
done |
done |
154 |
} |
} |
155 |
|
|
156 |
|
testoutput_ad() |
157 |
|
{ |
158 |
|
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt |
159 |
|
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt |
160 |
|
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt |
161 |
|
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt |
162 |
|
join t05.txt t15.txt > t5.txt |
163 |
|
join t06.txt t16.txt > t6.txt |
164 |
|
echo "-1" >> t5.txt |
165 |
|
echo "-1" >> t6.txt |
166 |
|
digits_5=`./tmp_cmpnum < t5.txt` |
167 |
|
digits_6=`./tmp_cmpnum < t6.txt` |
168 |
|
dashnum $digits_5 $digits_6 |
169 |
|
rm -f t[01][56].txt t[56].txt |
170 |
|
} |
171 |
|
|
172 |
testoutput() |
testoutput() |
173 |
{ |
{ |
174 |
# testoutput diretory subdir |
# testoutput directory subdir |
175 |
# |
# |
176 |
# test output in "directory" |
# test output in "directory" |
177 |
|
if test "x$ADM" = x ; then |
178 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
179 |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
180 |
fi |
fi |
181 |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2; cg2dres=$? |
182 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
183 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
184 |
|
fi |
185 |
|
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
186 |
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
187 |
|
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
188 |
|
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
189 |
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
190 |
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
191 |
|
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
192 |
|
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
193 |
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
194 |
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
195 |
|
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
196 |
|
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
197 |
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
198 |
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
199 |
|
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
200 |
|
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
201 |
|
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
202 |
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
203 |
|
else |
204 |
|
testoutput_ad $1 $2 "precision_grdchk_result" |
205 |
fi |
fi |
|
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2; tmin=$? |
|
|
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2; tmax=$? |
|
|
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2; tmean=$? |
|
|
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2; tsd=$? |
|
|
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2; smin=$? |
|
|
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2; smax=$? |
|
|
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2; smean=$? |
|
|
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2; ssd=$? |
|
|
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2; umin=$? |
|
|
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2; umax=$? |
|
|
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2; umean=$? |
|
|
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2; usd=$? |
|
|
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2; vmin=$? |
|
|
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2; vmax=$? |
|
|
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2; vmean=$? |
|
|
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2; vsd=$? |
|
|
|
|
|
dashnum $cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd \ |
|
|
$umin $umax $umean $usd $vmin $vmax $vmean $vsd |
|
206 |
} |
} |
207 |
|
|
208 |
genmakemodel() |
genmakemodel() |
214 |
GENMAKE2="$BASH ../../../tools/genmake2" |
GENMAKE2="$BASH ../../../tools/genmake2" |
215 |
( |
( |
216 |
cd $1; |
cd $1; |
217 |
command="$GENMAKE2 -ds -m $MAKE --mods=../code" |
command="$GENMAKE2 -ds -m $MAKE" |
218 |
|
if test "x$ADM" = x ; then |
219 |
|
command="$command --mods=../code" |
220 |
|
else |
221 |
|
command="$command --mods=../code_ad" |
222 |
|
command="$command -adof=../../../tools/adjoint_options/adjoint_staf" |
223 |
|
fi |
224 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
225 |
command="$command --optfile=$OPTFILE" |
command="$command --optfile=$OPTFILE" |
226 |
fi |
fi |
301 |
cd $1; |
cd $1; |
302 |
if test -r Makefile ; then |
if test -r Makefile ; then |
303 |
printf 'make ... ' 1>&2 |
printf 'make ... ' 1>&2 |
304 |
$MAKE >> make.log 2>&1 |
if test "x$ADM" = x ; then |
305 |
|
$MAKE >> make.log 2>&1 |
306 |
|
else |
307 |
|
$MAKE adall >> make.log 2>&1 |
308 |
|
fi |
309 |
RETVAL=$? |
RETVAL=$? |
310 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
311 |
tail make.log |
tail make.log |
319 |
) |
) |
320 |
} |
} |
321 |
|
|
322 |
|
symlink_mpifiles() |
323 |
|
{ |
324 |
|
# Put special links so that MPI specific files are used |
325 |
|
# This MUST be invoked between makeclean and makelinks because |
326 |
|
# the Makefile will link to non-mpi files by default |
327 |
|
|
328 |
|
dir=$1 |
329 |
|
code_dir=$2 |
330 |
|
BUILD_DIR=$dir/$3 |
331 |
|
CODE_DIR=$dir/$code_dir |
332 |
|
|
333 |
|
# These are files that should replace their counter-part when using -mpi |
334 |
|
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
335 |
|
|
336 |
|
# Is this an MPI run? |
337 |
|
if test "x$MPI" = xt ; then |
338 |
|
# YES: We symbolically link these files to the build |
339 |
|
# dir so long as there is no real file in place |
340 |
|
for ii in $MPI_FILES ; do |
341 |
|
i=`echo $ii | sed 's:^\./::'` |
342 |
|
name=`echo $i | sed 's:_mpi::' ` |
343 |
|
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
344 |
|
RETVAL=$? |
345 |
|
if test "x$RETVAL" != x0 ; then |
346 |
|
if ! test -f $BUILD_DIR/$i ; then |
347 |
|
#echo Linking $name to $i |
348 |
|
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
349 |
|
fi |
350 |
|
fi |
351 |
|
done |
352 |
|
else |
353 |
|
# NO: We undo any _mpi symbolically linked files |
354 |
|
for ii in $MPI_FILES ; do |
355 |
|
i=`echo $ii | sed 's:^\./::'` |
356 |
|
name=`echo $i | sed 's:_mpi::' ` |
357 |
|
if test -L $BUILD_DIR/$name ; then |
358 |
|
linktarg=`(cd $BUILD_DIR; readlink $name)` |
359 |
|
if test $linktarg = "../$code_dir/$name"_mpi ; then |
360 |
|
#echo Un-linking $name from $linktarg |
361 |
|
rm -f $BUILD_DIR/$name |
362 |
|
fi |
363 |
|
fi |
364 |
|
done |
365 |
|
fi |
366 |
|
|
367 |
|
} |
368 |
|
|
369 |
linkdata() |
linkdata() |
370 |
{ |
{ |
371 |
# linkdata flag |
# linkdata flag |
374 |
if test "x$1" = x1 ; then |
if test "x$1" = x1 ; then |
375 |
( |
( |
376 |
cd $2 |
cd $2 |
377 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
if test "x$ADM" = x ; then |
378 |
for i in $files ; do |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
379 |
if test ! -d "../input/"$i ; then |
for i in $files ; do |
380 |
ln -sf "../input/"$i $i |
if test ! -d "../input/"$i ; then |
381 |
fi |
ln -sf "../input/"$i $i |
382 |
done |
fi |
383 |
|
done |
384 |
|
else |
385 |
|
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
386 |
|
for i in $files ; do |
387 |
|
if test ! -d "../input/"$i ; then |
388 |
|
ln -sf "../input/"$i $i |
389 |
|
fi |
390 |
|
done |
391 |
|
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
392 |
|
for i in $files ; do |
393 |
|
if test ! -d "../input_ad/"$i ; then |
394 |
|
ln -sf "../input_ad/"$i $i |
395 |
|
fi |
396 |
|
done |
397 |
|
fi |
398 |
) |
) |
399 |
fi |
fi |
400 |
} |
} |
403 |
{ |
{ |
404 |
# runmodel directory |
# runmodel directory |
405 |
# |
# |
406 |
# runs "$COMMAND" in "directory" |
# runs "$COMMAND in "directory" |
407 |
# (where "$COMMAND" is relative to "directory") |
# (where "$COMMAND" is relative to "directory") |
408 |
( |
( |
409 |
cd $1 |
cd $1 |
413 |
RETVAL=$? |
RETVAL=$? |
414 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
415 |
echo successful 1>&2 |
echo successful 1>&2 |
416 |
cp output.txt $CDIR"/output.txt" |
if test "x$ADM" = x ; then |
417 |
|
cp output.txt $CDIR"/output.txt" |
418 |
|
else |
419 |
|
cp output.txt_adm $CDIR"/output.txt_adm" |
420 |
|
fi |
421 |
return 0 |
return 0 |
422 |
else |
else |
423 |
tail run.log |
tail run.log |
433 |
# create codelet for comparing model output |
# create codelet for comparing model output |
434 |
|
|
435 |
echo -n "creating the comparison code... " |
echo -n "creating the comparison code... " |
436 |
cat > tmp_cmpnum.f <<EOFA |
cat > tmp_cmpnum.c <<EOF |
437 |
program cmpnum |
#include <stdio.h> |
438 |
implicit none |
#include <math.h> |
439 |
real*8 a,b,diff |
int main( int argc, char** argv ) { |
440 |
integer linnum,best |
int linnum,best; |
441 |
best=-16 |
double a,b,diff; |
442 |
99 read(*,*,end=70,err=60) linnum,a,b |
best = -16; |
443 |
diff=0.5*(abs(a)+abs(b)) |
while( 1 ) { |
444 |
c print *,a,b,diff,abs(a-b)/diff |
scanf("%d", &linnum); |
445 |
if (diff.gt.1.e-12) then |
if (linnum == -1) break; |
446 |
diff=abs(a-b)/diff |
scanf("%lf", &a); scanf("%lf", &b); |
447 |
if (diff.gt.0.) then |
diff = 0.5*(fabs(a)+fabs(b)); |
448 |
c print *,int(log10(diff)),diff |
if (diff > 1.e-12) { |
449 |
linnum=int(log10(diff)) |
diff=fabs(a-b)/diff; |
450 |
best=max(best,linnum) |
if (diff > 0.0) { |
451 |
endif |
linnum = (int)log10(diff); |
452 |
else |
best = (best > linnum) ? best : linnum; |
453 |
if (best.eq.-16.and.diff.ne.0.) best=-22 |
} |
454 |
endif |
else { |
455 |
goto 99 |
if (best == -16 && diff != 0) best = -22; |
456 |
60 stop 'cmpnum: An error occured reading a,b' |
} |
457 |
70 print *,-best |
} |
458 |
end |
} |
459 |
EOFA |
printf("%d\n", -best); |
460 |
|
return 0; |
461 |
|
} |
462 |
|
EOF |
463 |
|
cc -o tmp_cmpnum tmp_cmpnum.c -lm |
464 |
|
|
465 |
f77 -o a.out tmp_cmpnum.f |
if [ -x ./tmp_cmpnum ]; then |
|
if [ -x ./a.out ]; then |
|
466 |
echo "OK" |
echo "OK" |
467 |
return 0 |
return 0 |
468 |
else |
else |
555 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
556 |
HAVE_MPACK= |
HAVE_MPACK= |
557 |
MPACK="$MPACKDIR/mpack" |
MPACK="$MPACKDIR/mpack" |
558 |
COMMAND="make output.txt" |
COMMAND= |
559 |
MAKE=make |
MAKE=make |
560 |
MPI=f |
MPI=f |
561 |
|
|
562 |
|
ADM= |
563 |
|
|
564 |
echo -n "parsing options... " |
echo -n "parsing options... " |
565 |
|
|
566 |
ac_prev= |
ac_prev= |
624 |
|
|
625 |
-mpi) MPI=t ;; |
-mpi) MPI=t ;; |
626 |
|
|
627 |
|
-adm | -ad) ADM=t ;; |
628 |
|
|
629 |
-ieee) IEEE=true ;; |
-ieee) IEEE=true ;; |
630 |
-noieee) IEEE= ;; |
-noieee) IEEE= ;; |
631 |
|
|
661 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
662 |
fi |
fi |
663 |
|
|
664 |
|
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
665 |
|
COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1" |
666 |
|
fi |
667 |
|
|
668 |
|
if test "x$COMMAND" = x ; then |
669 |
|
COMMAND="make output.txt" |
670 |
|
fi |
671 |
|
|
672 |
echo "OK" |
echo "OK" |
673 |
|
|
674 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
681 |
MACH=`hostname` |
MACH=`hostname` |
682 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
683 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
684 |
BASE=$MACH"_"$DATE"_" |
BASE="tr_"$MACH"_"$DATE"_" |
685 |
DNUM=0 |
DNUM=0 |
686 |
DRESULTS="$BASE$DNUM" |
DRESULTS="$BASE$DNUM" |
687 |
while test -e $DRESULTS ; do |
while test -e $DRESULTS ; do |
726 |
fi |
fi |
727 |
echo |
echo |
728 |
echo >> $SUMMARY |
echo >> $SUMMARY |
729 |
cat << EOF | tee -a $SUMMARY |
if test "x$ADM" = x ; then |
730 |
|
cat << EOF | tee -a $SUMMARY |
731 |
T S U V |
T S U V |
732 |
G D M c m s m s m s m s |
G D M c m s m s m s m s |
733 |
E p a R g m m e . m m e . m m e . m m e . |
E p a R g m m e . m m e . m m e . m m e . |
735 |
2 d e n d n x n . n x n . n x n . n x n . |
2 d e n d n x n . n x n . n x n . n x n . |
736 |
|
|
737 |
EOF |
EOF |
738 |
|
else |
739 |
|
echo "ADJOINT=true" >> $SUMMARY |
740 |
|
echo >> $SUMMARY |
741 |
|
cat << EOF | tee -a $SUMMARY |
742 |
|
G D M C G |
743 |
|
E p a R o r |
744 |
|
N n k u s a |
745 |
|
2 d e n t d |
746 |
|
|
747 |
|
EOF |
748 |
|
fi |
749 |
|
|
750 |
# ...and each test directory... |
# ...and each test directory... |
751 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
763 |
|
|
764 |
# Verify that the testdir exists and contains previous |
# Verify that the testdir exists and contains previous |
765 |
# results in the correct location--or skip this directory! |
# results in the correct location--or skip this directory! |
766 |
if test ! -r $dir"/results/output.txt" ; then |
fout= |
767 |
echo "can't read \"$dir/results/output.txt\" -- skipping $dir" |
if test "x$ADM" = x ; then |
768 |
|
fout=$dir"/results/output.txt" |
769 |
|
else |
770 |
|
fout=$dir"/results_ad/output.txt_adm" |
771 |
|
fi |
772 |
|
if test ! -r $fout ; then |
773 |
|
echo "can't read \"$fout\" -- skipping $dir" |
774 |
continue |
continue |
775 |
fi |
fi |
776 |
|
|
|
echo "-------------------------------------------------------------------------------" |
|
|
echo |
|
|
echo "Experiment: $dir" |
|
|
echo |
|
|
unset genmake makedepend make run |
|
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
|
|
|
|
777 |
builddir="input" |
builddir="input" |
778 |
rundir="input" |
rundir="input" |
779 |
use_seperate_build=0 |
use_seperate_build=0 |
784 |
linkdata $use_seperate_build $dir/$rundir |
linkdata $use_seperate_build $dir/$rundir |
785 |
fi |
fi |
786 |
|
|
787 |
CODE_DIR=$dir/code |
if test "x$ADM" = x ; then |
788 |
BUILD_DIR=$dir/$builddir |
code_dir=code |
789 |
MPI_FILES="CPP_EEOPTIONS.h_mpi SIZE.h_mpi" |
CODE_DIR=$dir/code |
|
NOMPI_FILES="CPP_EEOPTIONS.h_nompi SIZE.h_nompi" |
|
|
|
|
|
# Is this an MPI run? |
|
|
if test "x$MPI" = xt ; then |
|
|
FILES=$MPI_FILES |
|
|
endings="_mpi" |
|
790 |
else |
else |
791 |
FILES=$NOMPI_FILES |
code_dir=code_ad |
792 |
endings="_nompi" |
CODE_DIR=$dir/code_ad |
793 |
fi |
fi |
794 |
|
BUILD_DIR=$dir/$builddir |
795 |
# Check to see that we have the files |
|
796 |
have_files=t |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" == "xt" ; then |
797 |
for i in $FILES ; do |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
|
if test ! -r $CODE_DIR/$i ; then |
|
|
echo "Warning: can't read file $CODE_DIR/$i" |
|
|
have_files=f |
|
|
fi |
|
|
done |
|
|
if test "x$have_files" != xt -a "x$MPI" = xt ; then |
|
|
echo "Skipping $dir due to lack of input files (see above warning)" |
|
798 |
continue |
continue |
799 |
fi |
fi |
800 |
|
|
801 |
# If we have the $FILES and they differ, copy the $FILES to $BUILD_DIR |
echo "-------------------------------------------------------------------------------" |
802 |
if test "x$have_files" = xt ; then |
echo |
803 |
for i in $FILES ; do |
echo "Experiment: $dir" |
804 |
sstr="s|$endings||" |
echo |
805 |
name=`echo $i | sed -e $sstr ` |
unset genmake makedepend make run |
806 |
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
807 |
RETVAL=$? |
|
|
if test "x$RETVAL" != x0 ; then |
|
|
cp $CODE_DIR/$i $BUILD_DIR/$name |
|
|
fi |
|
|
done |
|
|
fi |
|
|
|
|
808 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
809 |
rel_CDIR=$DRESULTS"/"$dir |
rel_CDIR=$DRESULTS"/"$dir |
810 |
mkdir $rel_CDIR |
mkdir $rel_CDIR |
815 |
else |
else |
816 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
817 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
818 |
|
&& symlink_mpifiles $dir $code_dir $builddir \ |
819 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
820 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
821 |
&& linkdata $use_seperate_build $dir/$rundir \ |
&& linkdata $use_seperate_build $dir/$rundir \ |
824 |
fi |
fi |
825 |
|
|
826 |
echo |
echo |
827 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
if test "x$ADM" = x ; then |
828 |
|
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
829 |
|
else |
830 |
|
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
831 |
|
fres=$fres"$results $dir" |
832 |
|
fi |
833 |
echo |
echo |
834 |
echo "$fres" >> $SUMMARY |
echo "$fres" >> $SUMMARY |
835 |
echo "fresults='$fres'" > $CDIR"/summary.txt" |
echo "fresults='$fres'" > $CDIR"/summary.txt" |
874 |
fi |
fi |
875 |
fi |
fi |
876 |
|
|
877 |
rm tmp_cmpnum.f a.out |
# rm -f tmp_cmpnum.f a.out |
878 |
|
rm -f tmp_cmpnum.c tmp_cmpnum |
879 |
|
|
880 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
881 |
cat $SUMMARY |
cat $SUMMARY |
882 |
if test -e tr.out ; then |
if test -e tr_out.txt ; then |
883 |
mv tr.out tr.out.old |
mv tr_out.txt tr_out.txt.old |
884 |
fi |
fi |
885 |
cat $SUMMARY > tr.out |
cat $SUMMARY > tr_out.txt |
886 |
fi |
fi |
887 |
|
|