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