| 1 | #! /usr/bin/env bash | 
| 2 |  | 
| 3 | # $Header: /u/gcmpack/mitgcm.org/front_content/make_summary,v 1.39 2008/06/27 16:01:03 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 | CURR_PER=`date +%Y`"_"`date +%m` | 
| 23 | # defaults | 
| 24 | PERIOD=$CURR_PER | 
| 25 |  | 
| 26 | #  Parse options | 
| 27 | ac_prev= | 
| 28 | for ac_option ; do | 
| 29 |  | 
| 30 | # If the previous option needs an argument, assign it. | 
| 31 | if test -n "$ac_prev"; then | 
| 32 | eval "$ac_prev=\$ac_option" | 
| 33 | ac_prev= | 
| 34 | continue | 
| 35 | fi | 
| 36 |  | 
| 37 | ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` | 
| 38 |  | 
| 39 | case $ac_option in | 
| 40 |  | 
| 41 | -help | --help | -h | --h) | 
| 42 | usage ;; | 
| 43 |  | 
| 44 | -date | --date | -d | --d) | 
| 45 | ac_prev=PERIOD ;; | 
| 46 | --date=* | -date=*) | 
| 47 | PERIOD=$ac_optarg ;; | 
| 48 |  | 
| 49 | *) | 
| 50 | echo "Error: don't understand argument \"$ac_option\"" | 
| 51 | usage | 
| 52 | ;; | 
| 53 |  | 
| 54 | esac | 
| 55 |  | 
| 56 | done | 
| 57 |  | 
| 58 | #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD" | 
| 59 | INDIR="/u/u0/httpd/html/testing/results/$PERIOD" | 
| 60 | OUTDIR="/u/u0/httpd/html/testing/summary" | 
| 61 |  | 
| 62 | OUTFILE=$OUTDIR"/output_"$PERIOD".html" | 
| 63 | res_url="http://mitgcm.org/testing/" | 
| 64 |  | 
| 65 | #  Create the links in $OUTFILE : | 
| 66 | echo "Creating the \"latest\" file for each machine: " | 
| 67 | the_date=`date` | 
| 68 | cat > $OUTFILE << EOF | 
| 69 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 
| 70 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 
| 71 |  | 
| 72 | <html xmlns="http://www.w3.org/1999/xhtml"> | 
| 73 | <head> | 
| 74 | <title>MITgcm testing summary</title> | 
| 75 | <meta name="author" content="Ed Hill" /> | 
| 76 |  | 
| 77 | <!-- <base href="http://mitgcm.org/testing/summary/" /> --> | 
| 78 |  | 
| 79 | <!-- Hinting for menu generation --> | 
| 80 | <meta name="add_name_0" content="Testing" /> | 
| 81 | <meta name="add_name_1" content="" /> | 
| 82 | <meta name="add_name_2" content="" /> | 
| 83 | <meta name="add_title" content="Testing" /> | 
| 84 | <!-- Hinting for menu generation --> | 
| 85 |  | 
| 86 | </head> | 
| 87 | <body> | 
| 88 | <p>The MITgcm model is tested | 
| 89 | (compiled and run) in an automated fashion on a varirety of | 
| 90 | different machines.  The following is a summary of the MITgcm | 
| 91 | verification suite for the time period: <b>$PERIOD</b>.</p> | 
| 92 |  | 
| 93 | <p>The machine naming scheme is:<br /></p> | 
| 94 | <table align="center" cellpadding="0" border="0"> | 
| 95 | <tr bgcolor="#00cccc"> <td><b>Machine Type</b></td> <td><b>Nickname</b></td> | 
| 96 | <td><b>Notes</b></td> </tr> | 
| 97 |  | 
| 98 | <tr bgcolor="#bbddff"> <td>Intel P4</td> <td>"faulks"</td> | 
| 99 | <td>Fedora Core 6 </td> </tr> | 
| 100 | <tr bgcolor="#bbffdd"> <td> Intel P4</td> <td>"eddy"</td> | 
| 101 | <td>Fedora Core 5</td> </tr> | 
| 102 | <tr bgcolor="#bbddff"> <td> Intel P4 </td> <td>"bay"</td> | 
| 103 | <td>Fedora Core 5 </td> </tr> | 
| 104 | <tr bgcolor="#bbffdd"> <td> Intel P4 </td> <td>"meander"</td> | 
| 105 | <td>Fedora Core 7 </td> </tr> | 
| 106 |  | 
| 107 | <tr bgcolor="#bbddff"> <td> <a href="http://acesgrid.org">ACESgrid Dell | 
| 108 | Xeon</a> </td> <td>"aces"</td><td>Fedora Core 2</td> </tr> | 
| 109 |  | 
| 110 | <!-- | 
| 111 | <tr bgcolor="#bbffdd"> <td> Intel P3/P4 Beowulf </td> <td>"myrinet"</td> | 
| 112 | <td><a href="http://mitgcm.org/projects/MITGCM_CLUSTER/">MITgcm cluster | 
| 113 | facility </a></td> </tr> | 
| 114 | <tr bgcolor="#bbddff"> <td>Alpha cluster</td> <td>"halem"</td> | 
| 115 | <td><a href="http://nccstag.gsfc.nasa.gov/halem/quickstart_halem.html"> | 
| 116 | NASA NCCS Halem</a></td> </tr> | 
| 117 | --> | 
| 118 |  | 
| 119 | <!-- | 
| 120 | <tr bgcolor="#bbffdd"> <td> SGI Origin 2000 </td> <td>"hopper"</td> | 
| 121 | <td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O2K/o2k.html"> | 
| 122 | NAS SGI Origin 2000 </a></td> </tr> | 
| 123 | <tr bgcolor="#bbddff"> <td> SGI Origin 3000</td><td>"lomax"/"turing"</td> | 
| 124 | <td><a href="http://www.nas.nasa.gov/User/Systemsdocs/O3K/o3k.html"> | 
| 125 | NAS SGI Origin 3000 </a></td> </tr> | 
| 126 | --> | 
| 127 |  | 
| 128 | <tr bgcolor="#bbffdd"> <td> SGI Altix Cluster </td> <td>"columbia"</td> | 
| 129 | <td><a href="http://www.nas.nasa.gov/Resources/Systems/columbia.html"> | 
| 130 | NAS Columbia </a></td> </tr> | 
| 131 |  | 
| 132 | <!-- | 
| 133 | <tr bgcolor="#bbffdd"> <td> SGI Altix 350 </td> <td>"altix350"</td> | 
| 134 | <td><a href="http://acesgrid.org/geocluster/">MIT ACESgrid | 
| 135 | GeoCluster</a></td> </tr> | 
| 136 | <tr bgcolor="#bbddff"> <td> IBM POWER3 SP </td> <td>"bf"</td> | 
| 137 | <td><a href="http://www.scd.ucar.edu/computers/blackforest/">NCAR Blackforest | 
| 138 | </a></td> </tr> | 
| 139 | <tr bgcolor="#bbffdd"> <td> IBM/Apple dual G5 </td> <td>"two"</td> | 
| 140 | <td>Mac OSX 10.3 (gcc 3.4) </td> </tr> | 
| 141 | --> | 
| 142 | <tr bgcolor="#bbddff"> <td> IBM POWER4 SP </td> <td>"edvir"</td> | 
| 143 | <td> AIX 5.2 </td> </tr> | 
| 144 | <tr bgcolor="#bbffdd"> <td> IBM POWER5+ SP </td> <td>"blueice"</td> | 
| 145 | <td><a href="http://www.scd.ucar.edu/computers/blueice/">NCAR Blueice | 
| 146 | </a></td> </tr> | 
| 147 |  | 
| 148 | <tr bgcolor="#bbddff"> <td> AMD Opteron </td> <td>"batsi"</td> | 
| 149 | <td>Fedora Core 4 (AMD64)</td> </tr> | 
| 150 | <tr bgcolor="#bbffdd"> <td> AMD Opteron </td> <td>"starp"</td> | 
| 151 | <td>SuSE SLES 10 (AMD64)</td> </tr> | 
| 152 |  | 
| 153 | <tr bgcolor="#bbddff"> <td> Sun UltraSparc IV </td> <td>"rays"</td> | 
| 154 | <td>Solaris 9</td> </tr> | 
| 155 | <!-- | 
| 156 | <tr bgcolor="#bbffdd"> <td> Sun UltraSparc IV </td> <td>"model"</td> | 
| 157 | <td>Solaris 9</td> </tr> | 
| 158 | --> | 
| 159 | <tr bgcolor="#bbffdd"> <td> NEC SX-8 </td> <td>"sx8"</td> | 
| 160 | <td>Super-UX </td> </tr> | 
| 161 | <tr bgcolor="#bbddff"> <td> Cray XD1 (AMD Opteron) </td> <td>"xd1"</td> | 
| 162 | <td>Cray HPC enhanced Linux 2.6.5 </td> </tr> | 
| 163 | <tr bgcolor="#bbffdd"> <td> PowerPC970MP cluster </td> <td>"bigred"</td> | 
| 164 | <td>SuSE SLES 9 (PPC) </td> </tr> | 
| 165 |  | 
| 166 | <tr bgcolor="#bbddff"> <td><a | 
| 167 | href="http://www.testdrive.hp.com/current.shtml"> HP test-drive </a> | 
| 168 | (Pentium III) </td> <td>"td152"</td> <td> FreeBSD 6.2 </td> </tr> | 
| 169 | <tr bgcolor="#bbffdd"> <td><a | 
| 170 | href="http://www.testdrive.hp.com/current.shtml"> HP test-drive </a> | 
| 171 | (Itanium II) </td> <td>"td187"</td> <td>SuSE SLES 10 </td> </tr> | 
| 172 | <tr bgcolor="#bbddff"> <td><a | 
| 173 | href="http://www.testdrive.hp.com/current.shtml"> HP test-drive </a> | 
| 174 | (PA-RISC 8900) </td> <td>"td191"</td> <td> HP-UX 11i 11.11 </td> </tr> | 
| 175 | <tr bgcolor="#bbffdd"> <td><a | 
| 176 | href="http://www.testdrive.hp.com/current.shtml"> HP test-drive </a> | 
| 177 | (Itanium II) </td> <td>"td194"</td> <td> HP-UX 11i v3 </td> </tr> | 
| 178 |  | 
| 179 | <!-- | 
| 180 | <tr bgcolor="#bbddff"> <td>  </td> <td>""</td> | 
| 181 | <td></td> </tr> | 
| 182 | --> | 
| 183 |  | 
| 184 | </table> | 
| 185 |  | 
| 186 | <p><br /> | 
| 187 | The complete output for the verification runs can be found in | 
| 188 | <a href="http://mitgcm.org/testing/summary/">the summary pages</a> | 
| 189 | and the <a href="http://mitgcm.org/testing/results/">testing archives</a>. | 
| 190 | The latest reports are:</p> | 
| 191 | <table align="center" cellpadding="0" cellspacing="0" border="0" width="95%"> | 
| 192 | <tr bgcolor="#00cccc"> | 
| 193 | <td height="0"> <b>Nickname</b> </td> | 
| 194 | <td> <b>OPTFILE Name</b> </td> | 
| 195 | <td> <b>Type</b> </td> | 
| 196 | <td> <b>Date</b> </td> | 
| 197 | <td> <b>Summary</b> </td> | 
| 198 | <td> <b>Ratio</b> </td> | 
| 199 | </tr> | 
| 200 |  | 
| 201 | EOF | 
| 202 |  | 
| 203 | color="#bbffdd" | 
| 204 | ncolor="#bbddff" | 
| 205 |  | 
| 206 | MACHINES="faulks aces eddy bay meander" | 
| 207 | MACHINES="$MACHINES columbia edvir rays sx8 xd1" | 
| 208 | MACHINES="$MACHINES batsi starp" | 
| 209 |  | 
| 210 | ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all | 
| 211 |  | 
| 212 | MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq` | 
| 213 | for madd in $MALL ; do | 
| 214 | present=0 | 
| 215 | for m in $MACHINES ; do | 
| 216 | echo $madd | grep $m > /dev/null 2>&1 | 
| 217 | RETVAL=$? | 
| 218 | test $RETVAL = 0  &&  present=1 | 
| 219 | continue | 
| 220 | done | 
| 221 | test $present = 0  &&  MACHINES="$MACHINES $madd" | 
| 222 | done | 
| 223 | #MACHINES="faulks" | 
| 224 |  | 
| 225 | for mname in $MACHINES ; do | 
| 226 |  | 
| 227 | echo "  $mname" | 
| 228 |  | 
| 229 | dir_list=`grep $mname ./dir_all` | 
| 230 | echo -n "" > ./mlist | 
| 231 |  | 
| 232 | for i in $dir_list ; do | 
| 233 |  | 
| 234 | dir=$INDIR"/"$i | 
| 235 | OPTFILE= | 
| 236 | if test -r $dir/summary.txt ; then | 
| 237 | comm=`grep 'OPTFILE=' $dir/summary.txt` | 
| 238 | eval $comm | 
| 239 | OPTFILE=${OPTFILE##*/} | 
| 240 | fi | 
| 241 | if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then | 
| 242 | comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null` | 
| 243 | eval $comm | 
| 244 | OPTFILE=${OPTFILE##*/} | 
| 245 | fi | 
| 246 | if test "x$OPTFILE" = x ; then | 
| 247 | comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1` | 
| 248 | comm=${comm##*#} | 
| 249 | eval $comm | 
| 250 | OPTFILE=${OPTFILE##*/} | 
| 251 | fi | 
| 252 | if test "x$OPTFILE" = x ; then | 
| 253 | OPTFILE="not_explicitly_specified" | 
| 254 | fi | 
| 255 |  | 
| 256 | ADJOINT= | 
| 257 | RESTART=0 | 
| 258 | if test -r $dir/summary.txt ; then | 
| 259 | comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null` | 
| 260 | eval $comm | 
| 261 | RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt` | 
| 262 | fi | 
| 263 | if test "x$RESTART" = x0 ; then | 
| 264 | kind="forward" | 
| 265 | test "x$ADJOINT" = xtrue  &&  kind="adjoint" | 
| 266 | else | 
| 267 | kind="restart" | 
| 268 | fi | 
| 269 |  | 
| 270 | t_pass="--" | 
| 271 | t_tot="--" | 
| 272 | if test -r $dir/summary.txt ; then | 
| 273 | grep '^[YN] [YN] [YN] [YN]' $dir/summary.txt > ./all_tests 2>/dev/null | 
| 274 | t_tot=`cat ./all_tests | wc -l | sed -e 's| ||g'` | 
| 275 | t_pass=`grep '^Y Y Y Y' ./all_tests | grep 'pass ' | wc -l | sed -e 's| ||g'` | 
| 276 | fi | 
| 277 | rm -f ./all_tests | 
| 278 | # echo "${dir##*/} : $t_pass out of $t_tot" | 
| 279 |  | 
| 280 | tokens=`echo $i | sed -e 's|_| |g'` | 
| 281 | echo "" > ./ms_tmp | 
| 282 | for tok in $tokens ; do | 
| 283 | echo $tok >> ./ms_tmp | 
| 284 | done | 
| 285 | DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,3)=="200")'` | 
| 286 | rm -f ./ms_tmp | 
| 287 |  | 
| 288 | echo "$OPTFILE$kind $DAY $OPTFILE $kind $i $t_pass:$t_tot" >> ./mlist | 
| 289 |  | 
| 290 | done | 
| 291 |  | 
| 292 | # helpful for debugging | 
| 293 | # cat ./mlist | 
| 294 |  | 
| 295 | #  Do we have any data?  If so, create the latest pointer. | 
| 296 | num=`wc -l ./mlist | awk '{print $1}'` | 
| 297 | if test $num -gt 0 ; then | 
| 298 |  | 
| 299 | # swap colors | 
| 300 | ctmp=$color | 
| 301 | color=$ncolor | 
| 302 | ncolor=$ctmp | 
| 303 |  | 
| 304 | keys=`cat ./mlist | cut -d " " -f 1 | sort | uniq` | 
| 305 |  | 
| 306 | for key in $keys ; do | 
| 307 | tline=`grep "^$key " ./mlist | head -1` | 
| 308 | ratio=`echo $tline | cut -d " " -f 6` | 
| 309 | ldir=`echo $tline | cut -d " " -f 5` | 
| 310 | kind=`echo $tline | cut -d " " -f 4` | 
| 311 | optf=`echo $tline | cut -d " " -f 3` | 
| 312 | DAY=`echo $tline | cut -d " " -f 2` | 
| 313 | URL="results/$PERIOD/$ldir" | 
| 314 | cat <<EOF >>$OUTFILE | 
| 315 | <tr bgcolor="$color"> | 
| 316 | <td height="0"> $mname </td> | 
| 317 | <td> $optf </td> | 
| 318 | <td> $kind </td> | 
| 319 | <td> <a href="$res_url$URL">$DAY</a> </td> | 
| 320 | <td> <a href="$res_url$URL/summary.txt"> summary.txt </a> </td> | 
| 321 | <td> $ratio </td> | 
| 322 | </tr> | 
| 323 | EOF | 
| 324 | done | 
| 325 | fi | 
| 326 |  | 
| 327 | done | 
| 328 |  | 
| 329 | cat >> $OUTFILE << EOF | 
| 330 | <tr bgcolor="#00cccc"> | 
| 331 | <td height="0" colspan="6" align="center" >This table generated on: $the_date</td> | 
| 332 | </tr> | 
| 333 |  | 
| 334 | </table> | 
| 335 |  | 
| 336 | <p>Examples of the scripts used for these testing runs can be obtained from: <a | 
| 337 | href="http://mitgcm.org/cgi-bin/viewcvs.cgi/MITgcm/tools/example_scripts/"> | 
| 338 | MITgcm/tools/example_scripts</a>.</p> | 
| 339 |  | 
| 340 |  | 
| 341 | </body> | 
| 342 | </html> | 
| 343 |  | 
| 344 | EOF | 
| 345 |  | 
| 346 | rm -f ./dir_all ./mlist | 
| 347 |  | 
| 348 | #- put the file in place | 
| 349 | chgrp gcmpack $OUTFILE | 
| 350 | chmod 664 $OUTFILE | 
| 351 | LATEST=$OUTDIR"/latest_"$PERIOD".html" | 
| 352 | mv -f $OUTFILE $LATEST | 
| 353 |  | 
| 354 | if test "x$PERIOD" = "x$CURR_PER" ; then | 
| 355 | cp $LATEST ./testing.xml | 
| 356 | ( | 
| 357 | cd $OUTDIR | 
| 358 | rm -f latest.html | 
| 359 | ln -s $LATEST latest.html | 
| 360 | ) | 
| 361 | fi |