181 |
|
|
182 |
testoutput_ad() |
testoutput_ad() |
183 |
{ |
{ |
184 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $5}' > t05.txt |
185 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $5}' > t15.txt |
186 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt |
grep $3 $1/results_ad/output_adm.txt | awk '{print NR " " $6}' > t06.txt |
187 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt |
grep $3 $1/$2/output_adm.txt | awk '{print NR " " $6}' > t16.txt |
188 |
join t05.txt t15.txt > t5.txt |
join t05.txt t15.txt > t5.txt |
189 |
join t06.txt t16.txt > t6.txt |
join t06.txt t16.txt > t6.txt |
190 |
echo "-1" >> t5.txt |
echo "-1" >> t5.txt |
304 |
command="$command --mods=../code" |
command="$command --mods=../code" |
305 |
else |
else |
306 |
command="$command --mods=../code_ad" |
command="$command --mods=../code_ad" |
|
command="$command -adof=../../../tools/adjoint_options/adjoint_staf" |
|
307 |
fi |
fi |
308 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
309 |
command="$command --optfile=$OPTFILE" |
command="$command --optfile=$OPTFILE" |
514 |
# (where "$COMMAND" is relative to "directory") |
# (where "$COMMAND" is relative to "directory") |
515 |
( |
( |
516 |
cd $1 |
cd $1 |
517 |
printf 'runmodel ... ' 1>&2 |
printf 'runmodel in %s ...' $1 1>&2 |
518 |
# make output.txt |
# make output.txt |
519 |
echo |
echo |
520 |
rm -f run.log |
rm -f run.log |
521 |
|
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
522 |
|
( eval $COMMAND ) > run.log 2>&1 |
523 |
|
RETVAL=$? |
524 |
|
else |
525 |
|
echo " $OUTPUTFILE is up to date " > run.log 2>&1 |
526 |
|
RETVAL=0 |
527 |
|
fi |
528 |
# echo "COMMAND='$COMMAND'" |
# echo "COMMAND='$COMMAND'" |
529 |
# echo "pwd='"`pwd`"'" |
# echo "pwd='"`pwd`"'" |
|
( eval $COMMAND ) > run.log 2>&1 |
|
|
RETVAL=$? |
|
530 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
531 |
tail run.log |
tail run.log |
532 |
echo successful 1>&2 |
echo successful 1>&2 |
534 |
# if test "x$ADM" = x ; then |
# if test "x$ADM" = x ; then |
535 |
# cp output.txt $CDIR"/output.txt" |
# cp output.txt $CDIR"/output.txt" |
536 |
# else |
# else |
537 |
# cp output.txt_adm $CDIR"/output.txt_adm" |
# cp output_adm.txt $CDIR"/output_adm.txt" |
538 |
# fi |
# fi |
539 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
540 |
return 0 |
return 0 |
810 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
811 |
fi |
fi |
812 |
|
|
813 |
|
if test "x$ADM" = xt ; then |
814 |
|
EXECUTABLE="mitgcmuv_ad" |
815 |
|
OUTPUTFILE="output_adm.txt" |
816 |
|
else |
817 |
|
EXECUTABLE="mitgcmuv" |
818 |
|
OUTPUTFILE="output.txt" |
819 |
|
fi |
820 |
|
|
821 |
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
822 |
COMMAND="./mitgcmuv_ad > output.txt_adm 2>&1" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
823 |
fi |
fi |
824 |
|
|
825 |
if test "x$COMMAND" = x ; then |
if test "x$COMMAND" = x ; then |
826 |
COMMAND="$MAKE output.txt" |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
827 |
fi |
fi |
828 |
|
|
829 |
echo "OK" |
#echo "OK" |
830 |
|
echo "OK (COMMAND= $COMMAND )" |
831 |
|
|
832 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
833 |
createcodelet |
createcodelet |
949 |
if test "x$ADM" = x ; then |
if test "x$ADM" = x ; then |
950 |
fout=$dir"/results/output.txt" |
fout=$dir"/results/output.txt" |
951 |
else |
else |
952 |
fout=$dir"/results_ad/output.txt_adm" |
fout=$dir"/results_ad/output_adm.txt" |
953 |
fi |
fi |
954 |
if test ! -r $fout ; then |
if test ! -r $fout ; then |
955 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
1004 |
echo "Experiment: $dir" |
echo "Experiment: $dir" |
1005 |
echo |
echo |
1006 |
unset genmake makedepend make run |
unset genmake makedepend make run |
1007 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
1008 |
|
|
1009 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir for each OPTFILE/tdir combination |
1010 |
rel_CDIR=$DRESULTS"/"$dir |
rel_CDIR=$DRESULTS"/"$dir |
1036 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1037 |
|
|
1038 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1039 |
|
unset run |
1040 |
|
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
1041 |
|
# Create an output dir for each OPTFILE/tdir.ex combination |
1042 |
|
rel_CDIR=$DRESULTS"/"$dir"."$ex |
1043 |
|
mkdir $rel_CDIR |
1044 |
|
CDIR=`pwd`"/$rel_CDIR" |
1045 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
1046 |
for ldir in input.$ex input ; do |
for ldir in input.$ex input ; do |
1047 |
( |
( |
1061 |
done |
done |
1062 |
ldir=build |
ldir=build |
1063 |
( |
( |
1064 |
cd "$dir/$ldir" > /dev/null 2>&1 |
cd $dir/tr_run.$ex |
1065 |
ls -1 Makefile *.[fFhco] mitgcmuv 2>/dev/null \ |
test ! -e mitgcmuv && ln -s "../"$ldir"/"mitgcmuv . |
|
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
|
|
) > tr_exrun_links |
|
|
( |
|
|
cd "$dir/tr_run.$ex" |
|
|
cat ../../tr_exrun_links | while read i ; do |
|
|
if test ! "x$i" = x ; then |
|
|
test ! -r $i && ln -s "../"$ldir"/"$i $i |
|
|
fi |
|
|
done |
|
1066 |
) |
) |
|
test -e tr_exrun_links && rm -f tr_exrun_links |
|
1067 |
runmodel $dir/tr_run.$ex && run=Y \ |
runmodel $dir/tr_run.$ex && run=Y \ |
1068 |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
&& results=`testoutput $dir tr_run.$ex "."$ex` |
1069 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1075 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
1076 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1077 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1078 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
1079 |
done |
done |
1080 |
else |
else |
1081 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
1087 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
1088 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
1089 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
1090 |
|
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
1091 |
|
>> $CDIR"/summary.txt" |
1092 |
fi |
fi |
1093 |
|
|
1094 |
postclean $dir/$builddir |
postclean $dir/$builddir |