/[MITgcm]/mitgcm.org/front_content/make_summary
ViewVC logotype

Contents of /mitgcm.org/front_content/make_summary

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.77 - (show annotations) (download)
Fri Apr 5 21:15:06 2013 UTC (12 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.76: +24 -13 lines
refine "type" of AD or TLM testreport result (using TAF or OpenAD)

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/mitgcm.org/front_content/make_summary,v 1.76 2013/02/24 15:27:58 jmc Exp $
4 #
5 # The purpose of this script is to create HTML summaries of the
6 # directories produced by the "parse_emails" script.
7
8
9 usage()
10 {
11 echo
12 echo "Usage: $0 [OPTIONS]"
13 echo
14 echo "where possible OPTIONS are:"
15 echo " (-help|-h) print usage"
16 echo " (-date |-d )PERIOD run for PERIOD=\"YYYY_MM\""
17 echo " [def=\"$PERIOD\"]"
18 echo
19 exit 1
20 }
21
22 export LC_ALL="en_US.UTF-8"
23 CURR_PER=`date +%Y`"_"`date +%m`
24 # defaults
25 PERIOD=$CURR_PER
26
27 # Parse options
28 ac_prev=
29 for ac_option ; do
30
31 # If the previous option needs an argument, assign it.
32 if test -n "$ac_prev"; then
33 eval "$ac_prev=\$ac_option"
34 ac_prev=
35 continue
36 fi
37
38 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
39
40 case $ac_option in
41
42 -help | --help | -h | --h)
43 usage ;;
44
45 -date | --date | -d | --d)
46 ac_prev=PERIOD ;;
47 --date=* | -date=*)
48 PERIOD=$ac_optarg ;;
49
50 *)
51 echo "Error: don't understand argument \"$ac_option\""
52 usage
53 ;;
54
55 esac
56
57 done
58
59 #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD"
60 #OUTDIR="/home/jmc/mitgcm/test_web/summary"
61 INDIR="/u/u0/httpd/html/testing/results/$PERIOD"
62 OUTDIR="/u/u0/httpd/html/testing/summary"
63
64 OUTFILE=$OUTDIR"/output_"$PERIOD".html"
65 res_url="http://mitgcm.org/testing/"
66
67 # Create the links in $OUTFILE :
68 echo "Creating the \"latest\" file for each machine: "
69 the_date=`date`
70
71 sed "s/_PERIOD/$PERIOD/" summary_head > $OUTFILE
72 cat <<EOF >>$OUTFILE
73 <table align="center" cellpadding="0" cellspacing="0" border="0" width="95%">
74 <tr bgcolor="#00cccc">
75 <td height="0"> <b>Nickname</b> </td>
76 <td> <b>OPTFILE Name</b> </td>
77 <td> <b>Type</b> </td>
78 <td> <b>Date</b> </td>
79 <td> <b>Summary</b> </td>
80 <td> <b>Ratio</b> </td>
81 </tr>
82
83 EOF
84
85 color="#bbffdd"
86 ncolor="#bbddff"
87
88 MACHINES="aces- acesgrid baudelaire dickens danton beagle"
89 MACHINES="$MACHINES pleiades iblade sx8 uv100 solasrv stomp weber"
90
91 ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all
92
93 MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
94 for madd in $MALL ; do
95 present=0
96 for m in $MACHINES ; do
97 echo $madd | grep $m > /dev/null 2>&1
98 RETVAL=$?
99 test $RETVAL = 0 && present=1
100 continue
101 done
102 test $present = 0 && MACHINES="$MACHINES $madd"
103 done
104 #MACHINES="baudelaire"
105
106 for mname in $MACHINES ; do
107
108 echo " $mname"
109
110 dir_list=`grep $mname ./dir_all`
111 echo -n "" > ./mlist
112
113 for i in $dir_list ; do
114
115 dir=$INDIR"/"$i
116 OPTFILE=
117 if test -r $dir/summary.txt ; then
118 comm=`grep 'OPTFILE=' $dir/summary.txt`
119 eval $comm
120 OPTFILE=${OPTFILE##*/}
121 fi
122 if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then
123 comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
124 eval $comm
125 OPTFILE=${OPTFILE##*/}
126 fi
127 if test "x$OPTFILE" = x ; then
128 comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
129 comm=${comm##*#}
130 eval $comm
131 OPTFILE=${OPTFILE##*/}
132 fi
133 if test "x$OPTFILE" = x ; then
134 OPTFILE="not_explicitly_specified"
135 fi
136
137 # EXTRA = non-standard list of experiment
138 ADJOINT=0
139 TANGLIN=0
140 OPENAD=0
141 RESTART=0
142 EXTRA=
143 FAST=0
144 DVLP=0
145 MPI=0
146 MTH=0
147 UR4=0
148 if test -r $dir/summary.txt ; then
149 ADJOINT=`grep -c -i '^ADJOINT' $dir/summary.txt`
150 if test "x$ADJOINT" = x1 ; then
151 OPENAD=`grep -c '^Adjoint .* OpenAD' $dir/summary.txt`
152 fi
153 TANGLIN=`grep -c -i '^TANGLIN' $dir/summary.txt`
154 if test "x$TANGLIN" = x1 ; then
155 OPENAD=`grep -c '^TangLin .* OpenAD' $dir/summary.txt`
156 fi
157 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
158 comm=`grep '^run: .*testreport.* ' $dir/summary.txt`
159 EXTRA=`echo "$comm" | grep " -*-tdir\>" | sed -e "s/^.* -*-tdir\>//" -e "s/ -.*$//"`
160 if test "x$EXTRA" = x ; then
161 EXTRA=`echo "$comm" | grep " -*-t\>" | sed -e "s/^.*-*-t\>//" -e "s/ -.*$//"`
162 fi
163 if test "x$EXTRA" = x ; then EXTRA=0 ; else
164 #echo -n "EXTRA=$EXTRA"
165 nn0=`echo $EXTRA | sed "s/ *' *//g" | wc -w`
166 nn1=`echo $EXTRA | sed "s/ *' *//g" | tr ' ' '\n' | grep -c "\<monod_"`
167 nn2=`echo $EXTRA | sed "s/ *' *//g" | tr ' ' '\n' | grep -c "\<darwin_"`
168 EXTRA=1
169 if [ $nn1 -ge 2 ] ; then EXTRA=2 ; fi
170 if [ $nn2 -ge 2 ] ; then EXTRA=3 ; fi
171 #echo " : nn0=$nn0 ; nn1=$nn1 ; nn2=$nn2"
172 fi
173 FAST=`echo "$comm" | grep -c " -*-fast\>"`
174 if test "x$FAST" = x0 ; then
175 FAST=`echo "$comm" | grep -c " '*-noieee'*"`
176 fi
177 DVLP=`echo "$comm" | grep -c " -*-devel\>"`
178 MPI=`echo "$comm" | grep -c " -*-mpi\>"`
179 if test "x$MPI" = x0 ; then
180 MPI=`echo "$comm" | grep -c " -*-MPI\>"`
181 fi
182 MTH=`echo "$comm" | grep -c " -*-mth\>"`
183 UR4=`echo "$comm" | grep -c " -*-use_r4\>"`
184 if test "x$UR4" = x0 ; then
185 UR4=`echo "$comm" | grep -c " -*-ur4\>"`
186 fi
187 fi
188 if test "x$ADJOINT" = x1 ; then
189 kind="adjoint-taf" ; order=0
190 if test "x$OPENAD" = x1 ; then
191 kind="adjoint-oad" ; order=2
192 fi
193 elif test "x$TANGLIN" = x1 ; then
194 kind="tanglin-taf" ; order=1
195 if test "x$OPENAD" = x1 ; then
196 kind="tanglin-oad" ; order=3
197 fi
198 elif test "x$RESTART" = x0 ; then
199 kind="forward" ; order=4
200 else
201 kind="restart" ; order=5
202 fi
203 order=`expr $order + 10 \* $EXTRA`
204 order=`printf '%3.3i' $order`
205 if test "x$UR4" = x1 ; then
206 OPTFILE="${OPTFILE}.use_r4"
207 fi
208 if test "x$MPI" = x1 ; then
209 yy=`echo $OPTFILE | grep -c '+mpi'`
210 if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi" ; fi
211 fi
212 if test "x$MTH" = x1 ; then
213 yy=`echo $OPTFILE | grep -c '+mth$'`
214 if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
215 fi
216 if test "x$FAST" = x1 ; then
217 OPTFILE="${OPTFILE}.fast"
218 fi
219 if test "x$DVLP" = x1 ; then
220 OPTFILE="${OPTFILE}.dvlp"
221 fi
222
223 t_pass="--"
224 t_tot="--"
225 if test -r $dir/summary.txt ; then
226 grep '^[YN] [YN] [YN] [YN]' $dir/summary.txt > ./all_tests 2>/dev/null
227 t_tot=`cat ./all_tests | wc -l | sed -e 's| ||g'`
228 t_pass=`grep '^Y Y Y Y' ./all_tests | grep 'pass ' | wc -l | sed -e 's| ||g'`
229 fi
230 rm -f ./all_tests
231 # echo "${dir##*/} : $t_pass out of $t_tot"
232
233 tokens=`echo $i | sed -e 's|_| |g'`
234 echo "" > ./ms_tmp
235 for tok in $tokens ; do
236 echo $tok >> ./ms_tmp
237 done
238 DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,2)=="20")'`
239 rm -f ./ms_tmp
240
241 echo "$OPTFILE$order $DAY $OPTFILE $kind $i $t_pass:$t_tot" >> ./mlist
242
243 done
244
245 # helpful for debugging
246 # cat ./mlist
247
248 # Do we have any data? If so, create the latest pointer.
249 num=`wc -l ./mlist | awk '{print $1}'`
250 if test $num -gt 0 ; then
251
252 # swap colors
253 ctmp=$color
254 color=$ncolor
255 ncolor=$ctmp
256
257 keys=`cat ./mlist | cut -d " " -f 1 | sort | uniq`
258
259 for key in $keys ; do
260 tline=`grep "^$key " ./mlist | head -1`
261 ratio=`echo $tline | cut -d " " -f 6`
262 ldir=`echo $tline | cut -d " " -f 5`
263 kind=`echo $tline | cut -d " " -f 4`
264 optf=`echo $tline | cut -d " " -f 3`
265 DAY=`echo $tline | cut -d " " -f 2`
266 URL="results/$PERIOD/$ldir"
267 #-- machine name to print:
268 sname=`echo $mname | sed 's/-$//'`
269 alt=`echo $key | sed "s/$optf//"`
270 #if [ $alt -ge 30 ] ; then sname="${sname}.darwin"
271 #elif [ $alt -ge 20 ] ; then sname="${sname}.monod" ; fi
272 cat <<EOF >>$OUTFILE
273 <tr bgcolor="$color">
274 <td height="0"> $sname </td>
275 <td> $optf </td>
276 <td> $kind </td>
277 <td> <a href="$res_url$URL">$DAY</a> </td>
278 <td> <a href="$res_url$URL/summary.txt"> summary.txt </a> </td>
279 <td> $ratio </td>
280 </tr>
281 EOF
282 done
283 fi
284
285 done
286
287 cat >> $OUTFILE << EOF
288 <tr bgcolor="#00cccc">
289 <td height="0" colspan="6" align="center" >This table generated on: $the_date</td>
290 </tr>
291
292 </table>
293
294 <p>Examples of the scripts used for these testing runs can be obtained from: <a
295 href="http://mitgcm.org/viewvc/MITgcm/MITgcm/tools/example_scripts/">
296 MITgcm/tools/example_scripts</a>.</p>
297
298
299 </body>
300 </html>
301
302 EOF
303
304 rm -f ./dir_all ./mlist
305
306 #- put the file in place
307 chgrp gcmpack $OUTFILE
308 chmod 664 $OUTFILE
309 LATEST=$OUTDIR"/latest_"$PERIOD".html"
310 mv -f $OUTFILE $LATEST
311
312 if test "x$PERIOD" = "x$CURR_PER" ; then
313 cp $LATEST ./testing.xml
314 (
315 cd $OUTDIR
316 rm -f latest.html
317 ln -s $LATEST latest.html
318 )
319 fi

  ViewVC Help
Powered by ViewVC 1.1.22