11 |
echo |
echo |
12 |
echo "where possible OPTIONS are:" |
echo "where possible OPTIONS are:" |
13 |
echo " (-help|-h) print usage" |
echo " (-help|-h) print usage" |
14 |
echo " (-mpi) use MPI input files" |
echo " ---- type of test : ----" |
15 |
echo " (-ieee|-noieee) if possible, use IEEE compiler flags" |
echo " (-tlm) perform a Tangent Linear run" |
|
echo " (DEF=\"-ieee\")" |
|
|
echo " (-optfile=|-of=)STRING list of optfiles to use" |
|
|
echo " (-a|-addr) STRING list of email recipients" |
|
|
echo " (DEF=\"edhill@mitgcm.org\")" |
|
|
echo " (-t|-tdir) STRING list of test dirs to use" |
|
|
echo " (DEF=\"\" which builds all)" |
|
|
echo " (-b|-bash) STRING preferred location of a \"bash\" or" |
|
|
echo " Bourne-compatible \"sh\" shell" |
|
|
echo " (DEF=\"\" for \"bash\")" |
|
16 |
echo " (-adm|-ad) perform an adjoint run" |
echo " (-adm|-ad) perform an adjoint run" |
17 |
echo " (-command) STRING command to run" |
echo " (-oad) perform an OpenAD adjoint run" |
18 |
echo " (DEF=\"make output.txt\")" |
echo " (-mth) run multi-threaded (using eedata.mth)" |
19 |
echo " (-m|-make) STRING command to use for \"make\"" |
echo " (-mpi) use MPI to compile and run on 2 processors" |
20 |
|
echo " (-MPI) NUMBER use MPI to compile and run on max NUMBER procs" |
21 |
|
echo " (-mfile|-mf) STRING MPI: file with list of possible machines to run on" |
22 |
|
echo " (-command|-c) STRING command to run (e.g., if non-standard MPI setting)" |
23 |
|
echo " DEF='mitgcmuv' or ='mpirun -np TR_NPROC mitgcmuv'" |
24 |
|
echo " ---- testing options : ----" |
25 |
|
echo " (-optfile|-of) STRING list of optfiles to use" |
26 |
|
echo " (-fast) use optfile default for compiler flags (no '-ieee')" |
27 |
|
echo " DEF=off => use IEEE numerics option (if available)" |
28 |
|
echo " (-devel) use optfile developement flags (if available)" |
29 |
|
echo " (-gsl) compile with \"-gsl\" flag" |
30 |
|
echo " (-use_r4|-ur4) if allowed, use real*4 type for '_RS' variable" |
31 |
|
echo " (-tdir|-t) STRING list of group and/or exp. dirs to test" |
32 |
|
echo " (recognized groups: basic, tutorials)" |
33 |
|
echo " (DEF=\"\" which test all)" |
34 |
|
echo " (if list= 'start_from THIS_EXP' then" |
35 |
|
echo " test THIS_EXP + all the following)" |
36 |
|
echo " (-skipdir|-skd) STRING list of exp. dirs to skip" |
37 |
|
echo " (DEF=\"\" which test all)" |
38 |
|
echo " (-ts) provide timing information per timestep" |
39 |
|
echo " (-papis) provide MFlop/s per timestep using PAPI" |
40 |
|
echo " (-pcls) provide MFlop/s per timestep using PCL" |
41 |
|
echo " ---- system options : ----" |
42 |
|
echo " (-bash|-b) STRING preferred location of a \"bash\" or \"sh\" shell" |
43 |
|
echo " (DEF=\"\" for \"bash\")" |
44 |
|
echo " (-ef) STRING used as genmake2 \"-extra_flag\" argument" |
45 |
|
echo " (-ncad) use genmake2 option \"-nocat4ad\" (-ncad)" |
46 |
|
echo " (-small_f) make target small_f before making target all" |
47 |
|
echo " (-makedepend|-md) STRING command to use for \"makedepend\"" |
48 |
|
echo " (-make|-m) STRING command to use for \"make\"" |
49 |
echo " (DEF=\"make\")" |
echo " (DEF=\"make\")" |
50 |
|
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
51 |
|
echo " ---- output options : ----" |
52 |
|
echo " (-match) NUMBER Matching Criteria (number of digits)" |
53 |
|
echo " (DEF=\"$MATCH_CRIT\")" |
54 |
echo " (-odir) STRING used to build output directory name" |
echo " (-odir) STRING used to build output directory name" |
55 |
echo " (DEF=\"hostname\")" |
echo " (DEF=\"hostname\")" |
56 |
echo " (-ptracers|-ptr) STRING specify which ptracers to test" |
echo " (-addr|-a) STRING list of email recipients" |
57 |
echo " (DEF=\"1 2 3 4 5\")" |
echo " (DEF=\"\" no email is sent)" |
58 |
echo " (-j) JOBS use \"make -j JOBS\" for parallel builds" |
echo " (-send) STRING sending command (instead of using mpack)" |
59 |
echo " (-clean) *ONLY* run \"make CLEAN\"" |
echo " (-savdir|-sd) STRING location to save output tar file to send (DEF='$SAVDIR')" |
60 |
|
echo " (-mpackdir|-mpd) DIR location of the mpack utility" |
61 |
|
echo " (DEF=\"../tools/mpack-1.6\")" |
62 |
|
echo " -- do only some parts: --" |
63 |
|
echo " (-clean) *ONLY* run \"make CLEAN\" & clean run-dir" |
64 |
|
echo " (-norun|-nr) skip the \"runmodel\" stage (stop after make)" |
65 |
|
echo " (-obj) only produces objects (=norun & no executable)" |
66 |
|
echo " (-runonly|-ro) *ONLY* run stage (=\"-quick\" without make)" |
67 |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
echo " (-quick|-q) same as \"-nogenmake -noclean -nodepend\"" |
68 |
echo " (-nogenmake|-ng) skip the genmake stage" |
echo " (-nogenmake|-ng) skip the genmake stage" |
69 |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
echo " (-noclean|-nc) skip the \"make clean\" stage" |
70 |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
echo " (-nodepend|-nd) skip the \"make depend\" stage" |
71 |
|
echo " (-postclean|-pc) after each exp. test, clean build-dir & run-dir" |
72 |
|
echo " (-deloutp|-do) delete output files after successful run" |
73 |
echo " (-deldir|-dd) on success, delete the output directory" |
echo " (-deldir|-dd) on success, delete the output directory" |
74 |
echo |
echo |
75 |
echo "and where STRING can be a whitespace-delimited list" |
echo "and where STRING can be a whitespace-delimited list" |
88 |
build_mpack() |
build_mpack() |
89 |
{ |
{ |
90 |
printf "building the mpack utility... " |
printf "building the mpack utility... " |
91 |
if test ! -x "$MPACKDIR/mpack" ; then |
MPACK="$MPACKDIR/mpack" |
92 |
|
if test ! -x $MPACK ; then |
93 |
if test ! -d $MPACKDIR ; then |
if test ! -d $MPACKDIR ; then |
94 |
echo |
echo |
95 |
echo "Error: can't find \"$MPACKDIR\"" |
echo "Error: can't find \"$MPACKDIR\"" |
98 |
echo |
echo |
99 |
HAVE_MPACK=f |
HAVE_MPACK=f |
100 |
fi |
fi |
|
printf "building mpack... " |
|
101 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
102 |
export CC=cc |
export CC=cc |
103 |
fi |
fi |
104 |
|
printf "building mpack (using CC=$CC)... " |
105 |
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
( cd $MPACKDIR && ./configure && $MAKE ) > tr_build_mpack.out 2>&1 |
106 |
RETVAL=$? |
RETVAL=$? |
107 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
112 |
else |
else |
113 |
rm -f tr_build_mpack.out |
rm -f tr_build_mpack.out |
114 |
HAVE_MPACK=t |
HAVE_MPACK=t |
115 |
|
echo "done" |
116 |
fi |
fi |
117 |
else |
else |
118 |
HAVE_MPACK=t |
HAVE_MPACK=t |
119 |
|
echo "already exist" |
120 |
fi |
fi |
|
echo "OK" |
|
121 |
} |
} |
122 |
|
|
123 |
testoutput_for_prop() |
testoutput_var() |
124 |
{ |
{ |
125 |
# testoutput_for_prop dir s1 label subdir extension |
# testoutput_var dir s1 label subdir reference_output |
126 |
# |
# |
127 |
# compares files in $dir/$subdir/output.txt and $dir/results/output.txt |
# compares 1 variable output selected from file $dir/$subdir/$OUTPUTFILE |
128 |
# using search strings s1 and text label |
# with same output from reference file $dir/$reference_output |
129 |
|
# using search strings s1 and text label |
130 |
|
|
131 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
132 |
echo testoutput_for_prop: grep "$2" $1/$4/output.txt 1>&2 |
echo testoutput_var: grep "$2" $1/$4/$OUTPUTFILE 1>&2 |
133 |
fi |
fi |
134 |
if [ -r $1/$4/output.txt ]; then |
if [ -r $1/$4/$OUTPUTFILE ]; then |
135 |
grep "$2" $1/$4/output.txt | sed 's/.*=//' | cat -n > tmp1.txt |
grep "$2" $1/$4/$OUTPUTFILE | sed 's/.*=//' | nl > ${TMP}a.txt |
136 |
lncntA=`wc -l tmp1.txt | awk '{print $1}' ` |
lncntA=`wc -l ${TMP}a.txt | awk '{print $1}' ` |
137 |
if [ $lncntA -lt 3 ]; then |
if [ $lncntA -lt 2 ]; then |
138 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
139 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
140 |
fi |
fi |
141 |
return 99 |
rm -f ${TMP}a.txt ; return 99 |
142 |
fi |
fi |
143 |
else |
else |
144 |
echo testoutput_for_prop: output.txt from model run was not readable 1>&2 |
echo testoutput_var: $OUTPUTFILE from model run was not readable 1>&2 |
145 |
return 99 |
return 99 |
146 |
fi |
fi |
147 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
148 |
echo testoutput_for_prop: grep "$2" $1/results/output.txt$5 1>&2 |
echo testoutput_var: grep "$2" $1/$5 1>&2 |
149 |
fi |
fi |
150 |
grep "$2" $1/results/output.txt$5 | sed 's/.*=//' | cat -n > tmp2.txt |
grep "$2" $1/$5 | sed 's/.*=//' | nl > ${TMP}b.txt |
151 |
lncntB=`wc -l tmp2.txt | awk '{print $1}' ` |
lncntB=`wc -l ${TMP}b.txt | awk '{print $1}' ` |
152 |
if [ $lncntB -lt 3 ]; then |
if [ $lncntB -lt 2 ]; then |
153 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
154 |
echo Not enough lines of output when searching for "$2" 1>&2 |
echo Not enough lines of output when searching for "$2" 1>&2 |
155 |
fi |
fi |
156 |
return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
157 |
fi |
fi |
158 |
if [ $lncntA -ne $lncntB ]; then |
if [ $lncntA -ne $lncntB ]; then |
159 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
160 |
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
echo Not same Nb of lines when searching for "$2" ":" $lncntA $lncntB 1>&2 |
161 |
fi |
fi |
162 |
return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
163 |
fi |
fi |
164 |
has_nan=`cat tmp1.txt | grep -i nan | wc -l` |
has_nan=`cat ${TMP}a.txt | grep -i nan | wc -l` |
165 |
if [ $has_nan -gt 0 ] ; then |
if [ $has_nan -gt 0 ] ; then |
166 |
echo testoutput_for_prop: output.txt contains $has_nan NaN values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_nan NaN values 1>&2 |
167 |
return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
168 |
fi |
fi |
169 |
has_inf=`cat tmp1.txt | grep -i inf | wc -l` |
has_inf=`cat ${TMP}a.txt | grep -i inf | wc -l` |
170 |
if [ $has_inf -gt 0 ] ; then |
if [ $has_inf -gt 0 ] ; then |
171 |
echo testoutput_for_prop: output.txt contains $has_inf Inf values 1>&2 |
echo testoutput_var: $OUTPUTFILE contains $has_inf Inf values 1>&2 |
172 |
return 99 |
rm -f ${TMP}a.txt ${TMP}b.txt ; return 99 |
173 |
fi |
fi |
174 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
175 |
echo testoutput_for_prop: join tmp1.txt tmp2.txt 1>&2 |
echo testoutput_var: join ${TMP}a.txt ${TMP}b.txt 1>&2 |
176 |
fi |
fi |
177 |
join tmp1.txt tmp2.txt | awk '{print $1 " " $2 " " $3}' > tmp3.txt |
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
178 |
|
join ${TMP}a.txt ${TMP}b.txt | awk '{print $1 " " $2 " " $3}' | sed -e 's|:||g' > ${TMP}c.txt |
179 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then |
180 |
echo testoutput_for_prop: compare_lines 1>&2 |
echo testoutput_var: compare_lines 1>&2 |
181 |
fi |
fi |
182 |
if [ $verbose -gt 1 ]; then |
if [ $verbose -gt 1 ]; then |
183 |
cat tmp3.txt 1>&2 |
cat ${TMP}c.txt 1>&2 |
184 |
fi |
fi |
185 |
echo "-1" >> tmp3.txt |
echo "-1" >> ${TMP}c.txt |
186 |
# On the SGI O3K (*not* the O2K), "cat -n" inserts a ":" after the line number |
digits_of_similarity=`./tr_cmpnum < ${TMP}c.txt` |
|
cat tmp3.txt | sed -e 's|:||g' > tmp4.txt |
|
|
digits_of_similarity=`./tmp_cmpnum < tmp4.txt` |
|
187 |
if [ $digits_of_similarity -eq 99 ]; then |
if [ $digits_of_similarity -eq 99 ]; then |
188 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
189 |
echo testoutput_for_prop: No comparison was available for \"$2\" 1>&2 |
echo testoutput_var: No comparison was available for \"$3\" 1>&2 |
190 |
fi |
fi |
191 |
digits_of_similarity=99 |
digits_of_similarity=99 |
192 |
else |
else |
193 |
if [ $verbose -gt 0 ]; then |
if [ $verbose -gt 0 ]; then |
194 |
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 \"$3\" 1>&2 |
195 |
fi |
fi |
196 |
fi |
fi |
197 |
rm -f tmp1.txt tmp2.txt tmp3.txt tmp4.txt |
rm -f ${TMP}a.txt ${TMP}b.txt ${TMP}c.txt |
198 |
|
|
199 |
return $digits_of_similarity |
return $digits_of_similarity |
200 |
} |
} |
201 |
|
|
202 |
dashnum() |
testoutput_run() |
203 |
{ |
{ |
204 |
# dashnum n1 n2 n3 ... |
# testoutput_run directory subdir reference_output |
205 |
# |
# |
206 |
# print numbers using %3i format or "--" if number = 99 |
# test output from 1 run in "directory" |
207 |
|
# --> same processing for adjoint & forward test |
208 |
for num in $@ ; do |
# default list of output variables to be checked: |
209 |
if [ $num = 99 ]; then |
# 1rst : main variable used to decide if it pass or FAIL |
210 |
printf ' --' |
# others : number of matching digits to be printed in summary.txt |
211 |
else |
listChk=$DEF_CHECK_LIST |
212 |
printf '%3i' $num |
# load experiment-specific list from file "tr_checklist" (if it exist) |
213 |
|
if test -r $1/$2/tr_checklist ; then listChk=`cat $1/$2/tr_checklist` ; fi |
214 |
|
sVar=`echo $listChk | awk '{print $1}'` |
215 |
|
# remove 1rst var and expand the list: + => min max mean s.d |
216 |
|
listVar=`echo $listChk | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' \ |
217 |
|
| sed 's/+//g' | sed "s/^$sVar//"` |
218 |
|
if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(I)='$listVar'" 1>&2 ; fi |
219 |
|
# set ref.outp file-name and, if compressed, uncompress it into subdir |
220 |
|
refoutp=results/$3 |
221 |
|
if test ! -r $1/results/$3 ; then |
222 |
|
if test -r $1/results/${3}.gz ; then |
223 |
|
tmpNam1=$3 |
224 |
|
tmpNam2=`echo $tmpNam1 | sed 's/\..*\././'` |
225 |
|
if test "x$tmpNam1" = "x$tmpNam2" ; then |
226 |
|
tmpNam1=`echo $tmpNam2 | sed 's/\./.std./'` |
227 |
|
fi |
228 |
|
refoutp=$2/$tmpNam1 |
229 |
|
if [ $debug -gt 0 ]; then |
230 |
|
echo "testoutput_run: gunzip 'results/$3.gz' into '$refoutp'" 1>&2 |
231 |
|
fi |
232 |
|
gzip -cd $1/results/${3}.gz > $1/$refoutp |
233 |
|
else |
234 |
|
echo "missing reference output file '$3' (.gz) in '$1/results/'" |
235 |
|
fi |
236 |
fi |
fi |
237 |
done |
# check for ptracer output in reference_output file : |
238 |
} |
if test $KIND = 0 ; then |
239 |
|
ptr_mon="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
240 |
testoutput_ad() |
ptr_mon="$ptr_mon trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
241 |
{ |
for ii in $PTRACERS_NUM ; do |
242 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $5}' > t05.txt |
ptrfound=0 |
243 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $5}' > t15.txt |
for jj in $ptr_mon ; do |
244 |
grep $3 $1/results_ad/output.txt_adm | awk '{print NR " " $6}' > t06.txt |
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
245 |
grep $3 $1/$2/output.txt_adm | awk '{print NR " " $6}' > t16.txt |
tst=`grep $name $1/$refoutp | wc -l | awk '{print $1}'` |
246 |
join t05.txt t15.txt > t5.txt |
if test ! "x$tst" = x0 ; then ptrfound=1 ; fi |
247 |
join t06.txt t16.txt > t6.txt |
done |
248 |
echo "-1" >> t5.txt |
if test $ptrfound = '1' ; then |
|
echo "-1" >> t6.txt |
|
|
digits_5=`./tmp_cmpnum < t5.txt` |
|
|
digits_6=`./tmp_cmpnum < t6.txt` |
|
|
dashnum $digits_5 $digits_6 |
|
|
rm -f t[01][56].txt t[56].txt |
|
|
} |
|
|
|
|
|
check_for_add_mon_output() |
|
|
{ |
|
|
# Check for additional types of monitor output |
|
|
if test "x$1" = x ; then |
|
|
return |
|
|
fi |
|
|
|
|
|
for ii in $PTRACERS_NUM ; do |
|
|
eval "HAVE_PTR0"$ii"=f" |
|
|
done |
|
|
|
|
|
ptr_add="trcstat_ptracerXX_min trcstat_ptracerXX_max" |
|
|
ptr_add="$ptr_add trcstat_ptracerXX_mean trcstat_ptracerXX_sd" |
|
|
for ii in $PTRACERS_NUM ; do |
|
|
for jj in $ptr_add ; do |
|
|
name=`eval "echo $jj | sed -e 's|XX|0"$ii"|g'"` |
|
|
tst=`grep $name $1 | wc -l | awk '{print $1}'` |
|
|
if test ! "x$tst" = x0 ; then |
|
249 |
eval "HAVE_PTR0"$ii"=t" |
eval "HAVE_PTR0"$ii"=t" |
250 |
|
else |
251 |
|
eval "HAVE_PTR0"$ii"=f" |
252 |
|
# remove this ptr from the list of output variable to check |
253 |
|
# echo "-- ptr test=" $tst "number of var=" `echo $listVar | awk '{print NF}'` 1>&2 |
254 |
|
listVar=`echo "$listVar" | sed "s/ pt$ii..//g"` |
255 |
fi |
fi |
256 |
done |
# eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' 1>&2 |
257 |
# eval 'echo "HAVE_PTR0'$ii' = $HAVE_PTR0'$ii'"' |
done |
258 |
done |
fi |
259 |
} |
tst=`echo $sVar $listVar | awk '{ for(i=2;i<=NF;i++){if($i==$1)t+=1}; print t }'` |
260 |
|
if test $tst != 1 ; then |
261 |
testoutput() |
if test $tst = 0 ; then echo "==> WARNING: selected var >$sVar< not found" 1>&2 |
262 |
{ |
else echo "==> WARNING: found selected var >$sVar< $tst times" 1>&2 ; fi |
263 |
# testoutput directory subdir extension |
echo "==> WARNING: in checked list:" $listVar 1>&2 |
264 |
# |
#- put it back once: |
265 |
# test output in "directory" |
listVar=" $sVar "`echo "$listVar " | sed "s/ $sVar / /g"` |
266 |
if test "x$ADM" = x ; then |
fi |
267 |
if [ $debug -gt 0 ]; then |
if [ $debug -gt 0 ]; then echo "testoutput_run: listVar(M)='$listVar'" 1>&2 ; fi |
268 |
echo testoutput: testoutput_for_prop $1 cg2d_init_res 1>&2 |
echo "listVar='$listVar'" >> $locDIR"/summary.txt" |
269 |
fi |
#--- |
270 |
testoutput_for_prop $1 "cg2d_init_res" "cg2d init. residual" $2 $3; cg2dres=$? |
allargs="" |
271 |
if [ $debug -gt 0 ]; then |
for xx in $listVar |
272 |
echo testoutput: cg2dres=$cg2dres 1>&2 |
do |
273 |
fi |
case $xx in |
274 |
testoutput_for_prop $1 "dynstat_theta_min" "theta minimum" $2 $3; tmin=$? |
'PS') if [ $debug -gt 0 ] |
275 |
testoutput_for_prop $1 "dynstat_theta_max" "theta maximum" $2 $3; tmax=$? |
then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi |
276 |
testoutput_for_prop $1 "dynstat_theta_mean" "theta mean" $2 $3; tmean=$? |
testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $refoutp ; yy=$? |
277 |
testoutput_for_prop $1 "dynstat_theta_sd" "theta s.d." $2 $3; tsd=$? |
if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;; |
278 |
testoutput_for_prop $1 "dynstat_salt_min" "salt minimum" $2 $3; smin=$? |
'Cost') testoutput_var $1 "ADM ref_cost_function" "ADM CostFct" $2 $refoutp ; yy=$? ;; |
279 |
testoutput_for_prop $1 "dynstat_salt_max" "salt maximum" $2 $3; smax=$? |
'AdGrd') testoutput_var $1 "ADM adjoint_gradient" "ADM Ad Grad" $2 $refoutp ; yy=$? ;; |
280 |
testoutput_for_prop $1 "dynstat_salt_mean" "salt mean" $2 $3; smean=$? |
'FDGrd') testoutput_var $1 "ADM finite-diff_grad" "ADM FD Grad" $2 $refoutp ; yy=$? ;; |
281 |
testoutput_for_prop $1 "dynstat_salt_sd" "salt s.d." $2 $3; ssd=$? |
'tlmCst') testoutput_var $1 "TLM ref_cost_function" "TLM CostFct" $2 $refoutp ; yy=$? ;; |
282 |
testoutput_for_prop $1 "dynstat_uvel_min" "U minimum" $2 $3; umin=$? |
'tlmGrd') testoutput_var $1 "TLM tangent-lin_grad" "TLM TL Grad" $2 $refoutp ; yy=$? ;; |
283 |
testoutput_for_prop $1 "dynstat_uvel_max" "U maximum" $2 $3; umax=$? |
'fwdGrd') testoutput_var $1 "TLM finite-diff_grad" "TLM FD Grad" $2 $refoutp ; yy=$? ;; |
284 |
testoutput_for_prop $1 "dynstat_uvel_mean" "U mean" $2 $3; umean=$? |
'Tmn') testoutput_var $1 "dynstat_theta_min" "Theta minimum" $2 $refoutp ; yy=$? ;; |
285 |
testoutput_for_prop $1 "dynstat_uvel_sd" "U s.d." $2 $3; usd=$? |
'Tmx') testoutput_var $1 "dynstat_theta_max" "Theta maximum" $2 $refoutp ; yy=$? ;; |
286 |
testoutput_for_prop $1 "dynstat_vvel_min" "V minimum" $2 $3; vmin=$? |
'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean" $2 $refoutp ; yy=$? ;; |
287 |
testoutput_for_prop $1 "dynstat_vvel_max" "V maximum" $2 $3; vmax=$? |
'Tsd') testoutput_var $1 "dynstat_theta_sd" "Theta Std.Dev" $2 $refoutp ; yy=$? ;; |
288 |
testoutput_for_prop $1 "dynstat_vvel_mean" "V mean" $2 $3; vmean=$? |
'Smn') testoutput_var $1 "dynstat_salt_min" "Salt minimum" $2 $refoutp ; yy=$? ;; |
289 |
testoutput_for_prop $1 "dynstat_vvel_sd" "V s.d." $2 $3; vsd=$? |
'Smx') testoutput_var $1 "dynstat_salt_max" "Salt maximum" $2 $refoutp ; yy=$? ;; |
290 |
|
'Sav') testoutput_var $1 "dynstat_salt_mean" "Salt mean" $2 $refoutp ; yy=$? ;; |
291 |
# This is for PTRACERS |
'Ssd') testoutput_var $1 "dynstat_salt_sd" "Salt Std.Dev" $2 $refoutp ; yy=$? ;; |
292 |
for ii in $PTRACERS_NUM ; do |
'Umn') testoutput_var $1 "dynstat_uvel_min" "U minimum" $2 $refoutp ; yy=$? ;; |
293 |
eval `echo "p0"$ii"_min=99"` |
'Umx') testoutput_var $1 "dynstat_uvel_max" "U maximum" $2 $refoutp ; yy=$? ;; |
294 |
eval `echo "p0"$ii"_max=99"` |
'Uav') testoutput_var $1 "dynstat_uvel_mean" "U mean" $2 $refoutp ; yy=$? ;; |
295 |
eval `echo "p0"$ii"_mean=99"` |
'Usd') testoutput_var $1 "dynstat_uvel_sd" "U Std.Dev" $2 $refoutp ; yy=$? ;; |
296 |
eval `echo "p0"$ii"_sd=99"` |
'Vmn') testoutput_var $1 "dynstat_vvel_min" "V minimum" $2 $refoutp ; yy=$? ;; |
297 |
tst=`eval 'echo "$HAVE_PTR0'$ii'"'` |
'Vmx') testoutput_var $1 "dynstat_vvel_max" "V maximum" $2 $refoutp ; yy=$? ;; |
298 |
#echo 'tst = '$tst |
'Vav') testoutput_var $1 "dynstat_vvel_mean" "V mean" $2 $refoutp ; yy=$? ;; |
299 |
if test "x$tst" = xt ; then |
'Vsd') testoutput_var $1 "dynstat_vvel_sd" "V Std.Dev" $2 $refoutp ; yy=$? ;; |
300 |
a="trcstat_ptracer0" |
'pt1mn'|'pt2mn'|'pt3mn'|'pt4mn'|'pt5mn') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` |
301 |
testoutput_for_prop $1 "$a"$ii"_min" "p0"$ii"_min" $2 $3 |
testoutput_var $1 "trcstat_ptracer0"$ii"_min" "p0"$ii"_min" $2 $refoutp ; yy=$? ;; |
302 |
RETVAL=$? ; eval `echo "p0"$ii"_min="$RETVAL` |
'pt1mx'|'pt2mx'|'pt3mx'|'pt4mx'|'pt5mx') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` |
303 |
testoutput_for_prop $1 "$a"$ii"_max" "p0"$ii"_max" $2 $3 |
testoutput_var $1 "trcstat_ptracer0"$ii"_max" "p0"$ii"_max" $2 $refoutp ; yy=$? ;; |
304 |
RETVAL=$? ; eval `echo "p0"$ii"_max="$RETVAL` |
'pt1av'|'pt2av'|'pt3av'|'pt4av'|'pt5av') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` |
305 |
testoutput_for_prop $1 "$a"$ii"_mean" "p0"$ii"_mean" $2 $3 |
testoutput_var $1 "trcstat_ptracer0"$ii"_mean" "p0"$ii"_mean" $2 $refoutp ; yy=$? ;; |
306 |
RETVAL=$? ; eval `echo "p0"$ii"_mean="$RETVAL` |
'pt1sd'|'pt2sd'|'pt3sd'|'pt4sd'|'pt5sd') ii=`echo $xx | sed 's/pt//' | sed 's/..$//'` |
307 |
testoutput_for_prop $1 "$a"$ii"_sd" "p0"$ii"_sd" $2 $3 |
testoutput_var $1 "trcstat_ptracer0"$ii"_sd" "p0"$ii"_StDv" $2 $refoutp ; yy=$? ;; |
308 |
RETVAL=$? ; eval `echo "p0"$ii"_sd="$RETVAL` |
'Qntmn') testoutput_var $1 "forcing_qnet_min" "Qnet minimum" $2 $refoutp ; yy=$? ;; |
309 |
fi |
'Qntmx') testoutput_var $1 "forcing_qnet_max" "Qnet maximum" $2 $refoutp ; yy=$? ;; |
310 |
|
'Qntav') testoutput_var $1 "forcing_qnet_mean" "Qnet mean" $2 $refoutp ; yy=$? ;; |
311 |
|
'Qntsd') testoutput_var $1 "forcing_qnet_sd" "Qnet Std.Dev" $2 $refoutp ; yy=$? ;; |
312 |
|
'aSImn') testoutput_var $1 "seaice_area_min" "SIce Area min" $2 $refoutp ; yy=$? ;; |
313 |
|
'aSImx') testoutput_var $1 "seaice_area_max" "SIce Area max" $2 $refoutp ; yy=$? ;; |
314 |
|
'aSIav') testoutput_var $1 "seaice_area_mean" "SIce Area mean" $2 $refoutp ; yy=$? ;; |
315 |
|
'aSIsd') testoutput_var $1 "seaice_area_sd" "SIce Area StDv" $2 $refoutp ; yy=$? ;; |
316 |
|
'hSImn') testoutput_var $1 "seaice_heff_min" "SIce Heff min" $2 $refoutp ; yy=$? ;; |
317 |
|
'hSImx') testoutput_var $1 "seaice_heff_max" "SIce Heff max" $2 $refoutp ; yy=$? ;; |
318 |
|
'hSIav') testoutput_var $1 "seaice_heff_mean" "SIce Heff mean" $2 $refoutp ; yy=$? ;; |
319 |
|
'hSIsd') testoutput_var $1 "seaice_heff_sd" "SIce Heff StDv" $2 $refoutp ; yy=$? ;; |
320 |
|
'uSImn') testoutput_var $1 "seaice_uice_min" "SIce Uice min" $2 $refoutp ; yy=$? ;; |
321 |
|
'uSImx') testoutput_var $1 "seaice_uice_max" "SIce Uice max" $2 $refoutp ; yy=$? ;; |
322 |
|
'uSIav') testoutput_var $1 "seaice_uice_mean" "SIce Uice mean" $2 $refoutp ; yy=$? ;; |
323 |
|
'uSIsd') testoutput_var $1 "seaice_uice_sd" "SIce Uice StDv" $2 $refoutp ; yy=$? ;; |
324 |
|
'vSImn') testoutput_var $1 "seaice_vice_min" "SIce Vice min" $2 $refoutp ; yy=$? ;; |
325 |
|
'vSImx') testoutput_var $1 "seaice_vice_max" "SIce Vice max" $2 $refoutp ; yy=$? ;; |
326 |
|
'vSIav') testoutput_var $1 "seaice_vice_mean" "SIce Vice mean" $2 $refoutp ; yy=$? ;; |
327 |
|
'vSIsd') testoutput_var $1 "seaice_vice_sd" "SIce Vice StDv" $2 $refoutp ; yy=$? ;; |
328 |
|
'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $refoutp ; yy=$? ;; |
329 |
|
'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South" $2 $refoutp ; yy=$? ;; |
330 |
|
'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North" $2 $refoutp ; yy=$? ;; |
331 |
|
'HthSiG') testoutput_var $1 "thSI_IceH_ave_G" "thSIc H Glob-ave" $2 $refoutp ; yy=$? ;; |
332 |
|
'HthSiS') testoutput_var $1 "thSI_IceH_ave_S" "thSIc H South-av" $2 $refoutp ; yy=$? ;; |
333 |
|
'HthSiN') testoutput_var $1 "thSI_IceH_ave_N" "thSIc H North-av" $2 $refoutp ; yy=$? ;; |
334 |
|
'HthMxS') testoutput_var $1 "thSI_IceH_max_S" "thSIc H South-max" $2 $refoutp ; yy=$? ;; |
335 |
|
'HthMxN') testoutput_var $1 "thSI_IceH_max_N" "thSIc H North-max" $2 $refoutp ; yy=$? ;; |
336 |
|
'sbo_M') testoutput_var $1 "sbo_mass" "SBO mass" $2 $refoutp ; yy=$? ;; |
337 |
|
'sboFW') testoutput_var $1 "sbo_mass_fw" "SBO m-FW" $2 $refoutp ; yy=$? ;; |
338 |
|
'sboAc') testoutput_var $1 "sbo_zoamc" "SBO AM-C" $2 $refoutp ; yy=$? ;; |
339 |
|
'sboAp') testoutput_var $1 "sbo_zoamp" "SBO AM-P" $2 $refoutp ; yy=$? ;; |
340 |
|
'StrmIc') testoutput_var $1 "STREAMICE_FP_ERR" "StreamIce Solver" $2 $refoutp ; yy=$? ;; |
341 |
|
*) yy=99; echo "WARNING: asking for var=$xx : not recognized !" 1>&2 ;; |
342 |
|
esac |
343 |
|
if test $xx = $sVar |
344 |
|
then allargs="$allargs > $yy <" |
345 |
|
else allargs="$allargs $yy" |
346 |
|
fi |
347 |
done |
done |
348 |
|
|
349 |
allargs="$cg2dres $tmin $tmax $tmean $tsd $smin $smax $smean $ssd" |
nbVar=`echo $listVar | awk '{print NF}'` |
350 |
allargs="$allargs $umin $umax $umean $usd $vmin $vmax $vmean $vsd" |
if [ $nbVar -lt $LEN_CHECK_LIST ] ; then |
351 |
allargs="$allargs $p01_min $p01_max $p01_mean $p01_sd" |
#-- fill line (up to standard length) with dot: |
352 |
allargs="$allargs $p02_min $p02_max $p02_mean $p02_sd" |
adNul=`expr $LEN_CHECK_LIST - $nbVar | awk '{for(i=1;i<=$1;i++){print "."}}'` |
353 |
allargs="$allargs $p03_min $p03_max $p03_mean $p03_sd" |
echo $allargs $adNul |
354 |
allargs="$allargs $p04_min $p04_max $p04_mean $p04_sd" |
else |
355 |
allargs="$allargs $p05_min $p05_max $p05_mean $p05_sd" |
echo $allargs |
356 |
|
fi |
357 |
eval "dashnum $allargs" |
# <-- same processing for adjoint & forward test |
|
|
|
|
else |
|
|
testoutput_ad $1 $2 "precision_grdchk_result" |
|
|
fi |
|
358 |
} |
} |
359 |
|
|
360 |
genmakemodel() |
genmakemodel() |
371 |
( |
( |
372 |
cd $1; |
cd $1; |
373 |
command="$GENMAKE2 -ds -m $MAKE" |
command="$GENMAKE2 -ds -m $MAKE" |
374 |
if test "x$ADM" = x ; then |
if test "x$MKDEPEND" != x ; then |
375 |
command="$command --mods=../code" |
command="$command -makedepend=$MKDEPEND" |
376 |
|
fi |
377 |
|
if test $KIND = 4 ; then |
378 |
|
command="$command -oad -mods=../$code_dir" |
379 |
else |
else |
380 |
command="$command --mods=../code_ad" |
command="$command -mods=../$code_dir" |
|
command="$command -adof=../../../tools/adjoint_options/adjoint_staf" |
|
381 |
fi |
fi |
382 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
383 |
command="$command --optfile=$OPTFILE" |
command="$command -optfile=$OPTFILE" |
384 |
fi |
fi |
385 |
if test "x$IEEE" != x ; then |
if test $OptLev = 1 ; then |
386 |
command="$command -ieee" |
command="$command -ieee" |
387 |
fi |
fi |
388 |
if test "x$MPI" = xt ; then |
if test $OptLev = 0 ; then |
389 |
|
command="$command -devel" |
390 |
|
fi |
391 |
|
if test "x$GSL" = xt ; then |
392 |
|
command="$command -gsl" |
393 |
|
fi |
394 |
|
if test "x$MPI" != x0 ; then |
395 |
command="$command -mpi" |
command="$command -mpi" |
396 |
fi |
fi |
397 |
printf 'genmake ... ' 1>&2 |
if test "x$MULTI_THREAD" = xt ; then |
398 |
$command > make.log 2>&1 |
#- run multi-threaded using OpenMP: |
399 |
|
command="$command -omp" |
400 |
|
fi |
401 |
|
if test "x$USE_R4" = xt ; then |
402 |
|
command="$command -use_r4" |
403 |
|
fi |
404 |
|
if test "x$EXTRFLG" != x ; then |
405 |
|
command="$command -extra_flag $EXTRFLG" |
406 |
|
fi |
407 |
|
if test "x$NOCATAD" = xt ; then |
408 |
|
command="$command -nocat4ad" |
409 |
|
fi |
410 |
|
if test "x$TS" = xt ; then |
411 |
|
command="$command -ts" |
412 |
|
fi |
413 |
|
if test "x$PAPIS" = xt ; then |
414 |
|
command="$command -papis" |
415 |
|
else |
416 |
|
if test "x$PCLS" = xt ; then |
417 |
|
command="$command -pcls" |
418 |
|
fi |
419 |
|
fi |
420 |
|
printf 'genmake ... ' |
421 |
|
eval $command > genmake.tr_log 2>&1 |
422 |
RETVAL=$? |
RETVAL=$? |
423 |
# Reduce the size of the testing emails! |
# Reduce the size of the testing emails! |
424 |
head -100 Makefile > $CDIR/Makefile_head |
head -100 Makefile > $CDIR/Makefile_head |
425 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
426 |
tail make.log |
tail genmake.tr_log |
427 |
echo "genmakemodel: genmake failed" 1>&2 |
echo "genmakemodel: genmake failed" |
428 |
cp genmake_* make.log $CDIR |
cp genmake.log genmake_* genmake.tr_log $CDIR |
429 |
return 1 |
return 1 |
430 |
else |
else |
431 |
echo "successful" 1>&2 |
echo "successful" |
432 |
fi |
fi |
433 |
) |
) |
434 |
fi |
fi |
437 |
makeclean() |
makeclean() |
438 |
{ |
{ |
439 |
# makeclean directory |
# makeclean directory |
440 |
|
if test "x$NOGENMAKE" = xf ; then rm -f $1/make.tr_log ; fi |
441 |
if test "x$NOCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
442 |
echo "make CLEAN skipped!" |
echo "make Clean skipped!" |
443 |
else |
else |
444 |
( |
( |
445 |
cd $1; |
cd $1; |
446 |
if test -e output.txt ; then |
#if test -e $OUTPUTFILE ; then rm -f $OUTPUTFILE ; fi |
|
rm -f output.txt |
|
|
fi |
|
|
printf 'make CLEAN ... ' 2>&1 |
|
447 |
if test -r Makefile ; then |
if test -r Makefile ; then |
448 |
$MAKE CLEAN >> make.log 2>&1 |
printf 'clean build-dir: make Clean ... ' |
449 |
|
$MAKE Clean >> make.tr_log 2>&1 |
450 |
RETVAL=$? |
RETVAL=$? |
451 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
452 |
tail make.log |
tail make.tr_log |
453 |
echo "makeclean: \"make CLEAN\" failed" 1>&2 |
echo "makeclean: \"make Clean\" failed" |
454 |
cp make.log $CDIR"/make.log" |
cp make.tr_log genmake.log genmake.tr_log $CDIR |
455 |
return 1 |
return 1 |
456 |
fi |
fi |
457 |
|
echo successful |
458 |
|
else |
459 |
|
echo '' |
460 |
fi |
fi |
|
echo successful 1>&2 |
|
461 |
exit 0 |
exit 0 |
462 |
) |
) |
463 |
fi |
fi |
464 |
} |
} |
465 |
|
|
466 |
postclean() |
run_clean() |
467 |
{ |
{ |
468 |
# postclean directory |
# run_clean directory |
469 |
if test "x$POSTCLEAN" = xt ; then |
if test "x$NOCLEAN" = xt ; then |
470 |
( |
echo "run_clean skipped!" |
471 |
cd $1; |
else |
472 |
if test -r Makefile ; then |
( |
473 |
$MAKE CLEAN >> /dev/null 2>&1 |
cd $1; |
474 |
fi |
printf 'clean run-dir ... ' |
475 |
exit 0 |
# part of what is done after "make clean" when doing "make CLEAN" |
476 |
) |
find . -name "*.meta" -exec rm {} \; |
477 |
|
find . -name "*.data" -exec rm {} \; |
478 |
|
find . -name "fort.*" -exec rm {} \; |
479 |
|
find . -type l -exec rm {} \; |
480 |
|
#- should remove executable only if sym-link (already done above) |
481 |
|
rm -f $RUNLOG *.txt STDOUT.* STDERR.* *diagnostics.log *.[0-9][0-9][0-9][0-9].log |
482 |
|
rm -f datetime costfinal divided.ctrl snapshot* output_adm.*.diva_* |
483 |
|
rm -f *_MIT_CE_000.opt0000 costfunction*0000 |
484 |
|
rm -f oad_cp.[0-9][0-9][0-9].????? |
485 |
|
rm -rf mnc_test_* |
486 |
|
echo successful |
487 |
|
exit 0 |
488 |
|
) |
489 |
fi |
fi |
490 |
} |
} |
491 |
|
|
497 |
else |
else |
498 |
( |
( |
499 |
cd $1; |
cd $1; |
500 |
printf 'make depend ... ' 1>&2 |
printf 'make depend ... ' |
501 |
$MAKE depend >> make.log 2>&1 |
$MAKE depend >> make.tr_log 2>&1 |
502 |
RETVAL=$? |
RETVAL=$? |
503 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
504 |
tail make.log |
tail make.tr_log |
505 |
echo "makedependmodel: make depend failed" 1>&2 |
echo "makedependmodel: make depend failed" |
506 |
cp make.log $CDIR"/make.log" |
cp make.tr_log genmake.log genmake.tr_log $CDIR |
507 |
return 1 |
return 1 |
508 |
else |
else |
509 |
echo successful 1>&2 |
echo successful |
510 |
fi |
fi |
511 |
) |
) |
512 |
fi |
fi |
516 |
{ |
{ |
517 |
# makemodel directory |
# makemodel directory |
518 |
( |
( |
519 |
|
mk_fail=0 |
520 |
|
if test "x$NOMAKE" = xt ; then |
521 |
|
cd $1; |
522 |
|
if test -x $EXECUTABLE ; then |
523 |
|
echo "make skipped!" |
524 |
|
else |
525 |
|
echo "no executable!" |
526 |
|
mk_fail=3 |
527 |
|
fi |
528 |
|
else |
529 |
cd $1; |
cd $1; |
530 |
if test -r Makefile ; then |
if test -r Makefile ; then |
531 |
printf 'make ... ' 1>&2 |
if test "x$MKSMALLF" = xt ; then |
532 |
if test "x$ADM" = x ; then |
printf 'make small_f ... ' |
533 |
if test "x$JOBS" = x ; then |
$MAKE_CMD small_f >> make.tr_log 2>&1 |
534 |
$MAKE >> make.log 2>&1 |
RETVAL=$? |
535 |
|
if test "x$RETVAL" != x0 ; then |
536 |
|
tail make.tr_log |
537 |
|
echo failed |
538 |
|
cp genmake.log genmake.tr_log $CDIR |
539 |
|
tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail" |
540 |
|
rm -f $EXECUTABLE |
541 |
|
mk_fail=1 |
542 |
else |
else |
543 |
$MAKE -j $JOBS >> make.log 2>&1 |
echo successful |
544 |
fi |
fi |
|
else |
|
|
$MAKE adall >> make.log 2>&1 |
|
545 |
fi |
fi |
546 |
|
printf 'make ... ' |
547 |
|
$MAKE_CMD $TARG >> make.tr_log 2>&1 |
548 |
RETVAL=$? |
RETVAL=$? |
549 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
550 |
tail make.log |
tail make.tr_log |
551 |
echo failed 1>&2 |
echo failed |
552 |
cp make.log $CDIR"/make.log" |
cp genmake.log genmake.tr_log $CDIR |
553 |
return 1 |
tail -$NBLINES_MKLOG make.tr_log > $CDIR"/make.tr_log_tail" |
554 |
|
rm -f $EXECUTABLE |
555 |
|
mk_fail=1 |
556 |
else |
else |
557 |
echo successful 1>&2 |
echo successful |
558 |
fi |
fi |
559 |
|
else |
560 |
|
echo "no Makefile !" |
561 |
|
mk_fail=2 |
562 |
|
fi |
563 |
|
fi |
564 |
|
if test $KIND = 1 -a -f taf_ftl.log ; then |
565 |
|
head -1 taf_ftl.log >> $CDIR"/summary.txt" |
566 |
|
fi |
567 |
|
if test $KIND = 2 -a -f taf_ad.log ; then |
568 |
|
head -1 taf_ad.log >> $CDIR"/summary.txt" |
569 |
|
nerr=`grep -c 'TAF *.* ERROR ' taf_ad.log` |
570 |
|
nwar=`grep -c 'TAF RECOMPUTATION *.* WARNING ' taf_ad.log` |
571 |
|
if test -f taf_output ; then |
572 |
|
n2er=`grep -c 'TAF *.* ERROR ' taf_output` |
573 |
|
n3er=`grep -c '\*ERROR\* ' taf_output` |
574 |
|
nerr=`expr $nerr + $n2er + $n3er` |
575 |
fi |
fi |
576 |
|
echo " TAF reports $nerr Errors and $nwar Recomputation Warnings" \ |
577 |
|
>> $CDIR"/summary.txt" |
578 |
|
fi |
579 |
|
if test $mk_fail != 0 ; then return $mk_fail ; fi |
580 |
) |
) |
581 |
} |
} |
582 |
|
|
583 |
|
mk_mpi_size() |
584 |
|
{ |
585 |
|
# mk_mpi_size input_file output_file proc_Nb threads_Nb_X threads_Nb_Y |
586 |
|
# |
587 |
|
# make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file) |
588 |
|
# for an MPI build with no more than proc_Nb processors ; |
589 |
|
# ensure that enough tiles per proc (nSx,nSy) remain for the given |
590 |
|
# number of threads (nTx,nTy) ; |
591 |
|
# return the effective number of processors. |
592 |
|
|
593 |
|
inp=$1 |
594 |
|
out=$2 |
595 |
|
np=$3 |
596 |
|
tx=$4 |
597 |
|
ty=$5 |
598 |
|
tmp=TTT.$$ |
599 |
|
|
600 |
|
# dirX : select with direction to favor in MPI process repartition |
601 |
|
# dirX=1 : prefer to put more proc in X direction |
602 |
|
# dirX=0 : prefer to put more proc in Y direction |
603 |
|
dirX=0 |
604 |
|
|
605 |
|
px=`grep "^ & *nPx *=" $inp | sed "s/^ & *nPx *= *//" | sed 's/, *$//'` |
606 |
|
py=`grep "^ & *nPy *=" $inp | sed "s/^ & *nPy *= *//" | sed 's/, *$//'` |
607 |
|
sx=`grep "^ & *nSx *=" $inp | sed "s/^ & *nSx *= *//" | sed 's/, *$//'` |
608 |
|
sy=`grep "^ & *nSy *=" $inp | sed "s/^ & *nSy *= *//" | sed 's/, *$//'` |
609 |
|
|
610 |
|
#- for each direction, assume # of threads is a multiple of total number of tiles |
611 |
|
nx=$px |
612 |
|
if [ `expr $sx % $tx` -ne 0 -a `expr $sx \* $px % $tx` -eq 0 ] ; then |
613 |
|
nx=`expr $sx \* $px / $tx` |
614 |
|
if [ $verbose -gt 1 ]; then |
615 |
|
echo " change px from $px to $nx to accommodate $tx threads" |
616 |
|
fi |
617 |
|
fi |
618 |
|
ny=$py |
619 |
|
if [ `expr $sy % $ty` -ne 0 -a `expr $sy \* $py % $ty` -eq 0 ] ; then |
620 |
|
ny=`expr $sy \* $py / $ty` |
621 |
|
if [ $verbose -gt 1 ]; then |
622 |
|
echo " change py from $py to $ny to accommodate $ty threads" |
623 |
|
fi |
624 |
|
fi |
625 |
|
#- find the largest divisor of input_file proc Nb, but not larger than $np |
626 |
|
pp=0 |
627 |
|
i=1 |
628 |
|
while [ $i -le $nx ] ; do |
629 |
|
if [ `expr $nx % $i` -eq 0 ] ; then |
630 |
|
j=1 |
631 |
|
while [ $j -le $ny ] ; do |
632 |
|
if [ `expr $ny % $j` -eq 0 ] ; then |
633 |
|
ij=`expr $i \* $j` |
634 |
|
if [ $ij -gt $pp ] ; then |
635 |
|
flag=1 |
636 |
|
elif [ $ij -eq $pp ] ; then |
637 |
|
flag=$dirX |
638 |
|
else |
639 |
|
flag=0 |
640 |
|
fi |
641 |
|
if test $flag = 1 ; then |
642 |
|
if [ $ij -le $np ] ; then |
643 |
|
ix=$i ; jy=$j ; pp=$ij |
644 |
|
#echo " ix,jy= $ix,$jy" |
645 |
|
fi |
646 |
|
fi |
647 |
|
fi |
648 |
|
j=`expr $j + 1` |
649 |
|
done |
650 |
|
fi |
651 |
|
i=`expr $i + 1` |
652 |
|
done |
653 |
|
|
654 |
|
#- create new SIZE.h type file: |
655 |
|
sx=`expr $sx \* $px / $ix` |
656 |
|
sy=`expr $sy \* $py / $jy` |
657 |
|
if [ $verbose -gt 1 ]; then |
658 |
|
echo " px,py,np= $px,$py,$np : New MPI size: px,py= $ix,$jy : sx,sy= $sx,$sy" |
659 |
|
fi |
660 |
|
sed "/^ \& *nPx *=/s/[0-9]*,/$ix,/" $inp > $tmp |
661 |
|
sed "/^ \& *nPy *=/s/[0-9]*,/$jy,/" $tmp > $out |
662 |
|
sed "/^ \& *nSx *=/s/[0-9]*,/$sx,/" $out > $tmp |
663 |
|
sed "/^ \& *nSy *=/s/[0-9]*,/$sy,/" $tmp > $out |
664 |
|
rm -f $tmp |
665 |
|
return $pp |
666 |
|
} |
667 |
|
|
668 |
symlink_mpifiles() |
symlink_mpifiles() |
669 |
{ |
{ |
670 |
# Put special links so that MPI specific files are used |
# Put special links so that MPI specific files are used |
673 |
|
|
674 |
dir=$1 |
dir=$1 |
675 |
code_dir=$2 |
code_dir=$2 |
676 |
BUILD_DIR=$dir/$3 |
build_dir=$dir/$3 |
677 |
CODE_DIR=$dir/$code_dir |
|
|
|
|
678 |
# These are files that should replace their counter-part when using -mpi |
# These are files that should replace their counter-part when using -mpi |
679 |
MPI_FILES=`(cd $CODE_DIR; find . -name "*_mpi")` |
MPI_FILES=`(cd $dir/$code_dir; find . -name "*_mpi" -print)` |
680 |
|
|
681 |
# Is this an MPI run? |
for ii in $MPI_FILES ; do |
682 |
if test "x$MPI" = xt ; then |
i=`echo $ii | sed 's:^\./::'` |
683 |
# YES: We symbolically link these files to the build |
name=`echo $i | sed 's:_mpi::'` |
684 |
# dir so long as there is no real file in place |
file="../$code_dir/$i" |
685 |
for ii in $MPI_FILES ; do |
if test $name = 'SIZE.h' ; then file="SIZE.h.mpi" ; fi |
686 |
i=`echo $ii | sed 's:^\./::'` |
|
687 |
name=`echo $i | sed 's:_mpi::' ` |
# Is this an MPI run? |
688 |
cmp $CODE_DIR/$i $BUILD_DIR/$name > /dev/null 2>&1 |
if test "x$MPI" = x0 ; then |
689 |
RETVAL=$? |
# NO: We undo any _mpi symbolically linked files |
690 |
if test "x$RETVAL" != x0 ; then |
if test -L $build_dir/$name ; then |
691 |
if ! test -f $BUILD_DIR/$i ; then |
( cd $build_dir ; cmp $name $file > /dev/null 2>&1 ) |
|
#echo Linking $name to $i |
|
|
(cd $BUILD_DIR; ln -sf ../$code_dir/$i $name) |
|
|
fi |
|
|
fi |
|
|
done |
|
|
else |
|
|
# NO: We undo any _mpi symbolically linked files |
|
|
for ii in $MPI_FILES ; do |
|
|
i=`echo $ii | sed 's:^\./::'` |
|
|
name=`echo $i | sed 's:_mpi::' ` |
|
|
if test -L $BUILD_DIR/$name ; then |
|
|
cmp $BUILD_DIR/$name "../$code_dir/$name"_mpi > /dev/null 2>&1 |
|
692 |
RETVAL=$? |
RETVAL=$? |
693 |
if test "x$RETVAL" = x0 ; then |
if test "x$RETVAL" = x0 ; then |
694 |
#echo Un-linking $name from $linktarg |
if [ $verbose -gt 1 ]; then |
695 |
rm -f $BUILD_DIR/$name |
echo " Un-linking $name from ../$code_dir" ; fi |
696 |
|
rm -f $build_dir/$name |
697 |
fi |
fi |
698 |
fi |
fi |
699 |
done |
else |
700 |
fi |
# YES: We symbolically link these files to the build |
701 |
|
# dir so long as there is no real file in place |
702 |
|
( cd $build_dir ; cmp $name $file > /dev/null 2>&1 ) |
703 |
|
RETVAL=$? |
704 |
|
if [ $verbose -gt 1 ]; then echo " cmp $name $file returns: $RETVAL" ; fi |
705 |
|
if test "x$RETVAL" != x0 ; then |
706 |
|
if test -h $build_dir/$name ; then rm -f $build_dir/$name ; fi |
707 |
|
if test ! -r $build_dir/$name ; then |
708 |
|
if [ $verbose -gt 1 ]; then echo " Linking $name to $file" ; fi |
709 |
|
(cd $build_dir; ln -sf $file $name) |
710 |
|
fi |
711 |
|
fi |
712 |
|
fi |
713 |
|
done |
714 |
} |
} |
715 |
|
|
716 |
linkdata() |
linkdata() |
717 |
{ |
{ |
718 |
# linkdata flag |
# linkdata run_dir input_dir_1 input_dir_2 ... |
719 |
# |
# |
720 |
# symbolically link data files to run directory |
# symbolically link data files to run directory |
721 |
if test "x$1" = x1 ; then |
if test -d $1 ; then |
722 |
( |
( |
723 |
cd $2 |
cd $1 ; shift |
724 |
if test "x$ADM" = x ; then |
echo 'linkdata from dirs:' $* |
725 |
files=`( cd ../input ; ls -1 | grep -v CVS )` |
inpMPI=`(cd ../$1 ; find . -name "*.mpi" -print | sed 's:^\./::')` |
726 |
for i in $files ; do |
for xx in $inpMPI ; do |
727 |
if test ! -d "../input/"$i -a ! -f $i ; then |
if test -r "../"$1"/"$xx ; then |
728 |
ln -sf "../input/"$i $i |
# found 1 _mpi sfx file in 1rst input dir and it is readable |
729 |
fi |
yy=`echo $xx | sed 's:\.mpi$::'` |
730 |
done |
if test "x$MPI" = "x0" ; then |
731 |
else |
# not mpi test: remove symbolic link |
732 |
files=`( cd ../input ; ls -1 *.bin | grep -v CVS )` |
if test -h $yy ; then rm -f $yy ; fi |
733 |
for i in $files ; do |
else |
734 |
if test ! -d "../input/"$i ; then |
# mpi test: remove symbolic link & link .mpi sfx file |
735 |
ln -sf "../input/"$i $i |
if test -h $yy ; then rm -f $yy ; fi |
736 |
|
if test ! -r $yy ; then |
737 |
|
ln -sf "../"$1"/"$xx $yy ; |
738 |
|
printf " $xx" 1>&2 |
739 |
fi |
fi |
740 |
done |
fi |
741 |
files=`( cd ../input_ad ; ls -1 | grep -v CVS )` |
fi |
742 |
for i in $files ; do |
done |
743 |
if test ! -d "../input_ad/"$i ; then |
if test -r "../"$1"/eedata.mth" ; then |
744 |
ln -sf "../input_ad/"$i $i |
# found eedata.mth in 1rst input dir and it is readable |
745 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
746 |
|
# multi-threaded test: remove symbolic link & link eedata.mth |
747 |
|
if test -h eedata ; then rm -f eedata ; fi |
748 |
|
if test ! -r eedata ; then |
749 |
|
ln -sf "../"$1"/eedata.mth" eedata ; |
750 |
|
printf ' eedata.mth' 1>&2 |
751 |
fi |
fi |
752 |
done |
else |
753 |
|
# not multi-threaded test: remove eedata symbolic link |
754 |
|
if test -h eedata ; then rm -f eedata ; fi |
755 |
|
fi |
756 |
fi |
fi |
757 |
|
prevDir='NONE' |
758 |
|
for ldir in $* ; do |
759 |
|
if test -d "../"$ldir -a $ldir != $prevDir ; then |
760 |
|
printf " ldir=${ldir}:" 1>&2 |
761 |
|
files=`( cd "../"$ldir ; ls -1 | grep -v CVS )` |
762 |
|
for i in $files ; do |
763 |
|
if test ! -d "../"$ldir/$i ; then |
764 |
|
if test ! -r $i ; then |
765 |
|
printf ' '$i 1>&2 |
766 |
|
ln -sf "../"$ldir"/"$i $i |
767 |
|
fi |
768 |
|
fi |
769 |
|
done |
770 |
|
printf ' ;' 1>&2 |
771 |
|
if test -x "../"$ldir"/"prepare_run ; then |
772 |
|
"../"$ldir"/"prepare_run 1>&2 |
773 |
|
else |
774 |
|
echo '' 1>&2 |
775 |
|
fi |
776 |
|
fi |
777 |
|
prevDir=$ldir |
778 |
|
done |
779 |
) |
) |
780 |
fi |
fi |
781 |
} |
} |
784 |
{ |
{ |
785 |
# runmodel directory |
# runmodel directory |
786 |
# |
# |
787 |
# runs "$COMMAND in "directory" |
# runs $COMMAND in "directory" |
788 |
# (where "$COMMAND" is relative to "directory") |
# (where "$COMMAND" is relative to "directory") |
789 |
( |
( |
790 |
cd $1 |
cd $1 |
791 |
printf 'runmodel in %s ...' $1 1>&2 |
printf 'runmodel in %s ... ' $1 |
792 |
# make output.txt |
if test "x$MPI" != x0 ; then |
793 |
echo |
#- adjust the MPI run command with the right number of Procs |
794 |
rm -f run.log |
#echo '' ; echo " COMMAND='$COMMAND'" |
795 |
if test $OUTPUTFILE -ot $EXECUTABLE ; then |
COMMAND=`echo $COMMAND | sed "s/ TR_NPROC/ $LOC_NPROC/"` |
796 |
( eval $COMMAND ) > run.log 2>&1 |
if test "x$MPI_MFILE" != x ; then |
797 |
RETVAL=$? |
COMMAND=`echo $COMMAND | sed "s/ TR_MFILE / ..\/..\/$LOC_MFILE /"` |
798 |
|
fi |
799 |
|
#echo " COMMAND='$COMMAND'" |
800 |
|
fi |
801 |
|
if test -L $EXECUTABLE ; then |
802 |
|
if test -x "../"$builddir"/"$EXECUTABLE ; then |
803 |
|
cmp $EXECUTABLE "../"$builddir"/"$EXECUTABLE > /dev/null 2>&1 |
804 |
|
outD=$? ; if test "x$outD" != x0 ; then rm -f $EXECUTABLE ; fi |
805 |
|
else rm -f $EXECUTABLE |
806 |
|
fi |
807 |
|
fi |
808 |
|
if test ! -x $EXECUTABLE -a -x "../"$builddir"/"$EXECUTABLE ; then |
809 |
|
echo " link" $EXECUTABLE "from dir ../"$builddir > run.log_tmp |
810 |
|
ln -sf "../"$builddir"/"$EXECUTABLE . |
811 |
|
fi |
812 |
|
if test ! -x $EXECUTABLE ; then |
813 |
|
rm -f $RUNLOG ; touch $RUNLOG |
814 |
|
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
815 |
|
echo " no executable:" $EXECUTABLE >> $RUNLOG |
816 |
|
RETVAL=8 |
817 |
|
ENDVAL=-1 |
818 |
else |
else |
819 |
echo " $OUTPUTFILE is up to date " > run.log 2>&1 |
if test ! -f $OUTPUTFILE -o $OUTPUTFILE -ot $EXECUTABLE ; then |
820 |
RETVAL=0 |
# output do not exist or is older than executable: |
821 |
|
rm -f $OUTPUTFILE $RUNLOG ; touch $RUNLOG |
822 |
|
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
823 |
|
#- Divided Adjoint Run: |
824 |
|
# get the number of additional runs (add_DIVA_runs) from file "run_ADM_DIVA" |
825 |
|
if test $KIND = 2 -a -f run_ADM_DIVA ; then |
826 |
|
adm_diva_nb=`sed -n '/^ *add_DIVA_runs\>.*=/p' run_ADM_DIVA | sed 's/ //g'` |
827 |
|
echo " Divided Adjoint Run: $adm_diva_nb" >> $RUNLOG |
828 |
|
eval "let $adm_diva_nb" |
829 |
|
if [ $add_DIVA_runs -ge 1 ] ; then |
830 |
|
rm -f costf* divided.ctrl snapshot* |
831 |
|
echo -n "(add_DIVA_runs=$add_DIVA_runs) ... " |
832 |
|
for ii in `seq 1 $add_DIVA_runs` ; do |
833 |
|
( eval $COMMAND ) >> $RUNLOG 2>&1 |
834 |
|
echo " additional DIVA run # $ii : done" >> $RUNLOG |
835 |
|
mv -f $OUTPUTFILE ${OUTPUTFILE}.diva_${ii} |
836 |
|
done |
837 |
|
fi |
838 |
|
fi |
839 |
|
#- special DIVA processing ends here |
840 |
|
( eval $COMMAND ) >> $RUNLOG 2>&1 |
841 |
|
RETVAL=$? |
842 |
|
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
843 |
|
if [ $POSTCLEAN -eq 1 -a $ENDVAL -gt 0 ] ; then |
844 |
|
find . -name "*.meta" -exec rm {} \; |
845 |
|
find . -name "*.data" -exec rm {} \; |
846 |
|
rm -rf mnc_test_* |
847 |
|
fi |
848 |
|
else |
849 |
|
RETVAL=0 |
850 |
|
ENDVAL=`tail $OUTPUTFILE | grep -c 'PROGRAM MAIN: Execution ended Normally'` |
851 |
|
touch $RUNLOG |
852 |
|
if test -f run.log_tmp ; then cat run.log_tmp >> $RUNLOG ; fi |
853 |
|
echo "---------->> $OUTPUTFILE is up to date " >> $RUNLOG 2>&1 |
854 |
|
fi |
855 |
|
fi |
856 |
|
rm -f run.log_tmp |
857 |
|
#- in all cases where OutputFile exists, report SIZE and time |
858 |
|
if test -f $OUTPUTFILE ; then |
859 |
|
grep '(PID\.TID 0000\.0001) n.. =' $OUTPUTFILE \ |
860 |
|
| sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
861 |
|
# grep -A3 'Seconds in section "ALL' $OUTPUTFILE \ |
862 |
|
# | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
863 |
|
# some implementations of grep cannot do contextual searches so we |
864 |
|
# replace the above with a sed command |
865 |
|
cat $OUTPUTFILE | sed -n '/Seconds in section "ALL/{N |
866 |
|
N |
867 |
|
N |
868 |
|
p |
869 |
|
}' | sed 's/(PID.TID 0000.0001) //' >> $CDIR"/summary.txt" |
870 |
fi |
fi |
871 |
# echo "COMMAND='$COMMAND'" |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
872 |
# echo "pwd='"`pwd`"'" |
if [ $RETVAL -eq 0 -a $ENDVAL -gt 0 ] ; then |
873 |
if test "x$RETVAL" = x0 ; then |
echo successful |
874 |
tail run.log |
printf '=> output from running in %s :\n' $1 1>&2 |
875 |
echo successful 1>&2 |
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
876 |
# === Reduce the size of the testing emails! |
return 0 |
877 |
# if test "x$ADM" = x ; then |
elif [ $RETVAL -ne 0 -a $ENDVAL -gt 0 ] ; then |
878 |
# cp output.txt $CDIR"/output.txt" |
#-- for some weird cases (run is finihed but with error code) |
879 |
# else |
echo 'finished with error (run:' $RETVAL ' end:' $ENDVAL ')' |
880 |
# cp output.txt_adm $CDIR"/output.txt_adm" |
printf '=> output from running in %s :\n' $1 1>&2 |
881 |
# fi |
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
|
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
|
882 |
return 0 |
return 0 |
883 |
else |
else |
884 |
tail run.log |
echo 'failed (run:' $RETVAL ' end:' $ENDVAL ')' |
885 |
echo failed 1>&2 |
printf '=> output from running in %s :\n' $1 1>&2 |
886 |
cp run.log $CDIR"/run.log" |
tail $RUNLOG | sed 's/^.*/> &/g' 1>&2 |
887 |
if test -s STDERR.0000 ; then cp STDERR.0000 $CDIR"/STDERR.0000" ; fi |
cp $RUNLOG $CDIR"/"$RUNLOG |
888 |
return 1 |
return 1 |
889 |
fi |
fi |
890 |
) |
) |
894 |
{ |
{ |
895 |
# create codelet for comparing model output |
# create codelet for comparing model output |
896 |
|
|
897 |
printf "creating the comparison code... " |
printf "creating the comparison code (using CC=$CC)... " |
898 |
cat > tmp_cmpnum.c <<EOF |
cat > tr_cmpnum.c <<EOF |
899 |
#include <stdio.h> |
#include <stdio.h> |
900 |
#include <math.h> |
#include <math.h> |
901 |
int main( int argc, char** argv ) { |
int main( int argc, char** argv ) { |
902 |
int linnum,best,lncnt; |
int linnum,cmplin,best,lncnt; |
903 |
double a,b,abave,relerr; |
double a,b,abave,relerr; |
904 |
best = -22; |
best = -22; |
905 |
lncnt = 0; |
lncnt = 0; |
906 |
while( 1 & (lncnt+=1) < 999 ) { |
while( 1 & ( (lncnt+=1) < 999 ) ) { |
907 |
scanf("%d", &linnum); |
scanf("%d", &linnum); |
908 |
if (linnum == -1) break; |
if (linnum == -1) break; |
909 |
scanf("%lf", &a); scanf("%lf", &b); |
scanf("%lf", &a); scanf("%lf", &b); |
910 |
abave = 0.5*(fabs(a)+fabs(b)); |
abave = 0.5*(fabs(a)+fabs(b)); |
911 |
if (abave > 0.0) { |
if ( abave == abave ) { |
912 |
relerr=fabs(a-b)/abave; |
if (abave > 0.0) { |
913 |
if (relerr > 0.0) { linnum = (int)rint(log10(relerr)); } |
relerr=fabs(a-b)/abave; |
914 |
else { linnum = -16 ; } |
if (relerr > 0.0) { cmplin = (int)rint(log10(relerr)); } |
915 |
best = (best > linnum) ? best : linnum; |
else { cmplin = -16 ; } |
916 |
} |
best = (best > cmplin) ? best : cmplin; } |
917 |
|
else { cmplin = -22 ; } |
918 |
|
/* printf("%d ; %lf ; %lf\n",cmplin,a,b); */ |
919 |
|
} |
920 |
|
else { |
921 |
|
/* printf("%lf ; %lf ; %lf\n",abave,a,b); */ |
922 |
|
break; } |
923 |
} |
} |
924 |
if (lncnt == 999) best=-29; |
if (lncnt == 999) best=-29; |
925 |
|
if (linnum != -1) best=-99; |
926 |
printf("%d\n", -best); |
printf("%d\n", -best); |
927 |
return 0; |
return 0; |
928 |
} |
} |
929 |
EOF |
EOF |
930 |
$CC -o tmp_cmpnum tmp_cmpnum.c -lm |
$CC -o tr_cmpnum tr_cmpnum.c -lm |
931 |
|
|
932 |
if [ -x ./tmp_cmpnum ]; then |
if [ -x ./tr_cmpnum ]; then |
933 |
echo "OK" |
echo "OK" |
934 |
return 0 |
return 0 |
935 |
else |
else |
936 |
echo |
echo |
937 |
echo "ERROR: failed to compile comparison code -- please specify" |
echo "ERROR: failed to compile comparison code -- please specify" |
938 |
echo " a C compiler using the CC environment variable." |
echo " a C compiler using the CC environment variable." |
939 |
exit 1 |
exit 1 |
940 |
fi |
fi |
947 |
nm=$1 |
nm=$1 |
948 |
printf '%s %s %s %s' $2 $3 $4 $5 |
printf '%s %s %s %s' $2 $3 $4 $5 |
949 |
shift; shift; shift; shift; shift; |
shift; shift; shift; shift; shift; |
950 |
printf '%3s' $@ |
listPrt=$@ |
951 |
|
listRes=`echo $listPrt | sed 's/>//' | sed 's/<//'` |
952 |
if [ $1 = '--' ]; then |
xx=`echo $listPrt | sed 's/.*>//' | sed 's/<.*//' | awk '{print $1}'` |
953 |
|
printf '%3s' $listPrt |
954 |
|
# line below does not work on hp-ux_ia64 : do those substitutions later on |
955 |
|
# printf '%3s' $listPrt | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' |
956 |
|
|
957 |
|
if [ $xx = '..' ]; then |
958 |
|
printf ' N/O ' |
959 |
|
elif [ $xx = '--' ]; then |
960 |
|
printf ' N/O ' |
961 |
|
elif [ $xx = 99 ]; then |
962 |
printf ' N/O ' |
printf ' N/O ' |
963 |
else |
else |
964 |
if [ $1 -gt 12 ]; then |
if [ $xx -ge $MATCH_CRIT ]; then |
965 |
printf ' pass' |
printf ' pass' |
966 |
else |
else |
967 |
printf ' FAIL' |
printf ' FAIL' |
968 |
fi |
fi |
969 |
fi |
fi |
970 |
printf ' %s' $nm |
printf ' %s' $nm |
971 |
|
if test $KIND = 2 ; then |
972 |
|
#-- apppend taf repport summary: |
973 |
|
tafrep=`grep -c '^ TAF reports ' $CDIR/summary.txt` |
974 |
|
if test $tafrep = 1 ; then |
975 |
|
grep '^ TAF reports ' $CDIR/summary.txt | awk '{printf " (e=%i, w=%i)",$3,$6}' |
976 |
|
fi |
977 |
|
fi |
978 |
printf '\n' |
printf '\n' |
|
|
|
|
} |
|
|
|
|
|
show_help() |
|
|
{ |
|
|
cat - << EOF |
|
|
$0 [-help] [-quick] [-verbose] dir1 [dir2] [...] |
|
979 |
|
|
|
-help|-h Show this help message |
|
|
-quiet Reduce the amount of output |
|
|
-verbose Produce copious amounts of output |
|
|
-debug Produce even more output which will mean nothing to most |
|
|
-force Do "make CLEAN" before compiling. This forces a complete rebuild. |
|
|
-clean Do "make CLEAN" after compiling and testing. |
|
|
-cleanup Aggresively removes all model output, executables and object files |
|
|
and then exits. Use with care. |
|
|
|
|
|
Normal usage: |
|
|
$0 * Configure, compile, run and analyze in all experiment directories |
|
|
EOF |
|
980 |
} |
} |
981 |
|
|
982 |
scandirs() |
scandirs() |
983 |
{ |
{ |
984 |
if [ $# -eq 0 ]; then |
if [ $# -eq 1 ]; then |
985 |
for arg in * ; do |
for arg in * ; do |
986 |
test -d $arg/input && echo $arg |
#test -f $arg/$1 && echo $arg |
987 |
done |
test -f $arg/$1 -o -f $arg/$1.gz && echo $arg |
988 |
|
done |
989 |
else |
else |
990 |
echo $* |
echo $* |
991 |
fi |
fi |
992 |
} |
} |
993 |
|
|
994 |
|
|
995 |
|
check_eedata() |
996 |
|
{ |
997 |
|
# check_eedata eedata size.h |
998 |
|
if [ $# -eq 2 ] ; then |
999 |
|
if test -f $1 -a -f $2 ; then |
1000 |
|
nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
1001 |
|
sx=`grep "^ & *nSx *=" $2 | sed "s/^ & *nSx *=//" | sed 's/, *$//'` |
1002 |
|
if test "x$nx" = x ; then |
1003 |
|
rx=10 |
1004 |
|
else |
1005 |
|
rx=`expr $sx % $nx` |
1006 |
|
fi |
1007 |
|
ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
1008 |
|
sy=`grep "^ & *nSy *=" $2 | sed "s/^ & *nSy *=//" | sed 's/, *$//'` |
1009 |
|
if test "x$ny" = x ; then |
1010 |
|
ry=20 |
1011 |
|
else |
1012 |
|
ry=`expr $sy % $ny` |
1013 |
|
fi |
1014 |
|
echo `expr $rx + $ry` |
1015 |
|
else |
1016 |
|
echo '-1' |
1017 |
|
fi |
1018 |
|
elif [ $# -eq 1 ] ; then |
1019 |
|
if test -f $1 ; then |
1020 |
|
nx=`grep "^ *nTx *=" $1 | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
1021 |
|
if test "x$nx" = x ; then nx=1 ; fi |
1022 |
|
ny=`grep "^ *nTy *=" $1 | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
1023 |
|
if test "x$ny" = x ; then ny=1 ; fi |
1024 |
|
#echo $nx $ny |
1025 |
|
echo $nx |
1026 |
|
else |
1027 |
|
echo '-1' |
1028 |
|
fi |
1029 |
|
else |
1030 |
|
echo '-2' |
1031 |
|
fi |
1032 |
|
|
1033 |
|
} |
1034 |
|
|
1035 |
############################################################################### |
############################################################################### |
1036 |
|
|
1037 |
|
|
1038 |
# Default properties |
# Default properties |
1039 |
debug=0 |
debug=0 |
1040 |
verbose=1 |
verbose=1 |
1041 |
clean=0 |
NBLINES_MKLOG=16000 |
|
expts='' |
|
|
# ieee=1 |
|
|
|
|
|
IEEE=true |
|
|
if test "x$MITGCM_IEEE" != x ; then |
|
|
IEEE=$MITGCM_IEEE |
|
|
fi |
|
1042 |
|
|
1043 |
|
OptLev=1 |
1044 |
|
GSL=f |
1045 |
|
|
1046 |
CLEANUP=f |
CLEANUP=f |
1047 |
|
NORUN=f |
1048 |
QUICK=f |
QUICK=f |
1049 |
|
NOMAKE=f |
1050 |
NOGENMAKE=f |
NOGENMAKE=f |
1051 |
NOCLEAN=f |
NOCLEAN=f |
1052 |
NODEPEND=f |
NODEPEND=f |
1053 |
POSTCLEAN=f |
POSTCLEAN=0 |
1054 |
|
|
1055 |
BASH= |
BASH= |
1056 |
OPTFILE=NONE |
OPTFILE=NONE |
1057 |
ADDRESSES= |
ADDRESSES= |
1058 |
TESTDIRS= |
TESTDIRS= |
1059 |
|
SKIPDIRS= |
1060 |
MPACKDIR="../tools/mpack-1.6" |
MPACKDIR="../tools/mpack-1.6" |
1061 |
HAVE_MPACK= |
HAVE_MPACK= |
1062 |
MPACK="$MPACKDIR/mpack" |
MPACK= |
1063 |
|
SENDCMD= |
1064 |
|
SAVDIR='.' |
1065 |
COMMAND= |
COMMAND= |
1066 |
|
MKDEPEND= |
1067 |
if test "x$MAKE" = x ; then |
if test "x$MAKE" = x ; then |
1068 |
MAKE=make |
MAKE=make |
1069 |
fi |
fi |
1070 |
|
MAKE_CMD= |
1071 |
if test "x$CC" = x ; then |
if test "x$CC" = x ; then |
1072 |
CC=cc |
CC=cc |
1073 |
fi |
fi |
1074 |
JOBS= |
JOBS= |
1075 |
MPI=f |
TARG= |
1076 |
|
MPI=0 |
1077 |
|
MPI_MFILE= |
1078 |
|
MULTI_THREAD=f |
1079 |
OUTDIR= |
OUTDIR= |
1080 |
DELDIR= |
DELDIR= |
1081 |
|
USE_R4= |
1082 |
|
EXTRFLG= |
1083 |
|
NOCATAD= |
1084 |
|
MKSMALLF= |
1085 |
|
|
1086 |
|
#- type of testing (KIND): |
1087 |
|
# KIND=0 : forward (= default) ; KIND=1 : Tangent Linear with TAF ; |
1088 |
|
# KIND=2 : Adjoint with TAF ; KIND=4 : Adjoint with OpenAD |
1089 |
|
KIND=0 |
1090 |
|
|
1091 |
ADM= |
# list of pTracers to check for monitor output |
|
|
|
|
# Additional monitor types |
|
1092 |
PTRACERS_NUM="1 2 3 4 5" |
PTRACERS_NUM="1 2 3 4 5" |
1093 |
|
|
1094 |
|
MATCH_CRIT=10 |
1095 |
|
|
1096 |
printf "parsing options... " |
printf "parsing options... " |
1097 |
|
|
1098 |
ac_prev= |
ac_prev= |
1106 |
fi |
fi |
1107 |
|
|
1108 |
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
1109 |
|
|
1110 |
case $ac_option in |
case $ac_option in |
1111 |
|
|
1112 |
-help | --help | -h | --h) |
-help | --help | -h | --h) usage ;; |
|
usage ;; |
|
|
|
|
|
-optfile | --optfile | -of | --of) |
|
|
ac_prev=OPTFILE ;; |
|
|
-optfile=* | --optfile=* | -of=* | --of=*) |
|
|
OPTFILE=$ac_optarg ;; |
|
|
|
|
|
-addr | --addr | -a | --a) |
|
|
ac_prev=ADDRESSES ;; |
|
|
-addr=* | --addr=*) |
|
|
ADDRESSES=$ac_optarg ;; |
|
|
|
|
|
-tdir | --tdir | -t | --t) |
|
|
ac_prev=TESTDIRS ;; |
|
|
-tdir=* | --tdir=*) |
|
|
TESTDIRS=$ac_optarg ;; |
|
|
|
|
|
-bash | --bash | -b | --b) |
|
|
ac_prev=BASH ;; |
|
|
-bash=* | --bash=*) |
|
|
BASH=$ac_optarg ;; |
|
|
|
|
|
-command | --command | -c | --c) |
|
|
ac_prev=COMMAND ;; |
|
|
-command=* | --command=*) |
|
|
COMMAND=$ac_optarg ;; |
|
|
|
|
|
-make | --make | -m | --m) |
|
|
ac_prev=MAKE ;; |
|
|
-make=* | --make=*) |
|
|
MAKE=$ac_optarg ;; |
|
|
|
|
|
-odir | --odir) |
|
|
ac_prev=OUTDIR ;; |
|
|
-odir=* | --odir=*) |
|
|
OUTDIR=$ac_optarg ;; |
|
|
|
|
|
-ptracers | --ptracers | -ptr | --ptr) |
|
|
ac_prev=PTRACERS_NUM ;; |
|
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) |
|
|
PTRACERS_NUM=$ac_optarg ;; |
|
|
|
|
|
-j) ac_prev=JOBS ;; |
|
|
-j=*) JOBS=$ac_optarg ;; |
|
|
|
|
|
-clean | --clean) |
|
|
CLEANUP=t ; DELDIR=t ;; |
|
|
|
|
|
-quick | --quick | -q | --q) |
|
|
QUICK=t ;; |
|
|
-nogenmake | --nogenmake | -ng | --ng) |
|
|
NOGENMAKE=t ;; |
|
|
-noclean | --noclean | -nc | --nc) |
|
|
NOCLEAN=t ;; |
|
|
-nodepend | --nodepend | -nd | --nd) |
|
|
NODEPEND=t ;; |
|
|
|
|
|
-postclean | --postclean | -pc | --pc) |
|
|
POSTCLEAN=t ;; |
|
1113 |
|
|
1114 |
-mpi) MPI=t ;; |
-optfile | --optfile | -of | --of) ac_prev=OPTFILE ;; |
1115 |
|
-optfile=* | --optfile=* | -of=* | --of=*) OPTFILE=$ac_optarg ;; |
1116 |
|
|
1117 |
-adm | -ad) ADM=t ;; |
-addr | --addr | -a | --a) ac_prev=ADDRESSES ;; |
1118 |
|
-addr=* | --addr=* | -a=* | --a=*) ADDRESSES=$ac_optarg ;; |
1119 |
-ieee) IEEE=true ;; |
-mpackdir | --mpackdir | -mpd | --mpd) ac_prev=MPACKDIR ;; |
1120 |
-noieee) IEEE= ;; |
-mpackdir=* | --mpackdir=* | -mpd=* | --mpd=*) MPACKDIR=$ac_optarg ;; |
1121 |
|
|
1122 |
|
-send | --send ) ac_prev=SENDCMD ;; |
1123 |
|
-send=* | --send=* ) SENDCMD=$ac_optarg ;; |
1124 |
|
-savdir | --savdir | -sd | --sd ) ac_prev=SAVDIR ;; |
1125 |
|
-savdir=* | --savdir=* | -sd=* | --sd=* ) SAVDIR=$ac_optarg ;; |
1126 |
|
|
1127 |
|
-tdir | --tdir | -t | --t) ac_prev=TESTDIRS ;; |
1128 |
|
-tdir=* | --tdir=* | -t=* | --t=*) TESTDIRS=$ac_optarg ;; |
1129 |
|
-skipdir | --skipdir | -skd | --skd) ac_prev=SKIPDIRS ;; |
1130 |
|
-skipdir=* | --skipdir=* | -skd=* | --skd=*) SKIPDIRS=$ac_optarg ;; |
1131 |
|
|
1132 |
|
-bash | --bash | -b | --b) ac_prev=BASH ;; |
1133 |
|
-bash=* | --bash=* | -b=* | --b=*) BASH=$ac_optarg ;; |
1134 |
|
|
1135 |
|
-command | --command | -c | --c) ac_prev=COMMAND ;; |
1136 |
|
-command=* | --command=* | -c=* | --c=*) COMMAND=$ac_optarg ;; |
1137 |
|
|
1138 |
|
-makedepend | --makedepend | -md | --md) ac_prev=MKDEPEND ;; |
1139 |
|
-makedepend=* | --makedepend=* | -md=* | --md=*) MKDEPEND=$ac_optarg ;; |
1140 |
|
|
1141 |
|
-make | --make | -m | --m) ac_prev=MAKE ;; |
1142 |
|
-make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; |
1143 |
|
|
1144 |
|
-repl_mk | --repl_mk ) ac_prev=MAKE_CMD ;; |
1145 |
|
-repl_mk=* | --repl_mk=*) MAKE_CMD=$ac_optarg ;; |
1146 |
|
|
1147 |
|
-odir | --odir) ac_prev=OUTDIR ;; |
1148 |
|
-odir=* | --odir=*) OUTDIR=$ac_optarg ;; |
1149 |
|
|
1150 |
|
-ptracers | --ptracers | -ptr | --ptr) ac_prev=PTRACERS_NUM ;; |
1151 |
|
-ptracers=* | --ptracers=* | -ptr=* | --ptr=*) PTRACERS_NUM=$ac_optarg ;; |
1152 |
|
|
1153 |
|
-match | --match ) ac_prev=MATCH_CRIT ;; |
1154 |
|
-match=* | --match=* ) MATCH_CRIT=$ac_optarg ;; |
1155 |
|
|
1156 |
|
-j | --j) ac_prev=JOBS ;; |
1157 |
|
-j=* | --j=*) JOBS=$ac_optarg ;; |
1158 |
|
|
1159 |
|
-ef | --ef) ac_prev=EXTRFLG ;; |
1160 |
|
-ef=* | --ef=*) EXTRFLG=$ac_optarg ;; |
1161 |
|
|
1162 |
|
-clean | --clean) CLEANUP=t ; DELDIR=t ;; |
1163 |
|
|
1164 |
|
-norun | --norun | -nr | --nr) NORUN=t ;; |
1165 |
|
-obj | --obj ) TARG='obj' ; NORUN=t ;; |
1166 |
|
-runonly | --runonly | -ro | --ro) QUICK=t ; NOMAKE=t ;; |
1167 |
|
-quick | --quick | -q | --q) QUICK=t ;; |
1168 |
|
-nogenmake | --nogenmake | -ng | --ng) NOGENMAKE=t ;; |
1169 |
|
-noclean | --noclean | -nc | --nc) NOCLEAN=t ;; |
1170 |
|
-nodepend | --nodepend | -nd | --nd) NODEPEND=t ;; |
1171 |
|
|
1172 |
|
-postclean | --postclean | -pc | --pc) POSTCLEAN=2 ;; |
1173 |
|
-deloutp | --deloutp | -do | --do) POSTCLEAN=1 ;; |
1174 |
|
|
1175 |
|
-mpi | --mpi) MPI=2 ;; |
1176 |
|
-MPI | --MPI) ac_prev=MPI ;; |
1177 |
|
-MPI=* | --MPI=*) MPI=$ac_optarg ;; |
1178 |
|
|
1179 |
|
-mfile | --mfile | -mf | --mf) ac_prev=MPI_MFILE ;; |
1180 |
|
-mfile=* | --mfile=* | -mf=* | --mf=*) MPI_MFILE=$ac_optarg ;; |
1181 |
|
|
1182 |
|
-mth) MULTI_THREAD=t ;; |
1183 |
|
|
1184 |
|
-tlm) if test $KIND = 0 ; then KIND=1 ; else |
1185 |
|
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
1186 |
|
fi ;; |
1187 |
|
-adm | -ad) if test $KIND = 0 ; then KIND=2 ; else |
1188 |
|
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
1189 |
|
fi ;; |
1190 |
|
-oad) if test $KIND = 0 ; then KIND=4 ; NODEPEND=t ; else |
1191 |
|
echo "Error: '-tlm', '-adm' and '-oad' are exclusive" ; usage |
1192 |
|
fi ;; |
1193 |
|
-ncad) NOCATAD=t ;; |
1194 |
|
-small_f) MKSMALLF=t ;; |
1195 |
|
|
1196 |
|
-ieee) echo "Warning: ignore option '-ieee' (already the default)" |
1197 |
|
printf " ... " ;; |
1198 |
|
-noieee) echo "Warning: will use option '-fast' instead of '-noieee' (obsolete)" |
1199 |
|
printf " ... " ; OptLev=`expr $OptLev \* 2` ;; |
1200 |
|
-fast) OptLev=`expr $OptLev \* 2` ;; |
1201 |
|
-devel) OptLev=0 ;; |
1202 |
|
-gsl) GSL=t ;; |
1203 |
|
|
1204 |
-verbose) verbose=2 ;; |
-verbose) verbose=2 ;; |
1205 |
-debug) debug=1 ;; |
-debug) debug=1 ;; |
1207 |
|
|
1208 |
-deldir | -dd) DELDIR=t ;; |
-deldir | -dd) DELDIR=t ;; |
1209 |
|
|
1210 |
-*) |
-use_r4|-ur4) USE_R4=t ;; |
1211 |
echo "Error: unrecognized option: "$ac_option |
|
1212 |
usage |
-ts) TS=t;; |
1213 |
;; |
-papis) PAPIS=t;; |
1214 |
|
-pcls) PCLS=t;; |
1215 |
*) |
|
1216 |
echo "Error: unrecognized argument: "$ac_option |
-*) echo "Error: unrecognized option: "$ac_option |
1217 |
usage |
usage ;; |
1218 |
;; |
*) echo "Error: unrecognized argument: "$ac_option |
1219 |
|
usage ;; |
1220 |
|
|
1221 |
esac |
esac |
1222 |
|
|
1223 |
done |
done |
1224 |
|
|
1225 |
if test "x$QUICK" = xt ; then |
if test "x$QUICK" = xt ; then |
1227 |
NOCLEAN=t |
NOCLEAN=t |
1228 |
NODEPEND=t |
NODEPEND=t |
1229 |
fi |
fi |
1230 |
|
if test "x$MAKE_CMD" = x ; then MAKE_CMD=$MAKE ; fi |
1231 |
|
|
1232 |
|
#- check length of MPI machine file: |
1233 |
|
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then |
1234 |
|
if test -r $MPI_MFILE ; then |
1235 |
|
nl=`wc -l $MPI_MFILE | awk '{print $1}'` |
1236 |
|
if [ $nl -lt $MPI ] ; then |
1237 |
|
echo "Error: need at least $MPI nodes (currently only $nl) in MPI_MFILE=$MPI_FILE" |
1238 |
|
usage |
1239 |
|
fi |
1240 |
|
if [ $verbose -gt 1 ]; then |
1241 |
|
echo " MPI_MFILE=$MPI_MFILE : $nl procs for MPI=$MPI run" |
1242 |
|
fi |
1243 |
|
else |
1244 |
|
echo "Error: cannot access MPI_MFILE=$MPI_FILE" |
1245 |
|
usage |
1246 |
|
fi |
1247 |
|
fi |
1248 |
|
|
1249 |
|
#- setting for forward or ADM testing |
1250 |
|
if test $KIND = 1 ; then |
1251 |
|
TARG=ftlall |
1252 |
|
code_dir=code_ad |
1253 |
|
inputdir=input_ad |
1254 |
|
ref_outp="output_tlm.txt" |
1255 |
|
EXECUTABLE="mitgcmuv_ftl" |
1256 |
|
elif test $KIND = 2 ; then |
1257 |
|
if test "x$TARG" = xobj ; then TARG=adobj ; else TARG=adall ; fi |
1258 |
|
code_dir=code_ad |
1259 |
|
inputdir=input_ad |
1260 |
|
ref_outp="output_adm.txt" |
1261 |
|
EXECUTABLE="mitgcmuv_ad" |
1262 |
|
elif test $KIND = 4 ; then |
1263 |
|
TARG=adAll |
1264 |
|
code_dir=code_oad |
1265 |
|
inputdir=input_oad |
1266 |
|
ref_outp="output_oadm.txt" |
1267 |
|
EXECUTABLE="mitgcmuv_ad" |
1268 |
|
else |
1269 |
|
code_dir=code |
1270 |
|
inputdir=input |
1271 |
|
ref_outp="output.txt" |
1272 |
|
EXECUTABLE="mitgcmuv" |
1273 |
|
fi |
1274 |
|
if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi |
1275 |
|
|
1276 |
|
xx=`echo $TESTDIRS | awk '{print $1}'` |
1277 |
if test "x$TESTDIRS" = x ; then |
if test "x$TESTDIRS" = x ; then |
1278 |
TESTDIRS=`scandirs` |
LIST=`scandirs results/$ref_outp` |
1279 |
|
elif test $xx = 'start_from' ; then |
1280 |
|
xx=`echo $TESTDIRS | awk '{print $2}'` |
1281 |
|
LIST=`scandirs results/$ref_outp | sed -n "/$xx/,$ p"` |
1282 |
|
else |
1283 |
|
#- expand group of experiments: |
1284 |
|
LIST=" " |
1285 |
|
for xx in $TESTDIRS |
1286 |
|
do |
1287 |
|
case $xx in |
1288 |
|
'basic') LIST=${LIST}" aim.5l_cs hs94.128x64x5 ideal_2D_oce" |
1289 |
|
LIST=${LIST}" lab_sea tutorial_baroclinic_gyre" |
1290 |
|
LIST=${LIST}" tutorial_global_oce_latlon tutorial_plume_on_slope" |
1291 |
|
;; |
1292 |
|
'tutorials') |
1293 |
|
LIST=${LIST}" "`ls | grep 'tutorial_'` ;; |
1294 |
|
*) LIST=${LIST}" "$xx ;; |
1295 |
|
esac |
1296 |
|
done |
1297 |
fi |
fi |
1298 |
|
#echo 'LIST='${LIST}'<' |
1299 |
|
#- skip dirs, remove duplicate and non-directory: |
1300 |
|
TESTDIRS=" " |
1301 |
|
count=0 |
1302 |
|
for xx in $LIST |
1303 |
|
do |
1304 |
|
yy=`echo $SKIPDIRS | grep -c $xx` |
1305 |
|
if test $yy = 0 ; then |
1306 |
|
if test -d $xx ; then |
1307 |
|
yy=`echo $TESTDIRS | grep -c $xx` |
1308 |
|
if test $yy = 0 ; then TESTDIRS=${TESTDIRS}" "$xx ; fi |
1309 |
|
else count=1 ; |
1310 |
|
echo ""; echo -n " -- skip \"$xx\" (not a directory !)" |
1311 |
|
fi |
1312 |
|
else |
1313 |
|
if test $count = 1 ; then echo -n ", \"$xx\"" |
1314 |
|
else count=1 ; echo "" ; echo -n " skip: \"$xx\"" |
1315 |
|
fi |
1316 |
|
fi |
1317 |
|
done |
1318 |
|
if test $count = 1 ; then echo "" ; echo -n " ... " ; fi |
1319 |
|
#echo 'TESTDIRS='${TESTDIRS}'<' |
1320 |
|
|
1321 |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
if test "x$OPTFILE" = xNONE -a "x$MITGCM_OF" != x ; then |
1322 |
OPTFILE=$MITGCM_OF |
OPTFILE=$MITGCM_OF |
1323 |
fi |
fi |
1324 |
|
|
1325 |
if test "x$ADM" = xt ; then |
LOC_MFILE='tr_mpi_mfile' |
1326 |
EXECUTABLE="mitgcmuv_ad" |
RUNLOG="run.tr_log" |
1327 |
OUTPUTFILE="output.txt_adm" |
if test "x$MPI" = x0 ; then |
1328 |
|
OUTPUTFILE=$ref_outp |
1329 |
|
if test "x$COMMAND" = x ; then COMMAND="./$EXECUTABLE > $OUTPUTFILE" ; fi |
1330 |
else |
else |
1331 |
EXECUTABLE="mitgcmuv" |
OUTPUTFILE="STDOUT.0000" |
1332 |
OUTPUTFILE="output.txt" |
if test "x$COMMAND" = x ; then COMMAND="mpirun -v -np TR_NPROC ./$EXECUTABLE" ; fi |
1333 |
fi |
fi |
1334 |
|
|
1335 |
if test "x$ADM" = xt -a "x$COMMAND" = x ; then |
echo "OK (COMMAND='$COMMAND')" |
|
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
|
|
fi |
|
1336 |
|
|
1337 |
if test "x$COMMAND" = x ; then |
#TMP=./tr_$$ |
1338 |
COMMAND="./$EXECUTABLE > $OUTPUTFILE" |
#- try to put temporary files in system-local /tmp dir |
1339 |
|
TMP=/tmp/tr_${USER}_$$ |
1340 |
|
touch $TMP ; retVal=$? |
1341 |
|
if [ $retVal -eq 0 ] ; then |
1342 |
|
if test ! -r $TMP ; then TMP=./tr_$$ ; fi |
1343 |
|
else |
1344 |
|
TMP=./tr_$$ |
1345 |
fi |
fi |
1346 |
|
rm -f $TMP |
1347 |
|
if [ $verbose -gt 1 ]; then echo " temp files: $TMP" ; fi |
1348 |
|
|
1349 |
#echo "OK" |
# set the Default List of output variables to be checked: |
1350 |
echo "OK (COMMAND= $COMMAND )" |
# (use default or load experiment-specific list from file "tr_checklist") |
1351 |
|
# content : 1rst = main variable used to decide if it pass or FAIL |
1352 |
|
# others = number of matching digits to be printed in summary.txt |
1353 |
|
if test $KIND = 1 ; then |
1354 |
|
DEF_CHECK_LIST='tlmGrd tlmCst tlmGrd fwdGrd' |
1355 |
|
EMPTY_RESULTS='.. .. ..' |
1356 |
|
LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'` |
1357 |
|
elif test $KIND = 2 -o $KIND = 4 ; then |
1358 |
|
DEF_CHECK_LIST='AdGrd Cost AdGrd FDGrd' |
1359 |
|
EMPTY_RESULTS='.. .. ..' |
1360 |
|
LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'` |
1361 |
|
else |
1362 |
|
DEF_CHECK_LIST='PS PS T+ S+ U+ V+ pt1+ pt2+ pt3+ pt4+ pt5+' |
1363 |
|
EMPTY_RESULTS='.. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. ..' |
1364 |
|
LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'` |
1365 |
|
ii=`echo $EMPTY_RESULTS | awk '{print NF}'` |
1366 |
|
EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf " ."}}'` |
1367 |
|
fi |
1368 |
|
|
1369 |
# create the FORTRAN comparison code |
# create the FORTRAN comparison code |
1370 |
createcodelet |
if test "x$CLEANUP" = xt -o -x tr_cmpnum ; then |
1371 |
|
echo "skipping comparison code build" |
1372 |
|
else |
1373 |
|
createcodelet |
1374 |
|
fi |
1375 |
|
|
1376 |
# build the mpack utility |
# build the mpack utility (if ADDRESSES = NONE, do it to test the build) |
1377 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = x -o "x$SENDCMD" != x ; then |
1378 |
echo "skipping mpack build" |
echo "skipping mpack build" |
1379 |
else |
else |
1380 |
build_mpack |
build_mpack |
1381 |
|
if test "x$HAVE_MPACK" = xt ; then SENDCMD=$MPACK ; fi |
1382 |
fi |
fi |
1383 |
|
|
1384 |
# Create a uniquely named directory to store results |
# Create a uniquely named directory to store results |
1385 |
|
CMDLINE=$0 |
1386 |
|
for xx in "$@" ; do nw=`echo $xx | wc -w` |
1387 |
|
if test $nw = '1' ; then CMDLINE="$CMDLINE $xx" ; else |
1388 |
|
nb=`echo $xx | grep -c '='` |
1389 |
|
if test $nb = 0 ; then CMDLINE="$CMDLINE '$xx'" |
1390 |
|
else yy=`echo "$xx'" | sed "s/=/='/"` ; |
1391 |
|
CMDLINE="$CMDLINE $yy" ; fi |
1392 |
|
fi |
1393 |
|
done |
1394 |
MACH=`hostname` |
MACH=`hostname` |
1395 |
UNAMEA=`uname -a` |
UNAMEA=`uname -a` |
1396 |
DATE=`date +%Y%m%d` |
DATE=`date +%Y%m%d` |
1397 |
BASE="tr_"$MACH"_"$DATE"_" |
BASE="tr_"$MACH"_"$DATE"_" |
1398 |
if test "x$OUTDIR" != x ; then |
if test "x$OUTDIR" != x ; then |
1399 |
BASE="tr_"$OUTDIR"_"$DATE"_" |
BASE="tr_"$OUTDIR"_"$DATE"_" |
1400 |
|
else |
1401 |
|
#short_name=`hostname -s | tr '[:upper:]' '[:lower:]'` |
1402 |
|
# hostname -s is not universal (does work on AIX system) |
1403 |
|
short_name=`hostname | sed 's/\..*$//' | tr '[:upper:]' '[:lower:]'` |
1404 |
|
BASE="tr_"$short_name"_"$DATE"_" |
1405 |
fi |
fi |
1406 |
DNUM=0 |
DNUM=0 |
1407 |
DRESULTS="$BASE$DNUM" |
DRESULTS="$BASE$DNUM" |
1416 |
exit 1 |
exit 1 |
1417 |
fi |
fi |
1418 |
SUMMARY="$DRESULTS/summary.txt" |
SUMMARY="$DRESULTS/summary.txt" |
|
printf "Start time: " >> $SUMMARY |
|
1419 |
start_date=`date` |
start_date=`date` |
1420 |
echo $start_date > $SUMMARY |
echo $start_date > $SUMMARY |
1421 |
|
echo 'run:' $CMDLINE >> $SUMMARY |
1422 |
|
echo 'on :' $UNAMEA >> $SUMMARY |
1423 |
|
|
1424 |
of_path= |
of_path= |
1425 |
if test "x$OPTFILE" != xNONE ; then |
if test "x$OPTFILE" != xNONE ; then |
1437 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1438 |
echo " OPTFILE=$OPTFILE" >> $SUMMARY |
echo " OPTFILE=$OPTFILE" >> $SUMMARY |
1439 |
else |
else |
1440 |
echo | tee $SUMMARY |
echo | tee -a $SUMMARY |
1441 |
echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee $SUMMARY |
echo "ERROR: can't read OPTFILE=\"$OPTFILE\"" | tee -a $SUMMARY |
1442 |
exit 1 |
exit 1 |
1443 |
fi |
fi |
1444 |
else |
else |
1445 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1446 |
echo "No \"OPTFILE\" was explicitly specified by testreport," >> $SUMMARY |
echo "No \"OPTFILE\" was specified ; genmake2 found and uses:" >> $SUMMARY |
1447 |
echo " so the genmake default will be used." >> $SUMMARY |
#-note: to be filled later after 1rst run |
1448 |
fi |
fi |
1449 |
echo |
echo |
1450 |
echo >> $SUMMARY |
echo >> $SUMMARY |
1451 |
if test "x$ADM" = x ; then |
if test $KIND = 0 ; then |
1452 |
line_0=" ----T----- ----S----- ----U----- ----V-----" |
line_0=`printf '%s %2i' 'default' $MATCH_CRIT` |
1453 |
|
line_0="$line_0 ----T----- ----S----- ----U----- ----V-----" |
1454 |
line_1="G D M c m s m s m s m s" |
line_1="G D M c m s m s m s m s" |
1455 |
line_2="E p a R g m m e . m m e . m m e . m m e ." |
line_2="e p a R g m m e . m m e . m m e . m m e ." |
1456 |
line_3="N n k u 2 i a a d i a a d i a a d i a a d" |
line_3="n n k u 2 i a a d i a a d i a a d i a a d" |
1457 |
line_4="2 d e n d n x n . n x n . n x n . n x n ." |
line_4="2 d e n d n x n . n x n . n x n . n x n ." |
1458 |
for ii in $PTRACERS_NUM ; do |
for ii in $PTRACERS_NUM ; do |
|
# tst=`eval 'echo $HAVE_PTR0'$ii` |
|
|
# if test "x$tst" = xt ; then |
|
1459 |
line_0="$line_0 --PTR 0"$ii"--" |
line_0="$line_0 --PTR 0"$ii"--" |
1460 |
line_1="$line_1 m s" |
line_1="$line_1 m s" |
1461 |
line_2="$line_2 m m e ." |
line_2="$line_2 m m e ." |
1462 |
line_3="$line_3 i a a d" |
line_3="$line_3 i a a d" |
1463 |
line_4="$line_4 n x n ." |
line_4="$line_4 n x n ." |
|
# fi |
|
1464 |
done |
done |
1465 |
|
else |
1466 |
|
line_0=`printf '%s %2i' 'default ' $MATCH_CRIT` |
1467 |
|
if test $KIND = 1 ; then |
1468 |
|
#echo "TANGLIN=true" >> $SUMMARY |
1469 |
|
echo "TangLin generated by TAF" >> $SUMMARY |
1470 |
|
elif test $KIND = 3 ; then |
1471 |
|
echo "TangLin generated by OpenAD" >> $SUMMARY |
1472 |
|
elif test $KIND = 2 ; then |
1473 |
|
#echo "ADJOINT=true" >> $SUMMARY |
1474 |
|
echo "Adjoint generated by TAF" >> $SUMMARY |
1475 |
|
else |
1476 |
|
echo "Adjoint generated by OpenAD" >> $SUMMARY |
1477 |
|
fi |
1478 |
|
if test $KIND = 1 -o $KIND = 3 ; then |
1479 |
|
line_1="G D M C T F" |
1480 |
|
line_2="e p a R o L D" |
1481 |
|
else |
1482 |
|
line_1="G D M C A F" |
1483 |
|
line_2="e p a R o d D" |
1484 |
|
fi |
1485 |
|
line_3="n n k u s G G" |
1486 |
|
line_4="2 d e n t r r" |
1487 |
|
echo >> $SUMMARY |
1488 |
|
fi |
1489 |
|
if test "x$CLEANUP" != xt ; then |
1490 |
echo "$line_0" | tee -a $SUMMARY |
echo "$line_0" | tee -a $SUMMARY |
1491 |
echo "$line_1" | tee -a $SUMMARY |
echo "$line_1" | tee -a $SUMMARY |
1492 |
echo "$line_2" | tee -a $SUMMARY |
echo "$line_2" | tee -a $SUMMARY |
1493 |
echo "$line_3" | tee -a $SUMMARY |
echo "$line_3" | tee -a $SUMMARY |
1494 |
echo "$line_4" | tee -a $SUMMARY |
echo "$line_4" | tee -a $SUMMARY |
1495 |
echo " " | tee -a $SUMMARY |
echo "" | tee -a $SUMMARY |
|
else |
|
|
echo "ADJOINT=true" >> $SUMMARY |
|
|
echo >> $SUMMARY |
|
|
cat << EOF | tee -a $SUMMARY |
|
|
G D M C G |
|
|
E p a R o r |
|
|
N n k u s a |
|
|
2 d e n t d |
|
|
|
|
|
EOF |
|
1496 |
fi |
fi |
1497 |
|
echo "-------------------------------------------------------------------------------" |
1498 |
|
|
1499 |
# ...and each test directory... |
# ...and each test directory... |
1500 |
for dir in $TESTDIRS ; do |
for dir in $TESTDIRS ; do |
1501 |
|
|
1502 |
|
# set builddir & rundir: |
1503 |
|
builddir="build" |
1504 |
|
if test ! -d $dir/$builddir ; then mkdir $dir/$builddir ; fi |
1505 |
|
rundir="run" |
1506 |
|
pfxdir="tr_$rundir" |
1507 |
|
if test ! -d $dir/$rundir ; then |
1508 |
|
rundir=$builddir |
1509 |
|
fi |
1510 |
|
CODE_DIR=$dir/$code_dir |
1511 |
|
BUILD_DIR=$dir/$builddir |
1512 |
|
|
1513 |
# Cleanup only! |
# Cleanup only! |
1514 |
if test "x$CLEANUP" = xt ; then |
if test "x$CLEANUP" = xt ; then |
1515 |
if test -r $dir/build/Makefile ; then |
echo -n ' --- dir:' $BUILD_DIR ': ' |
1516 |
( cd $dir/build ; make CLEAN ) |
makeclean $BUILD_DIR |
1517 |
|
( cd $BUILD_DIR |
1518 |
|
rm -f $EXECUTABLE *.bak |
1519 |
|
rm -f genmake_state genmake_*optfile genmake.log |
1520 |
|
rm -f SIZE.h.mpi genmake.tr_log make.tr_log |
1521 |
|
rm -rf mpi_headers |
1522 |
|
) |
1523 |
|
if test -d $dir/$rundir/CVS ; then |
1524 |
|
echo -n ' --- dir:' $dir/$rundir ': ' |
1525 |
|
run_clean $dir/$rundir |
1526 |
fi |
fi |
1527 |
if test -r $dir/input/Makefile ; then |
trdir=`( cd $dir ; find . -type d -name "$pfxdir.*" -print | sed 's/^.\///')` |
1528 |
( cd $dir/input ; make CLEAN ) |
ttd=`echo $trdir | wc -w` |
1529 |
|
if test $ttd != 0 ; then |
1530 |
|
echo ' --- rm dir:' $trdir |
1531 |
|
( cd $dir ; rm -rf $trdir ) |
1532 |
fi |
fi |
|
( |
|
|
cd $dir |
|
|
rm -rf tr_run.* |
|
|
) |
|
1533 |
continue |
continue |
1534 |
fi |
fi |
1535 |
|
|
1536 |
# Verify that the testdir exists and contains previous |
# Verify that the testdir exists and contains previous |
1537 |
# results in the correct location--or skip this directory! |
# results in the correct location--or skip this directory! |
1538 |
fout= |
fout=$dir"/results/"$ref_outp |
1539 |
if test "x$ADM" = x ; then |
#if test ! -r $fout ; then |
1540 |
fout=$dir"/results/output.txt" |
if test ! -r $fout -a ! -r ${fout}.gz ; then |
|
else |
|
|
fout=$dir"/results_ad/output.txt_adm" |
|
|
fi |
|
|
if test ! -r $fout ; then |
|
1541 |
echo "can't read \"$fout\" -- skipping $dir" |
echo "can't read \"$fout\" -- skipping $dir" |
1542 |
continue |
continue |
1543 |
fi |
fi |
|
if test "x$ADM" = x ; then |
|
|
check_for_add_mon_output $fout |
|
|
fi |
|
1544 |
|
|
1545 |
# Check for additional types of monitor output |
# Check for specific files for particular type of run |
1546 |
|
|
1547 |
builddir="input" |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" != "x0" ; then |
1548 |
rundir="input" |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
1549 |
use_seperate_build=0 |
continue |
|
if test -d $dir/build -a -r $dir/build ; then |
|
|
builddir="build" |
|
|
rundir="build" |
|
|
use_seperate_build=1 |
|
|
linkdata $use_seperate_build $dir/$rundir |
|
1550 |
fi |
fi |
1551 |
|
if test ! -r $dir"/input/eedata.mth" -a "x$MULTI_THREAD" = "xt" ; then |
1552 |
# Check whether there are "extra runs" for this testdir |
echo "can't find \"$dir/input/eedata.mth\" -- skipping $dir" |
1553 |
extra_runs= |
continue |
|
if test "x$ADM" = x -a "x$use_seperate_build" = x1 ; then |
|
|
ex_run_dirs=`( cd $dir ; echo input.* )` |
|
|
echo "ex_run_dirs='$ex_run_dirs'" |
|
|
for exd in $ex_run_dirs ; do |
|
|
name=`echo $exd | sed -e 's/input.//g'` |
|
|
outf="$dir/results/output.txt.$name" |
|
|
if test -f $outf -a -r $outf ; then |
|
|
extra_runs="$extra_runs $name" |
|
|
fi |
|
|
done |
|
1554 |
fi |
fi |
1555 |
|
|
1556 |
if test "x$ADM" = x ; then |
if test "x$MPI" != "x0" ; then |
1557 |
code_dir=code |
ntx=1 ; nty=1 |
1558 |
CODE_DIR=$dir/code |
if test "x$MULTI_THREAD" = "xt" ; then |
1559 |
else |
ff=$dir"/input/eedata.mth" |
1560 |
code_dir=code_ad |
ntx=`grep "^ *nTx *=" $ff | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` |
1561 |
CODE_DIR=$dir/code_ad |
nty=`grep "^ *nTy *=" $ff | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` |
1562 |
|
if test "x$ntx" = x ; then ntx=1 ; fi |
1563 |
|
if test "x$nty" = x ; then nty=1 ; fi |
1564 |
|
fi |
1565 |
|
#- create new SIZE.h with no more than '$MPI' Procs |
1566 |
|
mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $ntx $nty |
1567 |
|
LOC_NPROC=$? |
1568 |
|
( cd $BUILD_DIR |
1569 |
|
if test -r SIZE.h.mpi ; then |
1570 |
|
cmp tr_size.mpi SIZE.h.mpi > /dev/null 2>&1 ; RETVAL=$? |
1571 |
|
else RETVAL=1 |
1572 |
|
fi |
1573 |
|
if test "x$RETVAL" = x0 ; then |
1574 |
|
rm -f tr_size.mpi |
1575 |
|
else |
1576 |
|
rm -f SIZE.h.mpi ; mv tr_size.mpi SIZE.h.mpi |
1577 |
|
fi |
1578 |
|
) |
1579 |
|
if test "x$MPI_MFILE" != x ; then |
1580 |
|
#- create new MPI machine-file with the right number of Procs |
1581 |
|
rm -f $LOC_MFILE |
1582 |
|
cat $MPI_MFILE | sort | uniq | head -$LOC_NPROC > $LOC_MFILE |
1583 |
|
nl=`wc -l $LOC_MFILE | awk '{print $1}'` |
1584 |
|
if [ $nl -lt $LOC_NPROC ] ; then |
1585 |
|
rm -f $LOC_MFILE |
1586 |
|
cat $MPI_MFILE | head -$LOC_NPROC > $LOC_MFILE |
1587 |
|
#sed -n "1,$LOC_NPROC p" $MPI_MFILE > $LOC_MFILE |
1588 |
|
fi |
1589 |
|
if [ $verbose -gt 1 ]; then |
1590 |
|
nl=`wc -l $LOC_MFILE | awk '{print $1}'` |
1591 |
|
echo " new LOC_MFILE=$LOC_MFILE : $nl procs for LOC_NPROC=$LOC_NPROC" |
1592 |
|
fi |
1593 |
|
fi |
1594 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
1595 |
|
retv=`check_eedata $dir"/input/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"` |
1596 |
|
if test $retv != 0 ; then |
1597 |
|
echo "input/eedata.mth tiling misfit -- skipping $dir" |
1598 |
|
continue |
1599 |
|
fi |
1600 |
|
fi |
1601 |
fi |
fi |
|
BUILD_DIR=$dir/$builddir |
|
1602 |
|
|
1603 |
if test ! -r $CODE_DIR"/SIZE.h_mpi" -a "x$MPI" = "xt" ; then |
# Check whether there are "extra runs" for this testdir |
1604 |
echo "can't find \"$CODE_DIR/SIZE.h_mpi\" -- skipping $dir" |
extra_runs= |
1605 |
continue |
if test "x$NORUN" = xf ; then |
1606 |
|
ex_run_dirs=`( cd $dir ; ls -d $inputdir.* 2> /dev/null )` |
1607 |
fi |
fi |
1608 |
|
#echo "ex_run_dirs='$ex_run_dirs'" |
1609 |
|
for exd in $ex_run_dirs ; do |
1610 |
|
name=`echo $exd | sed -e "s/$inputdir\.//"` |
1611 |
|
refExOut=`echo $ref_outp | sed "s/\./.${name}./"` |
1612 |
|
outf="$dir/results/$refExOut" |
1613 |
|
if test -r $outf -o -r ${outf}.gz ; then |
1614 |
|
if test "x$MULTI_THREAD" = "xt" ; then |
1615 |
|
if test -r $dir"/"$exd"/eedata.mth" ; then |
1616 |
|
if test "x$MPI" = "x0" ; then |
1617 |
|
extra_runs="$extra_runs $name" |
1618 |
|
else |
1619 |
|
retv=`check_eedata $dir"/"$exd"/eedata.mth" $BUILD_DIR"/SIZE.h.mpi"` |
1620 |
|
if test $retv = 0 ; then |
1621 |
|
extra_runs="$extra_runs $name" |
1622 |
|
else |
1623 |
|
echo $exd"/eedata.mth tiling misfit -- skipping $dir" |
1624 |
|
fi |
1625 |
|
fi |
1626 |
|
#else echo $dir"/"$exd"/eedata.mth: not found" |
1627 |
|
fi |
1628 |
|
else |
1629 |
|
extra_runs="$extra_runs $name" |
1630 |
|
fi |
1631 |
|
fi |
1632 |
|
done |
1633 |
|
|
|
echo "-------------------------------------------------------------------------------" |
|
1634 |
echo |
echo |
1635 |
echo "Experiment: $dir" |
if test "x$extra_runs" = "x" ; then |
1636 |
|
echo "Experiment: $dir" |
1637 |
|
else |
1638 |
|
echo "Experiment: $dir ; extra_runs=$extra_runs" |
1639 |
|
fi |
1640 |
echo |
echo |
1641 |
unset genmake makedepend make run |
unset genmake makedepend make run |
1642 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results=$EMPTY_RESULTS |
1643 |
|
|
1644 |
# Create an output dir for each OPTFILE/tdir combination |
# Create an output dir & summary.txt file for each tested experiment (tdir) |
1645 |
rel_CDIR=$DRESULTS"/"$dir |
locDIR=$DRESULTS"/"$dir |
1646 |
mkdir $rel_CDIR |
mkdir $locDIR |
1647 |
CDIR=`pwd`"/$rel_CDIR" |
#- report to this experiment local summary file --- |
1648 |
|
echo "DATE='$DATE' ; tdir='$dir'" > $locDIR"/summary.txt" |
1649 |
if test "x$CLEANUP" = xt ; then |
echo "MACH='$MACH'" >> $locDIR"/summary.txt" |
1650 |
makeclean $dir/$builddir |
echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt" |
1651 |
|
CDIR=`pwd`"/$locDIR" |
1652 |
|
|
1653 |
|
if test "x$NORUN" = xt ; then |
1654 |
|
run=N |
1655 |
|
genmakemodel $dir/$builddir && genmake=Y \ |
1656 |
|
&& makeclean $dir/$builddir \ |
1657 |
|
&& symlink_mpifiles $dir $code_dir $builddir \ |
1658 |
|
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1659 |
|
&& makemodel $dir/$builddir && make=Y |
1660 |
else |
else |
1661 |
genmakemodel $dir/$builddir && genmake=Y \ |
genmakemodel $dir/$builddir && genmake=Y \ |
1662 |
&& makeclean $dir/$builddir \ |
&& makeclean $dir/$builddir \ |
1663 |
&& symlink_mpifiles $dir $code_dir $builddir \ |
&& symlink_mpifiles $dir $code_dir $builddir \ |
1664 |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
&& makedependmodel $dir/$builddir && makedepend=Y \ |
1665 |
&& makemodel $dir/$builddir && make=Y \ |
&& makemodel $dir/$builddir && make=Y \ |
1666 |
&& linkdata $use_seperate_build $dir/$rundir \ |
&& run_clean $dir/$rundir \ |
1667 |
|
&& linkdata $dir/$rundir $inputdir \ |
1668 |
&& runmodel $dir/$rundir && run=Y \ |
&& runmodel $dir/$rundir && run=Y \ |
1669 |
&& results=`testoutput $dir $rundir` |
&& results=`testoutput_run $dir $rundir $ref_outp` |
1670 |
fi |
fi |
1671 |
|
#echo "results='$results'" |
1672 |
echo |
|
|
if test "x$ADM" = x ; then |
|
1673 |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1674 |
echo |
echo 1>&2 |
1675 |
echo "$fres" >> $SUMMARY |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1676 |
echo "fresults='$fres'" > $CDIR"/summary.txt" |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
|
|
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
|
1677 |
|
|
1678 |
for ex in $extra_runs ; do |
for ex in $extra_runs ; do |
1679 |
unset run |
unset run |
1680 |
results='-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --' |
results=$EMPTY_RESULTS |
1681 |
# Create an output dir for each OPTFILE/tdir.ex combination |
# reference output file |
1682 |
rel_CDIR=$DRESULTS"/"$dir"."$ex |
refExOut=`echo $ref_outp | sed "s/\./.${ex}./g"` |
1683 |
mkdir $rel_CDIR |
# Create an output dir & summary.txt file for each extra run (tdir.ex) |
1684 |
CDIR=`pwd`"/$rel_CDIR" |
locDIR=$DRESULTS"/"$dir"."$ex |
1685 |
test ! -e "$dir/tr_run.$ex" && mkdir "$dir/tr_run.$ex" |
mkdir $locDIR |
1686 |
for ldir in input.$ex input ; do |
#- report to this experiment local summary file --- |
1687 |
( |
echo "DATE='$DATE' ; tdir='$dir.$ex'" > $locDIR"/summary.txt" |
1688 |
cd "$dir/$ldir" > /dev/null 2>&1 |
#echo "MACH='$MACH'" >> $locDIR"/summary.txt" |
1689 |
ls -1 2>/dev/null \ |
#echo "UNAMEA='$UNAMEA'" >> $locDIR"/summary.txt" |
1690 |
| sed -e 's|^CVS$||g' | sed -e 's|^output.txt$||g' |
CDIR=`pwd`"/$locDIR" |
1691 |
) > tr_exrun_links |
test ! -e "$dir/$pfxdir.$ex" && mkdir "$dir/$pfxdir.$ex" |
1692 |
( |
run_clean $dir/$pfxdir.$ex |
1693 |
cd "$dir/tr_run.$ex" |
linkdata $dir/$pfxdir.$ex $inputdir.$ex $inputdir |
1694 |
cat ../../tr_exrun_links | while read i ; do |
runmodel $dir/$pfxdir.$ex && run=Y \ |
1695 |
if test ! "x$i" = x ; then |
&& results=`testoutput_run $dir $pfxdir.$ex $refExOut` |
1696 |
test ! -r $i && ln -s "../"$ldir"/"$i $i |
fres=`formatresults $dir.$ex ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
1697 |
fi |
echo 1>&2 |
1698 |
done |
echo "$fres" | sed 's/ 99/ --/g' | sed 's/ > />/' | sed 's/ < /</' >> $SUMMARY |
1699 |
) |
echo "fresults='$fres'" | sed 's/ 99/ --/g' >> $locDIR"/summary.txt" |
1700 |
test -e tr_exrun_links && rm -f tr_exrun_links |
if test "x$POSTCLEAN" = x2 ; then |
1701 |
done |
run_clean $dir/$pfxdir.$ex |
1702 |
ldir=build |
fi |
|
( |
|
|
cd $dir/tr_run.$ex |
|
|
test ! -e mitgcmuv && ln -s "../"$ldir"/"mitgcmuv . |
|
|
) |
|
|
runmodel $dir/tr_run.$ex && run=Y \ |
|
|
&& results=`testoutput $dir tr_run.$ex "."$ex` |
|
|
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
|
|
fres=`formatresults $dir ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N} $results` |
|
|
fres="$fres.$ex" |
|
|
echo |
|
|
echo "$fres" >> $SUMMARY |
|
|
echo "fresults='$fres'" > $CDIR"/summary.txt" |
|
|
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
|
|
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
|
|
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
|
|
echo "tdir='$dir.$ex'" >> $CDIR"/summary.txt" |
|
1703 |
done |
done |
1704 |
else |
|
1705 |
fres=`printf '%s %s %s %s' ${genmake:-N} ${makedepend:-N} ${make:-N} ${run:-N}` |
if test ! -f $DRESULTS"/"genmake_state ; then |
1706 |
fres=$fres"$results $dir" |
if test -f $dir/$builddir/Makefile ; then |
1707 |
echo |
mkOpt=`grep '^# OPTFILE=' $dir/$builddir/Makefile 2>/dev/null | head -1 | sed 's/^# //'` |
1708 |
echo "$fres" >> $SUMMARY |
echo "from '$dir/$builddir/Makefile', extract:" > $DRESULTS/genmake_state |
1709 |
echo "fresults='$fres'" > $CDIR"/summary.txt" |
# sed -n '/^# executed by:/,+1 p' $dir/$builddir/Makefile >> $DRESULTS/genmake_state |
1710 |
echo "MACH='$MACH'" >> $CDIR"/summary.txt" |
# bsd-sed cannot do the above code |
1711 |
echo "UNAMEA='$UNAMEA'" >> $CDIR"/summary.txt" |
cat $dir/$builddir/Makefile | \ |
1712 |
echo "DATE='$DATE'" >> $CDIR"/summary.txt" |
sed -n '/^# executed by:/{N |
1713 |
echo "tdir='$dir'" >> $CDIR"/summary.txt" |
p |
1714 |
grep -A3 'Seconds in section "ALL' $dir/$rundir/$OUTPUTFILE \ |
}' >> $DRESULTS/genmake_state |
1715 |
>> $CDIR"/summary.txt" |
echo " $mkOpt" >> $DRESULTS/genmake_state |
1716 |
|
if test "x$OPTFILE" = xNONE ; then |
1717 |
|
eval $mkOpt |
1718 |
|
# sed "/^No \"OPTFILE\" was specified ; genmake2/a\ OPTFILE=${OPTFILE}"\ |
1719 |
|
# $SUMMARY > tmp.tr_log |
1720 |
|
# bsd-sed requires a newline after "a\": |
1721 |
|
sed "/^No \"OPTFILE\" was specified ; genmake2/a\\ |
1722 |
|
OPTFILE=${OPTFILE}" $SUMMARY > tmp.tr_log |
1723 |
|
RETVAL=$? |
1724 |
|
if test "x$RETVAL" = x0 ; then |
1725 |
|
cp -f tmp.tr_log $SUMMARY |
1726 |
|
fi |
1727 |
|
rm -f tmp.tr_log |
1728 |
|
fi |
1729 |
|
gmkLog=$dir/$builddir/genmake.log |
1730 |
|
if test -r $gmkLog ; then |
1731 |
|
grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 |
1732 |
|
RETVAL=$? |
1733 |
|
if test "x$RETVAL" = x0 ; then |
1734 |
|
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
1735 |
|
echo "extract compiler version:" >> $DRESULTS/genmake_state |
1736 |
|
sed -n '/Get compiler version/,/<-- compiler version/p' \ |
1737 |
|
$gmkLog | grep -v '^... compiler version ' > tmp.tr_log |
1738 |
|
sed -n '1p' tmp.tr_log >> $DRESULTS/genmake_state |
1739 |
|
sed -n '2,/^$/p' tmp.tr_log | sed '/^$/d' | sed 's/^./ &/' \ |
1740 |
|
>> $DRESULTS/genmake_state |
1741 |
|
rm -f tmp.tr_log |
1742 |
|
fi |
1743 |
|
echo -n "from '$gmkLog', " >> $DRESULTS/genmake_state |
1744 |
|
echo "get NETCDF & LAPACK settings:" >> $DRESULTS/genmake_state |
1745 |
|
sed -n '/set HAVE_NETCDF=/p' $gmkLog >> $DRESULTS/genmake_state |
1746 |
|
sed -n '/set HAVE_LAPACK=/p' $gmkLog >> $DRESULTS/genmake_state |
1747 |
|
fi |
1748 |
|
fi |
1749 |
|
fi |
1750 |
|
#postclean $dir/$builddir |
1751 |
|
if test "x$POSTCLEAN" = x2 ; then |
1752 |
|
makeclean $dir/$builddir \ |
1753 |
|
&& run_clean $dir/$rundir |
1754 |
fi |
fi |
1755 |
|
if test "x$MPI" != x0 -a "x$MPI_MFILE" != x ; then rm -f $LOC_MFILE ; fi |
1756 |
|
|
|
postclean $dir/$builddir |
|
|
|
|
1757 |
echo "-------------------------------------------------------------------------------" |
echo "-------------------------------------------------------------------------------" |
1758 |
|
|
1759 |
done |
done |
1760 |
|
|
1761 |
printf "Start time: " >> $SUMMARY |
printf "Start time: " >> $SUMMARY |
1762 |
echo $start_date >> $SUMMARY |
echo "$start_date" >> $SUMMARY |
1763 |
printf "End time: " >> $SUMMARY |
printf "End time: " >> $SUMMARY |
1764 |
date >> $SUMMARY |
date >> $SUMMARY |
1765 |
|
|
1768 |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
if test "x$ADDRESSES" = xNONE -o "x$ADDRESSES" = x ; then |
1769 |
echo "No results email was sent." |
echo "No results email was sent." |
1770 |
else |
else |
1771 |
if test "x$HAVE_MPACK" = xt ; then |
if test "x$SENDCMD" != x ; then |
1772 |
tar -cf $DRESULTS".tar" $DRESULTS > /dev/null 2>&1 \ |
if [ $verbose -gt 1 ]; then |
1773 |
&& gzip $DRESULTS".tar" \ |
echo " run: $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES" |
1774 |
&& $MPACK -s MITgcm-test -m 3555000 $DRESULTS".tar.gz" $ADDRESSES |
fi |
1775 |
|
tar -cf ${SAVDIR}/${DRESULTS}".tar" $DRESULTS > /dev/null 2>&1 \ |
1776 |
|
&& gzip ${SAVDIR}/${DRESULTS}".tar" \ |
1777 |
|
&& $SENDCMD -s MITgcm-test -m 3555000 ${SAVDIR}/${DRESULTS}".tar.gz" $ADDRESSES |
1778 |
RETVAL=$? |
RETVAL=$? |
1779 |
if test "x$RETVAL" != x0 ; then |
if test "x$RETVAL" != x0 ; then |
1780 |
echo |
echo |
1787 |
echo "An email containing results was sent to the following addresses:" |
echo "An email containing results was sent to the following addresses:" |
1788 |
echo " \"$ADDRESSES\"" |
echo " \"$ADDRESSES\"" |
1789 |
echo |
echo |
1790 |
|
test -f ${SAVDIR}/${DRESULTS}".tar" && rm -f ${SAVDIR}/${DRESULTS}".tar" |
1791 |
|
test -f ${SAVDIR}/${DRESULTS}".tar.gz" && rm -f ${SAVDIR}/${DRESULTS}".tar.gz" |
1792 |
fi |
fi |
|
test -f $DRESULTS".tar" && rm -f $DRESULTS".tar" |
|
|
test -f $DRESULTS".tar.gz" && rm -f $DRESULTS".tar.gz" |
|
1793 |
fi |
fi |
1794 |
fi |
fi |
1795 |
|
|
1796 |
# rm -f tmp_cmpnum.f a.out |
if test "x$QUICK" = xf -a "x$NORUN" = xf ; then |
1797 |
rm -f tmp_cmpnum.c tmp_cmpnum |
rm -f tr_cmpnum.c tr_cmpnum |
1798 |
|
fi |
1799 |
|
|
1800 |
if test "x$CLEANUP" != xt ; then |
if test "x$CLEANUP" != xt ; then |
1801 |
cat $SUMMARY | sed 's/ -- -- -- --//g' |
cat $SUMMARY | sed 's/ \. \. \. \. \. \. \. \. \. \. \. \. //' |
1802 |
if test -e tr_out.txt ; then |
if test -e tr_out.txt ; then |
1803 |
mv tr_out.txt tr_out.txt.old |
mv tr_out.txt tr_out.txt.old |
1804 |
fi |
fi |
1805 |
cat $SUMMARY | sed 's/ -- -- -- --//g' > tr_out.txt |
cat $SUMMARY | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' > tr_out.txt |
1806 |
fi |
fi |
1807 |
|
|
1808 |
if test "x$DELDIR" = xt ; then |
if test "x$DELDIR" = xt ; then |
1809 |
rm -rf $DRESULTS |
rm -rf $DRESULTS |
1810 |
fi |
fi |
1811 |
|
echo "======== End of testreport execution ========" |