1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/u3/gcmpack/mitgcm.org/front_content/make_summary,v 1.1 2003/12/06 20:06:58 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 |
cat > $LATEST << EOF |
147 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
148 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
149 |
|
150 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
151 |
<head> |
152 |
<title>MITgcm testing summary</title> |
153 |
<meta name="author" content="Ed Hill" /> |
154 |
|
155 |
<!-- <base href="http://mitgcm.org/testing/summary/" /> --> |
156 |
|
157 |
<!-- Hinting for menu generation --> |
158 |
<meta name="add_name_0" content="Source Code" /> |
159 |
<meta name="add_name_1" content="Testing" /> |
160 |
<meta name="add_name_2" content="" /> |
161 |
<meta name="add_title" content="Testing" /> |
162 |
<!-- Hinting for menu generation --> |
163 |
|
164 |
</head> |
165 |
<body> |
166 |
<p>To enhance and maintain portability, the MITgcm model is tested |
167 |
(compiled and run) in an automated fashion on a varirety of |
168 |
different machines. The following is a summary of the MITgcm |
169 |
testing/verification suite for the time period: <b>$PERIOD</b>.</p> |
170 |
|
171 |
<p>The machine naming scheme is:<br /></p> |
172 |
<table align="center" cellpadding="0" border="0"> |
173 |
<tr bgcolor="#00cccc"> <td><b>Machine Type</b></td> <td><b>"Nickname"</b></td> |
174 |
<td><b>Notes</b></td> </tr> |
175 |
|
176 |
<tr bgcolor="#bbffdd"> <td>Intel P4</td> <td>"faulks"</td> |
177 |
<td>Red Hat 7.3 (the "original" testing machine)</td> </tr> |
178 |
<tr bgcolor="#bbddff"> <td>Intel P4</td> <td>"shelley"</td> |
179 |
<td>Red Hat 9</td> </tr> |
180 |
|
181 |
<tr bgcolor="#bbffdd"> <td> Intel P3/P4 Beowulf </td> <td>"myrinet"</td> |
182 |
<td><a href="http://mitgcm.org/projects/MITGCM_CLUSTER/">MITgcm cluster |
183 |
facility </a></td> </tr> |
184 |
<tr bgcolor="#bbddff"> <td>Alpha cluster</td> <td>"halem"</td> |
185 |
<td><a href="http://webserv.gsfc.nasa.gov/SCB/NCCS/systems/high-end-computing.html"> |
186 |
NASA NCCS Halem</a></td> </tr> |
187 |
|
188 |
<tr bgcolor="#bbffdd"> <td> SGI Origin 2000 </td> <td>"hopper"</td> |
189 |
<td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O2K/o2k.html"> |
190 |
NAS SGI Origin 2000 </a></td> </tr> |
191 |
<tr bgcolor="#bbddff"> <td> SGI Origin 3000 </td> <td>"lomax"</td> |
192 |
<td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O3K/o3k.html"> |
193 |
NAS SGI Origin 3000 </a></td> </tr> |
194 |
|
195 |
<tr bgcolor="#bbffdd"> <td> SGI Altix </td> <td>"orion"</td> |
196 |
<td><a href="http://sc.jpl.nasa.gov/">JPL Supercomputing and |
197 |
Visualization Facility</a></td> </tr> |
198 |
<tr bgcolor="#bbddff"> <td> IBM POWER3 SP </td> <td>"bf"</td> |
199 |
<td><a href="http://www.scd.ucar.edu/computers/blackforest/">NCAR Blackforest |
200 |
</a></td> </tr> |
201 |
|
202 |
<tr bgcolor="#bbffdd"> <td> IBM POWER4 SP </td> <td>"bs"</td> |
203 |
<td><a href="http://www.scd.ucar.edu/computers/bluesky/">NCAR Bluesky |
204 |
</a></td> </tr> |
205 |
|
206 |
<!-- |
207 |
<tr bgcolor="#bbddff"> <td> </td> <td>""</td> |
208 |
<td></td> </tr> |
209 |
--> |
210 |
|
211 |
</table> |
212 |
|
213 |
<p><br /> |
214 |
The complete output for the testing/verification runs can be found in |
215 |
<a href="http://mitgcm.org/testing/summary/">the summary pages</a>. |
216 |
The latest reports are:</p> |
217 |
<table align="center" cellpadding="0" cellspacing="0" border="0" width="95%"> |
218 |
<tr bgcolor="#00cccc"> |
219 |
<td height="0"> <b>"Nickname"</b> </td> |
220 |
<td> <b>OPTFILE Name</b> </td> |
221 |
<td> <b>Date (YYYYMMDD)</b> </td> |
222 |
</tr> |
223 |
|
224 |
EOF |
225 |
|
226 |
color="#bbffdd" |
227 |
res_url="http://mitgcm.org/testing/" |
228 |
|
229 |
MACHINES="faulks shelley myrinet halem hopper lomax orion bf bs" |
230 |
|
231 |
( cd $INDIR ; ls -1 ) > ./dir_all |
232 |
|
233 |
for mname in $MACHINES ; do |
234 |
|
235 |
echo " $mname" |
236 |
if test "x$color" = x#bbffdd ; then |
237 |
color="#bbddff" |
238 |
else |
239 |
color="#bbffdd" |
240 |
fi |
241 |
|
242 |
dir_list=`grep $mname ./dir_all` |
243 |
echo -n "" > ./mlist |
244 |
|
245 |
for i in $dir_list ; do |
246 |
|
247 |
dir=$INDIR"/"$i |
248 |
OPTFILE= |
249 |
if test -r $dir/summary.txt ; then |
250 |
comm=`grep 'OPTFILE=' $dir/summary.txt` |
251 |
eval $comm |
252 |
OPTFILE=${OPTFILE##*/} |
253 |
fi |
254 |
if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then |
255 |
comm=`grep 'OPTFILE=' $dir/genmake_state` |
256 |
eval $comm |
257 |
OPTFILE=${OPTFILE##*/} |
258 |
fi |
259 |
if test "x$OPTFILE" = x ; then |
260 |
comm=`grep '^# OPTFILE=' $dir/*/Makefile 2>/dev/null | head -1 | sed -e 's|^# ||'` |
261 |
eval $comm |
262 |
OPTFILE=${OPTFILE##*/} |
263 |
fi |
264 |
if test "x$OPTFILE" = x ; then |
265 |
OPTFILE="not_explicitly_specified" |
266 |
fi |
267 |
tokens=`echo $i | sed -e 's|_| |g'` |
268 |
echo "" > ./ms_tmp |
269 |
for tok in $tokens ; do |
270 |
echo $tok >> ./ms_tmp |
271 |
done |
272 |
DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,3)=="200")'` |
273 |
rm -f ./ms_tmp |
274 |
echo "$OPTFILE $DAY $i" >> ./mlist |
275 |
|
276 |
done |
277 |
|
278 |
# helpful for debugging |
279 |
# cat ./mlist |
280 |
|
281 |
# Do we have any data? If so, create the latest pointer. |
282 |
num=`wc -l ./mlist | awk '{print $1}'` |
283 |
if test $num -gt 0 ; then |
284 |
optfiles=`cat ./mlist | cut -d " " -f 1 | sort | uniq` |
285 |
|
286 |
for optf in $optfiles ; do |
287 |
ldir=`grep "^$optf " ./mlist | sort -r | head -1 | cut -d " " -f 3` |
288 |
URL="results/$PERIOD/$ldir" |
289 |
cat <<EOF >>$LATEST |
290 |
<tr bgcolor="$color"> |
291 |
<td height="0"><a href="$res_url$URL"> $mname </a></td> |
292 |
<td> $optf </td> |
293 |
<td> $DAY </td> |
294 |
</tr> |
295 |
EOF |
296 |
done |
297 |
fi |
298 |
|
299 |
done |
300 |
|
301 |
cat >> $LATEST << EOF |
302 |
|
303 |
</table> |
304 |
</body> |
305 |
</html> |
306 |
|
307 |
EOF |
308 |
|
309 |
rm -f ./dir_all ./mlist |
310 |
|
311 |
CURR_PER=`date +%Y`"_"`date +%m` |
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 |