/[MITgcm]/mitgcm.org/scripts/check_outp
ViewVC logotype

Diff of /mitgcm.org/scripts/check_outp

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

revision 1.15 by jmc, Tue Jul 7 23:32:02 2009 UTC revision 1.23 by jmc, Tue Apr 27 19:51:50 2010 UTC
# Line 11  usage() Line 11  usage()
11  {  {
12      echo      echo
13      echo "Usage:  $0 [OPTIONS]"      echo "Usage:  $0 [OPTIONS]"
14      echo      echo
15      echo "where possible OPTIONS are:"      echo "where possible OPTIONS are:"
16      echo "  (-h|-help)            print usage"      echo "  (-h|-help)            print usage"
17      echo "  (-v|-verbose)         verbose mode"      echo "  (-v|-verbose)         verbose mode"
# Line 28  usage() Line 28  usage()
28      echo "                         [def=\"$NBLDIFF\"]"      echo "                         [def=\"$NBLDIFF\"]"
29      echo "  (-a |-addr )ADDRESS   send summary to mail ADDRESS list"      echo "  (-a |-addr )ADDRESS   send summary to mail ADDRESS list"
30      echo "                         [def=\"$ADDRESS\"]"      echo "                         [def=\"$ADDRESS\"]"
31      echo      echo
32      exit 1      exit 1
33  }  }
34    
35    #  create list of results dir for one platform:
36    make_resdir_list()
37    {
38          if test $monthDir == 1 ; then
39            dir_list=`grep '.._'$mname ./dir_all`
40          else
41            dir_list=`( cd $INDIR ; ls -1 -t ../$PREV_P/??_*${mname}*/summary.txt 2> /dev/null | sed 's/\/summary.txt//' )`
42            #echo "dir_list='$dir_list'"
43          fi
44            for i in $dir_list ; do
45    
46                dir=$INDIR"/"$i
47                #--- get the opfile used to run testreport
48                OPTFILE=
49                if test -r $dir/summary.txt ; then
50                    comm=`grep 'OPTFILE=' $dir/summary.txt`
51                    eval $comm
52                fi
53                if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then
54                    comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
55                    eval $comm
56                fi
57                if test "x$OPTFILE" = x ; then
58                    comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
59                    comm=${comm##*#}
60                    eval $comm
61                fi
62                if test "x$OPTFILE" = x ; then
63                    OPTFILE="not_explicitly_specified"
64                else
65                    OPTFILE=${OPTFILE##*/}
66                fi
67                #--- case select test run by 1 user: get user who did run testreport
68                if test "x$sUser" != x ; then
69                    tUser=
70                    if test -f $dir/genmake_state ; then
71                       nn=`sed -n '/^# executed by:/=' $dir/genmake_state`
72                       if test "x$nn" != x ; then
73                         nn=`expr $nn + 1`
74                         tUser=`sed -n "$nn s/^# *// p" $dir/genmake_state | sed 's/@.*$//'`
75                       fi
76                    fi
77                    if test "x$tUser" = "x" ; then
78                       mkfile=`ls $dir/*/Makefile* 2>/dev/null | head -1`
79                       if test "x$mkfile" = 'x' ; then
80                         echo "no Makefile => discard test from: $i" | tee -a $OUTPFIL
81                         continue
82                       fi
83                       nn=`sed -n '/^# executed by:/=' $mkfile`
84                       if test "x$nn" != x ; then
85                         nn=`expr $nn + 1`
86                         tUser=`sed -n "$nn s/^# *// p" $mkfile | sed 's/@.*$//'`
87                       fi
88                    fi
89                    if test "x$tUser" = x ; then
90                         echo "no User found => discard test from: $i" | tee -a $OUTPFIL
91                         continue
92                    fi
93                    if test $tUser != $sUser ; then
94                       if test $dBug = 't' ; then
95                            echo "  discard test from: $i" | tee -a $OUTPFIL
96                       fi
97                       continue
98                    fi
99                fi
100    
101                ADJOINT=
102                RESTART=0
103                NOI3E=0
104                MTH=0
105                if test -r $dir/summary.txt ; then
106                    comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`
107                    eval $comm
108                    RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
109                    NOI3E=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt`
110                    MTH=`grep -c "^run: .*testreport.* -mth" $dir/summary.txt`
111                fi
112                if test "x$RESTART" = x0 ; then
113                    kind="forward"
114                    test "x$ADJOINT" = xtrue  &&  kind="adjoint"
115                else
116                    kind="restart"
117                fi
118                if test "x$MTH" = x1 ; then
119                    yy=`echo $OPTFILE | grep -c '+mth$'`
120                    if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
121                fi
122                if test "x$NOI3E" = x1 ; then
123                    OPTFILE="${OPTFILE}.noieee"
124                fi
125                day=`echo $i   | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
126                ttt=`echo $day | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
127                day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`
128    
129                if [ $day -lt $FIRSTDAY ] ; then
130                    echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist
131                elif [ $day -le $LASTDAY ] ; then
132                    echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist
133                else
134                    if test $dBug = 't' ; then
135                       echo "discard day='$day' from: $i" | tee -a $OUTPFIL
136                    fi
137                fi
138    
139            done
140            if test $dBug = 't' ; then
141              if test $monthDir == 1 ; then
142                echo "---- current list (n=$monthDir) :" | tee -a $OUTPFIL
143                    cat ./slist | tee -a $OUTPFIL
144              fi
145              num1=`wc -l ./slist | awk '{print $1}'`
146              if test $num1 -gt 0 ; then
147              echo   ".... previous list (n=$monthDir):" | tee -a $OUTPFIL
148                    cat ./plist | tee -a $OUTPFIL | head -20
149              fi
150              echo "----" | tee -a $OUTPFIL
151            fi
152    }
153    
154    #--------------------------------------------------------------------------
155    # here starts the sequential part of the script:
156    
157  #CURR_PER=`date +%Y`"_"`date +%m`  #CURR_PER=`date +%Y`"_"`date +%m`
158  CURR_DAY=`date +%Y%m%d`  CURR_DAY=`date +%Y%m%d`
159  # defaults  # defaults
# Line 143  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P Line 265  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P
265  echo "INDIR='$INDIR'" >> $OUTPFIL  echo "INDIR='$INDIR'" >> $OUTPFIL
266  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL
267    
268  if test $dBug = 't' ; then  if test $dBug = 't' ; then
269    echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'"    echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'"
270    echo "FIRSTDAY='$FIRSTDAY' , LASTDAY='$LASTDAY'"    echo "FIRSTDAY='$FIRSTDAY' , LASTDAY='$LASTDAY'"
271  fi  fi
# Line 178  echo "     name     checked   comp    Di Line 300  echo "     name     checked   comp    Di
300  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all
301    
302  if test "x$MACHINES" = "x_All_" ; then  if test "x$MACHINES" = "x_All_" ; then
303    MACHINES="faulks meander lagoon harbor dickens danton aces"    MACHINES="faulks meander lagoon aces.jmc aces.ce107 dickens danton beagle harbor"
304    MACHINES="$MACHINES beagle columbia edvir rays solasrv sx8 xd1"    MACHINES="$MACHINES columbia pleiades iblade rays solssrv solasrv sx8"
305    MACHINES="$MACHINES bigred starp"    MACHINES="$MACHINES trane dodongo dokdo bigred"
306    
307    MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`    MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
308    for madd in $MALL ; do    for madd in $MALL ; do
309      present=0      present=0
310      for m in $MACHINES ; do      for m in $MACHINES ; do
311          echo $madd | grep $m > /dev/null 2>&1          mm=`echo $m | sed 's/\./ /g' | awk '{print $1}'`
312            echo $madd | grep $mm > /dev/null 2>&1
313          RETVAL=$?          RETVAL=$?
314          test $RETVAL = 0  &&  present=1          test $RETVAL = 0  &&  present=1
315          continue          continue
# Line 194  if test "x$MACHINES" = "x_All_" ; then Line 317  if test "x$MACHINES" = "x_All_" ; then
317      test $present = 0  &&  MACHINES="$MACHINES $madd"      test $present = 0  &&  MACHINES="$MACHINES $madd"
318    done    done
319  fi  fi
320    #echo "MACHINES=$MACHINES" ; exit
321    
322  for mname in $MACHINES ; do  for pname in $MACHINES ; do
323    
324      if test $dBug = 't' ; then echo "  $mname" ; fi      mname=`echo $pname | sed 's/\./ /g' | awk '{print $1}'`
325      echo " name='$mname'" >> $OUTPFIL      sUser=
326        if test $mname != $pname ; then
327          # to select results from user "sUser"
328          sUser=`echo $pname | sed 's/\./ /g' | awk '{print $2}'`
329        fi
330    
331        if test $dBug = 't' ; then echo "  $pname" ; fi
332        echo " name='$pname'" >> $OUTPFIL
333      ctot=0 ; cmis=0 ; cdif=0      ctot=0 ; cmis=0 ; cdif=0
334    
335      # put results from selected period in "slist",      # put results from selected period in "slist",
336      #     results from previous period in "plist"      #     results from previous period in "plist"
337      rm -f ./plist ./slist ; touch ./plist ./slist      rm -f ./plist ./slist ; touch ./plist ./slist
338    
339      for n in $listNum ; do      #- create list of results (slist & plist) from current month directory
340        num1=`wc -l ./slist | awk '{print $1}'`      monthDir=1
341        num0=`wc -l ./plist | awk '{print $1}'`      make_resdir_list
       if test $n == 2 ; then  
         num2=`expr $num1 \* $n`  
         if [ $num0 -lt $num2 ] ; then  
           dir_list=`( cd $INDIR ; ls -1 -t ../$PREV_P/*${mname}*/summary.txt 2> /dev/null | sed 's/\/summary.txt//' )`  
           #echo "dir_list='$dir_list'"  
         fi  
       else  
         num2=$n  
         dir_list=`grep $mname ./dir_all`  
       fi  
       if [ $num0 -lt $num2 ] ; then  
         for i in $dir_list ; do  
   
             dir=$INDIR"/"$i  
             OPTFILE=  
             if test -r $dir/summary.txt ; then  
                 comm=`grep 'OPTFILE=' $dir/summary.txt`  
                 eval $comm  
                 OPTFILE=${OPTFILE##*/}  
             fi  
             if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then  
                 comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`  
                 eval $comm  
                 OPTFILE=${OPTFILE##*/}  
             fi  
             if test "x$OPTFILE" = x ; then  
                 comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`  
                 comm=${comm##*#}  
                 eval $comm  
                 OPTFILE=${OPTFILE##*/}  
             fi  
             if test "x$OPTFILE" = x ; then  
                 OPTFILE="not_explicitly_specified"  
             fi  
   
             ADJOINT=  
             RESTART=0  
             NOI3E=0  
             MTH=0  
             if test -r $dir/summary.txt ; then  
                 comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`  
                 eval $comm  
                 RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`  
                 NOI3E=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt`  
                 MTH=`grep -c "^run: .*testreport.* -mth" $dir/summary.txt`  
             fi  
             if test "x$RESTART" = x0 ; then  
                 kind="forward"  
                 test "x$ADJOINT" = xtrue  &&  kind="adjoint"  
             else  
                 kind="restart"  
             fi  
             if test "x$MTH" = x1 ; then  
                 yy=`echo $OPTFILE | grep -c '+mth$'`  
                 if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi  
             fi  
             if test "x$NOI3E" = x1 ; then  
                 OPTFILE="${OPTFILE}.noieee"  
             fi  
             day=`echo $i   | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`  
             ttt=`echo $day | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`  
             day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`  
   
             if [ $day -lt $FIRSTDAY ] ; then  
                 echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist  
             elif [ $day -le $LASTDAY ] ; then  
                 echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist  
             else  
                 if test $dBug = 't' ; then  
                    echo "discard day='$day' from: $i" | tee -a $OUTPFIL  
                 fi  
             fi  
   
         done  
         if test $dBug = 't' ; then  
           if test $n == 1 ; then  
             echo "---- current list (n=$n) :" | tee -a $OUTPFIL  
                 cat ./slist | tee -a $OUTPFIL  
           fi  
           echo   ".... previous list (n=$n):" | tee -a $OUTPFIL  
                 cat ./plist | tee -a $OUTPFIL | head -20  
         fi  
   
       fi  
     done  
     if test $dBug = 't' ; then echo "----" | tee -a $OUTPFIL ; fi  
342    
343      #  Do we have any data?  If so, create the latest pointer.      #  Do we have any data?  If so, create the latest pointer.
344      num=`wc -l ./slist | awk '{print $1}'`      num=`wc -l ./slist | awk '{print $1}'`
# Line 305  for mname in $MACHINES ; do Line 350  for mname in $MACHINES ; do
350            ctot=`expr $ctot + 1`            ctot=`expr $ctot + 1`
351            sline=`grep "^$key " ./slist | head -1`            sline=`grep "^$key " ./slist | head -1`
352            sdir=`echo $sline | cut -d " " -f 5`            sdir=`echo $sline | cut -d " " -f 5`
353            kind=`echo $sline | cut -d " " -f 4`            type=`echo $sline | cut -d " " -f 4`
354            optf=`echo $sline | cut -d " " -f 3`            optf=`echo $sline | cut -d " " -f 3`
355            num=`grep -c "^$key" ./plist`            num=`grep -c "^$key" ./plist`
356              if test $num = 0 -a $monthDir = 1 ; then
357              #- add results from previous month directory to "plist".
358                monthDir=2
359                make_resdir_list
360                num=`grep -c "^$key" ./plist`
361              fi
362            #- discard unsafe test:            #- discard unsafe test:
363            dd=`echo $optf | grep -c 'gfortran.*mth'`            dd=`echo $optf | grep -c 'gfortran+mth'`
364            #if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi            if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi
365            #if test $mname = 'harbor' -a $dd = 1 ; then num=-1 ; fi            if test $mname = 'harbor' -a $dd = 1 ; then num=-1 ; fi
366            #if test $mname = 'aces' -a $optf = 'linux_ia32_open64' ; then num=-1 ; fi            #if test $mname = 'aces' -a $optf = 'linux_ia32_open64' ; then num=-1 ; fi
367            #if test $mname = 'aces' -a $optf = 'linux_ia32_g95' ; then num=-1 ; fi            #if test $mname = 'aces' -a $optf = 'linux_ia32_g95' ; then num=-1 ; fi
368            if test $num -gt 0 ; then            dd=`echo $optf | grep -c 'bigred.*noieee'`
369              if test $mname = 'bigred' -a $dd = 1 ; then num=-1 ; fi
370              if test $num -lt 0 ; then
371                echo "  discard $sdir : $type , of='$optf'" | tee -a $OUTPFIL
372                cmis=`expr $cmis + 1`
373              elif test $num = '0' ; then
374                echo "no previous test for:" $key | tee -a $OUTPFIL
375                cmis=`expr $cmis + 1`
376              else
377              pline=`grep "^$key " ./plist | head -1`              pline=`grep "^$key " ./plist | head -1`
378              if test $dBug = 't' ; then              if test $dBug = 't' ; then
379                  echo "s='$sline'" | tee -a $OUTPFIL                  echo "s='$sline'" | tee -a $OUTPFIL
380                  echo "p='$pline'" | tee -a $OUTPFIL                  echo "p='$pline'" | tee -a $OUTPFIL
381              fi              fi
# Line 330  for mname in $MACHINES ; do Line 389  for mname in $MACHINES ; do
389                                   | sed 's/ OPTFILE=.*\// OPTFILE=/g' \                                   | sed 's/ OPTFILE=.*\// OPTFILE=/g' \
390                                   | grep -v '^[A-S][a-t]* time:  ' > tmpfp                                   | grep -v '^[A-S][a-t]* time:  ' > tmpfp
391              #-- re-order list of exp (according to local "sort" order)              #-- re-order list of exp (according to local "sort" order)
392              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfs \              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfs | awk '{print $NF}' | sort`
                  | sed 's/^[YN] .*pass //' | sed 's/^[YN] .*FAIL //' \  
                  | sed 's/^[YN] .*N\/O  //' | sort`  
393              for xx in $listD              for xx in $listD
394              do              do
395                  sed "/ $xx\$/d" tmpfs > tmpfn                  sed "/ $xx\$/d" tmpfs > tmpfn
396                  sed -n "/ $xx\$/p" tmpfs >> tmpfn                  sed -n "/ $xx\$/p" tmpfs >> tmpfn
397                  mv tmpfn tmpfs                  mv tmpfn tmpfs
398              done              done
399              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfp \              listD=`grep '^[YN] [YN] [YN] [YN]' tmpfp | awk '{print $NF}' | sort`
                  | sed 's/^[YN] .*pass //' | sed 's/^[YN] .*FAIL //' \  
                  | sed 's/^[YN] .*N\/O  //' | sort`  
400              for xx in $listD              for xx in $listD
401              do              do
402                  sed "/ $xx\$/d" tmpfp > tmpfn                  sed "/ $xx\$/d" tmpfp > tmpfn
# Line 352  for mname in $MACHINES ; do Line 407  for mname in $MACHINES ; do
407              diff tmpfs tmpfp > tmpdf              diff tmpfs tmpfp > tmpdf
408              yy=$?              yy=$?
409              if test $yy != '0' ; then              if test $yy != '0' ; then
410                  echo " $kind , of='$optf'" | tee -a $OUTPFIL                  echo " $type , of='$optf'" | tee -a $OUTPFIL
411                  #grep '^run: ' $outp                  #grep '^run: ' $outp
412                  #grep '^run: ' $outs                  #grep '^run: ' $outs
413                  #-- score for each test:                  #-- score for each test:
# Line 378  for mname in $MACHINES ; do Line 433  for mname in $MACHINES ; do
433                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL
434                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL
435                  cat tmpdf >> $OUTPFIL                  cat tmpdf >> $OUTPFIL
436                  if [ $cdif -eq 0 ] ; then                  if [ $cdif -eq 0 ] ; then
437                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
438                  else                  else
439                    clin="$clin,"`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`                    clin="$clin,"`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
440                  fi                  fi
441                  cdif=`expr $cdif + 1`                  cdif=`expr $cdif + 1`
442                  echo '----------------------------------------' | tee -a $OUTPFIL                  echo '----------------------------------------' | tee -a $OUTPFIL
443              else              else
444                  echo "" | tee -a $OUTPFIL                  echo " $type , of='$optf'" | tee -a $OUTPFIL
445              fi              fi
446              rm -f tmpfs tmpfp tmpdf              rm -f tmpfs tmpfp tmpdf
           elif test $num = '0' ; then  
             echo "no previous test for:" $key | tee -a $OUTPFIL  
             cmis=`expr $cmis + 1`  
           else  
             cmis=`expr $cmis + 1`  
447            fi            fi
448          done          done
449          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi
450          printf '%11s :  %3i      %4s   %3i  ' $mname $ctot $tmis $cdif >> $OUTPSUM          printf '%11s :  %3i      %4s   %3i  ' $pname $ctot $tmis $cdif >> $OUTPSUM
451          if [ $cdif -gt 0 ] ; then          if [ $cdif -gt 0 ] ; then
452            echo "   $clin" >> $OUTPSUM            echo "   $clin" >> $OUTPSUM
453         else echo "" >> $OUTPSUM ; fi         else echo "" >> $OUTPSUM ; fi
454      fi      fi
455    

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.22