1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/u3/gcmpack/mitgcm.org/front_content/make_summary,v 1.4 2003/12/07 06:52:17 edhill 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 |
# defaults |
23 |
PERIOD=`date +%Y`"_"`date +%m` |
24 |
|
25 |
# Parse options |
26 |
ac_prev= |
27 |
for ac_option ; do |
28 |
|
29 |
# If the previous option needs an argument, assign it. |
30 |
if test -n "$ac_prev"; then |
31 |
eval "$ac_prev=\$ac_option" |
32 |
ac_prev= |
33 |
continue |
34 |
fi |
35 |
|
36 |
ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` |
37 |
|
38 |
case $ac_option in |
39 |
|
40 |
-help | --help | -h | --h) |
41 |
usage ;; |
42 |
|
43 |
-date | --date | -d | --d) |
44 |
ac_prev=PERIOD ;; |
45 |
--date=* | -date=*) |
46 |
PERIOD=$ac_optarg ;; |
47 |
|
48 |
*) |
49 |
echo "Error: don't understand argument \"$ac_option\"" |
50 |
usage |
51 |
;; |
52 |
|
53 |
esac |
54 |
|
55 |
done |
56 |
|
57 |
INDIR="/u/u0/httpd/html/testing/results/$PERIOD" |
58 |
OUTDIR="/u/u0/httpd/html/testing/summary" |
59 |
OUTFILE=$OUTDIR"/summary_"$PERIOD".html" |
60 |
|
61 |
|
62 |
# Create the summary file for $PERIOD |
63 |
echo -n "Creating the summary file for the period \"$PERIOD\" ... " |
64 |
cat > $OUTFILE << EOF |
65 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
66 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
67 |
|
68 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
69 |
<head> |
70 |
<title>MITgcm testing summary</title> |
71 |
<meta name="author" content="Ed Hill" /> |
72 |
<base href="http://mitgcm.org/testing/summary/" /> |
73 |
</head> |
74 |
<body> |
75 |
<table cellpadding="0" cellspacing="0" border="0" width="100%"> |
76 |
|
77 |
EOF |
78 |
|
79 |
# all_files=`find $INDIR -name summary.txt` |
80 |
all_files=`( cd $INDIR ; find . -name summary.txt )` |
81 |
|
82 |
for f in $all_files ; do |
83 |
|
84 |
file=$INDIR"/"${f/.\//} |
85 |
grep "^fresults" $file > /dev/null 2>&1 |
86 |
RETVAL=$? |
87 |
if test "x$RETVAL" != x0 ; then |
88 |
continue |
89 |
fi |
90 |
|
91 |
url=`echo $file | sed -e 's|/u/edhill/www|http://mitgcm.org/~edhill|'` |
92 |
url=`echo $url | sed -e 's|summary.txt||'` |
93 |
MACH= |
94 |
fresults= |
95 |
color="#eeeeee" |
96 |
|
97 |
source $file |
98 |
echo $fresults | grep FAIL > /dev/null 2>&1 |
99 |
if test "x$?" = x0 ; then |
100 |
color="#ff99ff" |
101 |
fi |
102 |
echo $fresults | grep pass > /dev/null 2>&1 |
103 |
if test "x$?" = x0 ; then |
104 |
color="#99ffff" |
105 |
fi |
106 |
|
107 |
gm_state=`echo $file | sed -e 's/summary.txt/genmake_state/g'` |
108 |
if test -r $gm_state ; then |
109 |
grep '^OPTFILE=' $gm_state > ./tmp_state |
110 |
source ./tmp_state |
111 |
else |
112 |
optfile="unknown" |
113 |
fi |
114 |
optfile=`echo $OPTFILE | awk -F '/' '{print $NF}'` |
115 |
|
116 |
echo "<tr bgcolor=\"$color\">" >> $OUTFILE |
117 |
echo "<td height=\"0\">$MACH</td>" >> $OUTFILE |
118 |
echo "<td><a href=\"$url\">$DATE</a></td>" >> $OUTFILE |
119 |
for i in $fresults ; do |
120 |
if test "x$i" = xN ; then |
121 |
echo -n "<td bgcolor=\"#ff6666\">$i</td>" >> $OUTFILE |
122 |
else |
123 |
echo -n "<td>$i</td>" >> $OUTFILE |
124 |
fi |
125 |
done |
126 |
echo "<td>$optfile</td>" >> $OUTFILE |
127 |
echo "</tr>" >> $OUTFILE |
128 |
|
129 |
done |
130 |
|
131 |
cat >> $OUTFILE << EOF |
132 |
|
133 |
</table> |
134 |
</body> |
135 |
</html> |
136 |
|
137 |
EOF |
138 |
|
139 |
chmod a+r $OUTFILE |
140 |
echo "done" |
141 |
|
142 |
|
143 |
# Create the "latest" links |
144 |
echo "Creating the \"latest\" file for each machine: " |
145 |
LATEST=$OUTDIR"/latest_"$PERIOD".html" |
146 |
the_date=`date` |
147 |
cat > $LATEST << EOF |
148 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
149 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
150 |
|
151 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
152 |
<head> |
153 |
<title>MITgcm testing summary</title> |
154 |
<meta name="author" content="Ed Hill" /> |
155 |
|
156 |
<!-- <base href="http://mitgcm.org/testing/summary/" /> --> |
157 |
|
158 |
<!-- Hinting for menu generation --> |
159 |
<meta name="add_name_0" content="Source Code" /> |
160 |
<meta name="add_name_1" content="Testing" /> |
161 |
<meta name="add_name_2" content="" /> |
162 |
<meta name="add_title" content="Testing" /> |
163 |
<!-- Hinting for menu generation --> |
164 |
|
165 |
</head> |
166 |
<body> |
167 |
<p>The MITgcm model is tested |
168 |
(compiled and run) in an automated fashion on a varirety of |
169 |
different machines. The following is a summary of the MITgcm |
170 |
verification suite for the time period: <b>$PERIOD</b>.</p> |
171 |
|
172 |
<p>The machine naming scheme is:<br /></p> |
173 |
<table align="center" cellpadding="0" border="0"> |
174 |
<tr bgcolor="#00cccc"> <td><b>Machine Type</b></td> <td><b>Nickname</b></td> |
175 |
<td><b>Notes</b></td> </tr> |
176 |
|
177 |
<tr bgcolor="#bbffdd"> <td>Intel P4</td> <td>"faulks"</td> |
178 |
<td>Red Hat 7.3 (the "original" testing machine)</td> </tr> |
179 |
<tr bgcolor="#bbddff"> <td>Intel P4</td> <td>"shelley"</td> |
180 |
<td>Red Hat 9</td> </tr> |
181 |
|
182 |
<tr bgcolor="#bbffdd"> <td> Intel P3/P4 Beowulf </td> <td>"myrinet"</td> |
183 |
<td><a href="http://mitgcm.org/projects/MITGCM_CLUSTER/">MITgcm cluster |
184 |
facility </a></td> </tr> |
185 |
<tr bgcolor="#bbddff"> <td>Alpha cluster</td> <td>"halem"</td> |
186 |
<td><a href="http://webserv.gsfc.nasa.gov/SCB/NCCS/systems/high-end-computing.html"> |
187 |
NASA NCCS Halem</a></td> </tr> |
188 |
|
189 |
<tr bgcolor="#bbffdd"> <td> SGI Origin 2000 </td> <td>"hopper"</td> |
190 |
<td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O2K/o2k.html"> |
191 |
NAS SGI Origin 2000 </a></td> </tr> |
192 |
<tr bgcolor="#bbddff"> <td> SGI Origin 3000 </td> <td>"lomax"</td> |
193 |
<td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O3K/o3k.html"> |
194 |
NAS SGI Origin 3000 </a></td> </tr> |
195 |
|
196 |
<tr bgcolor="#bbffdd"> <td> SGI Altix </td> <td>"orion"</td> |
197 |
<td><a href="http://sc.jpl.nasa.gov/">JPL Supercomputing and |
198 |
Visualization Facility</a></td> </tr> |
199 |
<tr bgcolor="#bbddff"> <td> IBM POWER3 SP </td> <td>"bf"</td> |
200 |
<td><a href="http://www.scd.ucar.edu/computers/blackforest/">NCAR Blackforest |
201 |
</a></td> </tr> |
202 |
|
203 |
<tr bgcolor="#bbffdd"> <td> IBM POWER4 SP </td> <td>"bs"</td> |
204 |
<td><a href="http://www.scd.ucar.edu/computers/bluesky/">NCAR Bluesky |
205 |
</a></td> </tr> |
206 |
<tr bgcolor="#bbddff"> <td> AMD Opteron </td> <td>"eaps"</td> |
207 |
<td>SuSE Linux 9.0 (x86-64)</td> </tr> |
208 |
|
209 |
<!-- |
210 |
<tr bgcolor="#bbddff"> <td> </td> <td>""</td> |
211 |
<td></td> </tr> |
212 |
--> |
213 |
|
214 |
</table> |
215 |
|
216 |
<p><br /> |
217 |
The complete output for the verification runs can be found in |
218 |
<a href="http://mitgcm.org/testing/summary/">the summary pages</a> |
219 |
and the <a href="http://mitgcm.org/testing/results/">testing archives</a>. |
220 |
The latest reports are:</p> |
221 |
<table align="center" cellpadding="0" cellspacing="0" border="0" width="95%"> |
222 |
<tr bgcolor="#00cccc"> |
223 |
<td height="0"> <b>Nickname</b> </td> |
224 |
<td> <b>OPTFILE Name</b> </td> |
225 |
<td> <b>Type</b> </td> |
226 |
<td> <b>Date</b> </td> |
227 |
<td> <b>Summary</b> </td> |
228 |
</tr> |
229 |
|
230 |
EOF |
231 |
|
232 |
color="#bbffdd" |
233 |
res_url="http://mitgcm.org/testing/" |
234 |
|
235 |
MACHINES="faulks shelley myrinet eaps halem hopper lomax orion bf bs" |
236 |
|
237 |
( cd $INDIR ; ls -1 ) > ./dir_all |
238 |
|
239 |
for mname in $MACHINES ; do |
240 |
|
241 |
echo " $mname" |
242 |
if test "x$color" = x#bbffdd ; then |
243 |
color="#bbddff" |
244 |
else |
245 |
color="#bbffdd" |
246 |
fi |
247 |
|
248 |
dir_list=`grep $mname ./dir_all` |
249 |
echo -n "" > ./mlist |
250 |
|
251 |
for i in $dir_list ; do |
252 |
|
253 |
dir=$INDIR"/"$i |
254 |
OPTFILE= |
255 |
if test -r $dir/summary.txt ; then |
256 |
comm=`grep 'OPTFILE=' $dir/summary.txt` |
257 |
eval $comm |
258 |
OPTFILE=${OPTFILE##*/} |
259 |
fi |
260 |
if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then |
261 |
comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null` |
262 |
eval $comm |
263 |
OPTFILE=${OPTFILE##*/} |
264 |
fi |
265 |
if test "x$OPTFILE" = x ; then |
266 |
comm=`grep '^# OPTFILE=' $dir/*/Makefile 2>/dev/null | head -1` |
267 |
comm=${comm##*#} |
268 |
eval $comm |
269 |
OPTFILE=${OPTFILE##*/} |
270 |
fi |
271 |
if test "x$OPTFILE" = x ; then |
272 |
OPTFILE="not_explicitly_specified" |
273 |
fi |
274 |
|
275 |
ADJOINT= |
276 |
if test -r $dir/summary.txt ; then |
277 |
comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null` |
278 |
eval $comm |
279 |
fi |
280 |
if test "x$ADJOINT" = x ; then |
281 |
kind="forward" |
282 |
else |
283 |
test "x$ADJOINT" = xtrue && kind="adjoint" |
284 |
fi |
285 |
|
286 |
tokens=`echo $i | sed -e 's|_| |g'` |
287 |
echo "" > ./ms_tmp |
288 |
for tok in $tokens ; do |
289 |
echo $tok >> ./ms_tmp |
290 |
done |
291 |
DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,3)=="200")'` |
292 |
rm -f ./ms_tmp |
293 |
|
294 |
echo "$OPTFILE$kind $DAY $OPTFILE $kind $i" >> ./mlist |
295 |
|
296 |
done |
297 |
|
298 |
# helpful for debugging |
299 |
# cat ./mlist |
300 |
|
301 |
# Do we have any data? If so, create the latest pointer. |
302 |
num=`wc -l ./mlist | awk '{print $1}'` |
303 |
if test $num -gt 0 ; then |
304 |
keys=`cat ./mlist | cut -d " " -f 1 | sort | uniq` |
305 |
|
306 |
for key in $keys ; do |
307 |
tline=`grep "^$key " ./mlist | sort -r | head -1` |
308 |
ldir=`echo $tline | cut -d " " -f 5` |
309 |
kind=`echo $tline | cut -d " " -f 4` |
310 |
optf=`echo $tline | cut -d " " -f 3` |
311 |
DAY=`echo $tline | cut -d " " -f 2` |
312 |
URL="results/$PERIOD/$ldir" |
313 |
cat <<EOF >>$LATEST |
314 |
<tr bgcolor="$color"> |
315 |
<td height="0"> $mname </td> |
316 |
<td> $optf </td> |
317 |
<td> $kind </td> |
318 |
<td> <a href="$res_url$URL">$DAY</a> </td> |
319 |
<td> <a href="$res_url$URL/summary.txt"> summary.txt </a> </td> |
320 |
</tr> |
321 |
EOF |
322 |
done |
323 |
fi |
324 |
|
325 |
done |
326 |
|
327 |
cat >> $LATEST << EOF |
328 |
<tr bgcolor="#00cccc"> |
329 |
<td height="0" colspan="5" align="center" > |
330 |
=== This table generated on: $the_date === |
331 |
</td> |
332 |
</tr> |
333 |
|
334 |
</table> |
335 |
</body> |
336 |
</html> |
337 |
|
338 |
EOF |
339 |
|
340 |
rm -f ./dir_all ./mlist |
341 |
|
342 |
CURR_PER=`date +%Y`"_"`date +%m` |
343 |
if test "x$PERIOD" = "x$CURR_PER" ; then |
344 |
cp $LATEST ./testing.xml |
345 |
( |
346 |
cd $OUTDIR |
347 |
rm -f latest.html |
348 |
ln -s $LATEST latest.html |
349 |
) |
350 |
fi |