/[MITgcm]/mitgcm.org/front_content/make_summary
ViewVC logotype

Annotation of /mitgcm.org/front_content/make_summary

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.72 - (hide annotations) (download)
Thu Aug 16 02:42:56 2012 UTC (12 years, 10 months ago) by jmc
Branch: MAIN
Changes since 1.71: +2 -2 lines
adjust TLM type

1 edhill 1.1 #! /usr/bin/env bash
2    
3 jmc 1.72 # $Header: /u/gcmpack/mitgcm.org/front_content/make_summary,v 1.71 2012/08/15 18:27:54 jmc Exp $
4 edhill 1.1 #
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 jmc 1.67 echo
14 edhill 1.1 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 jmc 1.67 echo
19 edhill 1.1 exit 1
20     }
21    
22 jmc 1.61 export LC_ALL="en_US.UTF-8"
23 jmc 1.36 CURR_PER=`date +%Y`"_"`date +%m`
24 edhill 1.1 # defaults
25 jmc 1.36 PERIOD=$CURR_PER
26 edhill 1.1
27     # Parse options
28     ac_prev=
29     for ac_option ; do
30 jmc 1.35
31 edhill 1.1 # 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 jmc 1.35
38 edhill 1.1 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
39 jmc 1.35
40 edhill 1.1 case $ac_option in
41 jmc 1.71
42 edhill 1.1 -help | --help | -h | --h)
43     usage ;;
44 jmc 1.35
45 jmc 1.71 -date | --date | -d | --d)
46     ac_prev=PERIOD ;;
47     --date=* | -date=*)
48     PERIOD=$ac_optarg ;;
49    
50     *)
51 edhill 1.1 echo "Error: don't understand argument \"$ac_option\""
52     usage
53 jmc 1.71 ;;
54 jmc 1.35
55 edhill 1.1 esac
56 jmc 1.35
57 edhill 1.1 done
58    
59 jmc 1.35 #INDIR="/net/orwell/export/export-9/mitgcm-testing/results/$PERIOD"
60 jmc 1.44 #OUTDIR="/home/jmc/mitgcm/test_web/summary"
61 edhill 1.1 INDIR="/u/u0/httpd/html/testing/results/$PERIOD"
62     OUTDIR="/u/u0/httpd/html/testing/summary"
63 jmc 1.35
64 jmc 1.36 OUTFILE=$OUTDIR"/output_"$PERIOD".html"
65 jmc 1.35 res_url="http://mitgcm.org/testing/"
66 edhill 1.1
67 jmc 1.36 # Create the links in $OUTFILE :
68 edhill 1.1 echo "Creating the \"latest\" file for each machine: "
69 edhill 1.5 the_date=`date`
70 edhill 1.1
71 jmc 1.60 sed "s/_PERIOD/$PERIOD/" summary_head > $OUTFILE
72     cat <<EOF >>$OUTFILE
73 edhill 1.1 <table align="center" cellpadding="0" cellspacing="0" border="0" width="95%">
74     <tr bgcolor="#00cccc">
75 edhill 1.4 <td height="0"> <b>Nickname</b> </td>
76 edhill 1.1 <td> <b>OPTFILE Name</b> </td>
77 edhill 1.4 <td> <b>Type</b> </td>
78 edhill 1.5 <td> <b>Date</b> </td>
79 edhill 1.4 <td> <b>Summary</b> </td>
80 edhill 1.6 <td> <b>Ratio</b> </td>
81 edhill 1.1 </tr>
82    
83     EOF
84    
85     color="#bbffdd"
86 edhill 1.10 ncolor="#bbddff"
87 edhill 1.1
88 jmc 1.68 MACHINES="faulks meander aces- acesgrid baudelaire dickens danton beagle harbor"
89 jmc 1.64 MACHINES="$MACHINES pleiades iblade rays solasrv sx8"
90 jmc 1.65 MACHINES="$MACHINES trane dodongo dokdo stomp bigred"
91 edhill 1.1
92 jmc 1.34 ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all
93 edhill 1.1
94 edhill 1.20 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 jmc 1.71 echo $madd | grep $m > /dev/null 2>&1
99     RETVAL=$?
100     test $RETVAL = 0 && present=1
101     continue
102 edhill 1.20 done
103     test $present = 0 && MACHINES="$MACHINES $madd"
104     done
105 jmc 1.70 #MACHINES="baudelaire"
106 edhill 1.20
107 edhill 1.1 for mname in $MACHINES ; do
108    
109     echo " $mname"
110 jmc 1.68 sname=`echo $mname | sed 's/-$//'`
111 edhill 1.1
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 edhill 1.3 comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
126 edhill 1.1 eval $comm
127     OPTFILE=${OPTFILE##*/}
128     fi
129     if test "x$OPTFILE" = x ; then
130 edhill 1.21 comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
131 edhill 1.3 comm=${comm##*#}
132 edhill 1.1 eval $comm
133     OPTFILE=${OPTFILE##*/}
134     fi
135     if test "x$OPTFILE" = x ; then
136     OPTFILE="not_explicitly_specified"
137     fi
138 edhill 1.4
139     ADJOINT=
140 jmc 1.71 TANGLIN=
141 jmc 1.32 RESTART=0
142 jmc 1.66 FAST=0
143     DVLP=0
144 jmc 1.69 MPI=0
145 jmc 1.49 MTH=0
146 jmc 1.62 UR4=0
147 edhill 1.4 if test -r $dir/summary.txt ; then
148     comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`
149     eval $comm
150 jmc 1.71 comm=`grep 'TANGLIN=true' $dir/summary.txt 2>/dev/null`
151     eval $comm
152 jmc 1.32 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
153 jmc 1.66 FAST=`grep -c "^run: .*testreport.* '*-fast'*" $dir/summary.txt`
154     if test "x$FAST" = x0 ; then
155     FAST=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt`
156     fi
157     DVLP=`grep -c "^run: .*testreport.* '*-devel'*" $dir/summary.txt`
158 jmc 1.69 MPI=`grep -c "^run: .*testreport.* -mpi " $dir/summary.txt`
159     if test "x$MPI" = x0 ; then
160     MPI=`grep -c "^run: .*testreport.* -MPI " $dir/summary.txt`
161     fi
162 jmc 1.49 MTH=`grep -c "^run: .*testreport.* -mth " $dir/summary.txt`
163 jmc 1.62 UR4=`grep -c "^run: .*testreport.* -use_r4 " $dir/summary.txt`
164     if test "x$UR4" = x0 ; then
165     UR4=`grep -c "^run: .*testreport.* -ur4 " $dir/summary.txt`
166     fi
167 edhill 1.4 fi
168 jmc 1.71 if test "x$ADJOINT" = xtrue ; then
169 jmc 1.70 kind="adjoint" ; order='000'
170 jmc 1.71 elif test "x$TANGLIN" = xtrue ; then
171 jmc 1.72 kind="tanglin" ; order='001'
172 jmc 1.70 elif test "x$RESTART" = x0 ; then
173 jmc 1.71 kind="forward" ; order='002'
174 edhill 1.4 else
175 jmc 1.71 kind="restart" ; order='003'
176 edhill 1.4 fi
177 jmc 1.62 if test "x$UR4" = x1 ; then
178     OPTFILE="${OPTFILE}.use_r4"
179     fi
180 jmc 1.69 if test "x$MPI" = x1 ; then
181     yy=`echo $OPTFILE | grep -c '+mpi'`
182     if test $yy = 0 ; then OPTFILE="${OPTFILE}+mpi" ; fi
183     fi
184 jmc 1.55 if test "x$MTH" = x1 ; then
185     yy=`echo $OPTFILE | grep -c '+mth$'`
186     if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
187     fi
188 jmc 1.66 if test "x$FAST" = x1 ; then
189     OPTFILE="${OPTFILE}.fast"
190     fi
191     if test "x$DVLP" = x1 ; then
192     OPTFILE="${OPTFILE}.dvlp"
193 jmc 1.42 fi
194 edhill 1.4
195 edhill 1.6 t_pass="--"
196     t_tot="--"
197     if test -r $dir/summary.txt ; then
198 jmc 1.30 grep '^[YN] [YN] [YN] [YN]' $dir/summary.txt > ./all_tests 2>/dev/null
199 edhill 1.6 t_tot=`cat ./all_tests | wc -l | sed -e 's| ||g'`
200 jmc 1.38 t_pass=`grep '^Y Y Y Y' ./all_tests | grep 'pass ' | wc -l | sed -e 's| ||g'`
201 edhill 1.6 fi
202 jmc 1.30 rm -f ./all_tests
203 edhill 1.6 # echo "${dir##*/} : $t_pass out of $t_tot"
204    
205 edhill 1.1 tokens=`echo $i | sed -e 's|_| |g'`
206     echo "" > ./ms_tmp
207     for tok in $tokens ; do
208     echo $tok >> ./ms_tmp
209     done
210 jmc 1.59 DAY=`cat ./ms_tmp | awk '(length($1)==8 && substr($1,0,2)=="20")'`
211 edhill 1.1 rm -f ./ms_tmp
212 edhill 1.4
213 jmc 1.70 echo "$OPTFILE$order $DAY $OPTFILE $kind $i $t_pass:$t_tot" >> ./mlist
214 edhill 1.1
215     done
216    
217     # helpful for debugging
218     # cat ./mlist
219    
220     # Do we have any data? If so, create the latest pointer.
221     num=`wc -l ./mlist | awk '{print $1}'`
222     if test $num -gt 0 ; then
223 edhill 1.10
224     # swap colors
225 jmc 1.71 ctmp=$color
226     color=$ncolor
227     ncolor=$ctmp
228 edhill 1.10
229 edhill 1.4 keys=`cat ./mlist | cut -d " " -f 1 | sort | uniq`
230 edhill 1.1
231 edhill 1.4 for key in $keys ; do
232 edhill 1.17 tline=`grep "^$key " ./mlist | head -1`
233 edhill 1.6 ratio=`echo $tline | cut -d " " -f 6`
234 edhill 1.4 ldir=`echo $tline | cut -d " " -f 5`
235     kind=`echo $tline | cut -d " " -f 4`
236     optf=`echo $tline | cut -d " " -f 3`
237     DAY=`echo $tline | cut -d " " -f 2`
238 edhill 1.1 URL="results/$PERIOD/$ldir"
239 jmc 1.36 cat <<EOF >>$OUTFILE
240 edhill 1.1 <tr bgcolor="$color">
241 jmc 1.68 <td height="0"> $sname </td>
242 edhill 1.1 <td> $optf </td>
243 edhill 1.4 <td> $kind </td>
244     <td> <a href="$res_url$URL">$DAY</a> </td>
245     <td> <a href="$res_url$URL/summary.txt"> summary.txt </a> </td>
246 edhill 1.6 <td> $ratio </td>
247 edhill 1.1 </tr>
248     EOF
249     done
250     fi
251    
252     done
253    
254 jmc 1.36 cat >> $OUTFILE << EOF
255 edhill 1.5 <tr bgcolor="#00cccc">
256 edhill 1.6 <td height="0" colspan="6" align="center" >This table generated on: $the_date</td>
257     </tr>
258 edhill 1.1
259     </table>
260 edhill 1.6
261 edhill 1.26 <p>Examples of the scripts used for these testing runs can be obtained from: <a
262 jmc 1.60 href="http://mitgcm.org/viewvc/MITgcm/MITgcm/tools/example_scripts/">
263 edhill 1.26 MITgcm/tools/example_scripts</a>.</p>
264 edhill 1.6
265    
266 edhill 1.1 </body>
267     </html>
268    
269     EOF
270    
271     rm -f ./dir_all ./mlist
272    
273 jmc 1.36 #- put the file in place
274     chgrp gcmpack $OUTFILE
275     chmod 664 $OUTFILE
276     LATEST=$OUTDIR"/latest_"$PERIOD".html"
277     mv -f $OUTFILE $LATEST
278    
279 edhill 1.1 if test "x$PERIOD" = "x$CURR_PER" ; then
280 edhill 1.2 cp $LATEST ./testing.xml
281 edhill 1.1 (
282     cd $OUTDIR
283     rm -f latest.html
284     ln -s $LATEST latest.html
285     )
286     fi

  ViewVC Help
Powered by ViewVC 1.1.22