/[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.74 - (show annotations) (download)
Tue Sep 4 20:29:22 2012 UTC (12 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.73: +6 -6 lines
change comments

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/mitgcm.org/front_content/make_summary,v 1.73 2012/09/04 20:12:20 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="faulks meander aces- acesgrid baudelaire dickens danton beagle harbor"
89 MACHINES="$MACHINES pleiades iblade rays solasrv sx8"
90 MACHINES="$MACHINES trane dodongo dokdo stomp bigred"
91
92 ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all
93
94 MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
95 for madd in $MALL ; do
96 present=0
97 for m in $MACHINES ; do
98 echo $madd | grep $m > /dev/null 2>&1
99 RETVAL=$?
100 test $RETVAL = 0 && present=1
101 continue
102 done
103 test $present = 0 && MACHINES="$MACHINES $madd"
104 done
105 #MACHINES="baudelaire"
106
107 for mname in $MACHINES ; do
108
109 echo " $mname"
110 sname=`echo $mname | sed 's/-$//'`
111
112 dir_list=`grep $mname ./dir_all`
113 echo -n "" > ./mlist
114
115 for i in $dir_list ; do
116
117 dir=$INDIR"/"$i
118 OPTFILE=
119 if test -r $dir/summary.txt ; then
120 comm=`grep 'OPTFILE=' $dir/summary.txt`
121 eval $comm
122 OPTFILE=${OPTFILE##*/}
123 fi
124 if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then
125 comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
126 eval $comm
127 OPTFILE=${OPTFILE##*/}
128 fi
129 if test "x$OPTFILE" = x ; then
130 comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
131 comm=${comm##*#}
132 eval $comm
133 OPTFILE=${OPTFILE##*/}
134 fi
135 if test "x$OPTFILE" = x ; then
136 OPTFILE="not_explicitly_specified"
137 fi
138
139 # EXTRA = non-standard list of experiment
140 ADJOINT=
141 TANGLIN=
142 RESTART=0
143 EXTRA=0
144 FAST=0
145 DVLP=0
146 MPI=0
147 MTH=0
148 UR4=0
149 if test -r $dir/summary.txt ; then
150 comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`
151 eval $comm
152 comm=`grep 'TANGLIN=true' $dir/summary.txt 2>/dev/null`
153 eval $comm
154 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
155 comm=`grep '^run: .*testreport.* ' $dir/summary.txt`
156 EXTRA=`echo "$comm" | grep -c " -*-tdir\>"`
157 if test "x$EXTRA" = x0 ; then
158 EXTRA=`echo "$comm" | grep -c " -*-t\>"`
159 fi
160 FAST=`echo "$comm" | grep -c " -*-fast\>"`
161 if test "x$FAST" = x0 ; then
162 FAST=`echo "$comm" | grep -c " '*-noieee'*"`
163 fi
164 DVLP=`echo "$comm" | grep -c " -*-devel\>"`
165 MPI=`echo "$comm" | grep -c " -*-mpi\>"`
166 if test "x$MPI" = x0 ; then
167 MPI=`echo "$comm" | grep -c " -*-MPI\>"`
168 fi
169 MTH=`echo "$comm" | grep -c " -*-mth\>"`
170 UR4=`echo "$comm" | grep -c " -*-use_r4\>"`
171 if test "x$UR4" = x0 ; then
172 UR4=`echo "$comm" | grep -c " -*-ur4\>"`
173 fi
174 fi
175 if test "x$ADJOINT" = xtrue ; then
176 kind="adjoint" ; order=0
177 elif test "x$TANGLIN" = xtrue ; then
178 kind="tanglin" ; order=1
179 elif test "x$RESTART" = x0 ; then
180 kind="forward" ; order=2
181 else
182 kind="restart" ; order=3
183 fi
184 if test "x$EXTRA" != x0 ; then
185 order=`expr $order + 4`
186 fi
187 order=`printf '%3.3i' $order`
188 if test "x$UR4" = x1 ; then
189 OPTFILE="${OPTFILE}.use_r4"
190 fi
191 if test "x$MPI" = x1 ; then
192 yy=`echo $OPTFILE | grep -c '+mpi'`
193 if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi" ; fi
194 fi
195 if test "x$MTH" = x1 ; then
196 yy=`echo $OPTFILE | grep -c '+mth$'`
197 if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
198 fi
199 if test "x$FAST" = x1 ; then
200 OPTFILE="${OPTFILE}.fast"
201 fi
202 if test "x$DVLP" = x1 ; then
203 OPTFILE="${OPTFILE}.dvlp"
204 fi
205
206 t_pass="--"
207 t_tot="--"
208 if test -r $dir/summary.txt ; then
209 grep '^[YN] [YN] [YN] [YN]' $dir/summary.txt > ./all_tests 2>/dev/null
210 t_tot=`cat ./all_tests | wc -l | sed -e 's| ||g'`
211 t_pass=`grep '^Y Y Y Y' ./all_tests | grep 'pass ' | wc -l | sed -e 's| ||g'`
212 fi
213 rm -f ./all_tests
214 # echo "${dir##*/} : $t_pass out of $t_tot"
215
216 tokens=`echo $i | sed -e 's|_| |g'`
217 echo "" > ./ms_tmp
218 for tok in $tokens ; do
219 echo $tok >> ./ms_tmp
220 done
221 DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,2)=="20")'`
222 rm -f ./ms_tmp
223
224 echo "$OPTFILE$order $DAY $OPTFILE $kind $i $t_pass:$t_tot" >> ./mlist
225
226 done
227
228 # helpful for debugging
229 # cat ./mlist
230
231 # Do we have any data? If so, create the latest pointer.
232 num=`wc -l ./mlist | awk '{print $1}'`
233 if test $num -gt 0 ; then
234
235 # swap colors
236 ctmp=$color
237 color=$ncolor
238 ncolor=$ctmp
239
240 keys=`cat ./mlist | cut -d " " -f 1 | sort | uniq`
241
242 for key in $keys ; do
243 tline=`grep "^$key " ./mlist | head -1`
244 ratio=`echo $tline | cut -d " " -f 6`
245 ldir=`echo $tline | cut -d " " -f 5`
246 kind=`echo $tline | cut -d " " -f 4`
247 optf=`echo $tline | cut -d " " -f 3`
248 DAY=`echo $tline | cut -d " " -f 2`
249 URL="results/$PERIOD/$ldir"
250 cat <<EOF >>$OUTFILE
251 <tr bgcolor="$color">
252 <td height="0"> $sname </td>
253 <td> $optf </td>
254 <td> $kind </td>
255 <td> <a href="$res_url$URL">$DAY</a> </td>
256 <td> <a href="$res_url$URL/summary.txt"> summary.txt </a> </td>
257 <td> $ratio </td>
258 </tr>
259 EOF
260 done
261 fi
262
263 done
264
265 cat >> $OUTFILE << EOF
266 <tr bgcolor="#00cccc">
267 <td height="0" colspan="6" align="center" >This table generated on: $the_date</td>
268 </tr>
269
270 </table>
271
272 <p>Examples of the scripts used for these testing runs can be obtained from: <a
273 href="http://mitgcm.org/viewvc/MITgcm/MITgcm/tools/example_scripts/">
274 MITgcm/tools/example_scripts</a>.</p>
275
276
277 </body>
278 </html>
279
280 EOF
281
282 rm -f ./dir_all ./mlist
283
284 #- put the file in place
285 chgrp gcmpack $OUTFILE
286 chmod 664 $OUTFILE
287 LATEST=$OUTDIR"/latest_"$PERIOD".html"
288 mv -f $OUTFILE $LATEST
289
290 if test "x$PERIOD" = "x$CURR_PER" ; then
291 cp $LATEST ./testing.xml
292 (
293 cd $OUTDIR
294 rm -f latest.html
295 ln -s $LATEST latest.html
296 )
297 fi

  ViewVC Help
Powered by ViewVC 1.1.22