/[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.20 by jmc, Wed Dec 23 17:15:22 2009 UTC revision 1.25 by jmc, Fri Oct 29 20:18:55 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 22  usage() Line 22  usage()
22      echo "                         [def=\"$FIRSTDAY\"]"      echo "                         [def=\"$FIRSTDAY\"]"
23      echo "  (-u |-upto )LASTDAY   until last day=\"YYYYMMDD\" (=selected period)"      echo "  (-u |-upto )LASTDAY   until last day=\"YYYYMMDD\" (=selected period)"
24      echo "                         [def=\"FIRSTDAY\"]"      echo "                         [def=\"FIRSTDAY\"]"
25        echo "  (-b |-before)BEFORE   compare with output from before \"YYYYMMDD\""
26        echo "                         (=previous period) [def=\"FIRSTDAY\"]"
27      echo "  (-o |-outp )OUTPFIL   output file (-1 removed when exit)"      echo "  (-o |-outp )OUTPFIL   output file (-1 removed when exit)"
28      echo "                         [def=\"$OUTPFIL\"]"      echo "                         [def=\"$OUTPFIL\"]"
29      echo "  (-n |-nldf )NBLDIFF   max number of diff lines to echo"      echo "  (-n |-nldf )NBLDIFF   max number of diff lines to echo"
30      echo "                         [def=\"$NBLDIFF\"]"      echo "                         [def=\"$NBLDIFF\"]"
31      echo "  (-a |-addr )ADDRESS   send summary to mail ADDRESS list"      echo "  (-a |-addr )ADDRESS   send summary to mail ADDRESS list"
32      echo "                         [def=\"$ADDRESS\"]"      echo "                         [def=\"$ADDRESS\"]"
33      echo      echo
34      exit 1      exit 1
35  }  }
36    
# Line 36  usage() Line 38  usage()
38  make_resdir_list()  make_resdir_list()
39  {  {
40        if test $monthDir == 1 ; then        if test $monthDir == 1 ; then
41          dir_list=`grep $mname ./dir_all`          dir_list=`grep '.._'$mname ./dir_all`
42        else        else
43          dir_list=`( cd $INDIR ; ls -1 -t ../$PREV_P/*${mname}*/summary.txt 2> /dev/null | sed 's/\/summary.txt//' )`          dir_list=`( cd $INDIR ; ls -1 -t ../$PREV_P/??_*${mname}*/summary.txt 2> /dev/null | sed 's/\/summary.txt//' )`
44          #echo "dir_list='$dir_list'"          #echo "dir_list='$dir_list'"
45        fi        fi
46          for i in $dir_list ; do          for i in $dir_list ; do
47    
48              dir=$INDIR"/"$i              dir=$INDIR"/"$i
49                #--- get the opfile used to run testreport
50              OPTFILE=              OPTFILE=
51              if test -r $dir/summary.txt ; then              if test -r $dir/summary.txt ; then
52                  comm=`grep 'OPTFILE=' $dir/summary.txt`                  comm=`grep 'OPTFILE=' $dir/summary.txt`
53                  eval $comm                  eval $comm
                 OPTFILE=${OPTFILE##*/}  
54              fi              fi
55              if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then              if test "x$OPTFILE" = x -a -r "$dir/genmake_state" ; then
56                  comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`                  comm=`grep 'OPTFILE=' $dir/genmake_state 2>/dev/null`
57                  eval $comm                  eval $comm
                 OPTFILE=${OPTFILE##*/}  
58              fi              fi
59              if test "x$OPTFILE" = x ; then              if test "x$OPTFILE" = x ; then
60                  comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`                  comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
61                  comm=${comm##*#}                  comm=${comm##*#}
62                  eval $comm                  eval $comm
                 OPTFILE=${OPTFILE##*/}  
63              fi              fi
64              if test "x$OPTFILE" = x ; then              if test "x$OPTFILE" = x ; then
65                  OPTFILE="not_explicitly_specified"                  OPTFILE="not_explicitly_specified"
66                else
67                    OPTFILE=${OPTFILE##*/}
68                fi
69                #--- case select test run by 1 user: get user who did run testreport
70                if test "x$sUser" != x ; then
71                    tUser=
72                    if test -f $dir/genmake_state ; then
73                       nn=`sed -n '/^# executed by:/=' $dir/genmake_state`
74                       if test "x$nn" != x ; then
75                         nn=`expr $nn + 1`
76                         tUser=`sed -n "$nn s/^# *// p" $dir/genmake_state | sed 's/@.*$//'`
77                       fi
78                    fi
79                    if test "x$tUser" = "x" ; then
80                       mkfile=`ls $dir/*/Makefile* 2>/dev/null | head -1`
81                       if test "x$mkfile" = 'x' ; then
82                         echo "no Makefile => discard test from: $i" | tee -a $OUTPFIL
83                         continue
84                       fi
85                       nn=`sed -n '/^# executed by:/=' $mkfile`
86                       if test "x$nn" != x ; then
87                         nn=`expr $nn + 1`
88                         tUser=`sed -n "$nn s/^# *// p" $mkfile | sed 's/@.*$//'`
89                       fi
90                    fi
91                    if test "x$tUser" = x ; then
92                         echo "no User found => discard test from: $i" | tee -a $OUTPFIL
93                         continue
94                    fi
95                    if test $tUser != $sUser ; then
96                       if test $dBug = 't' ; then
97                            echo "  discard test from: $i" | tee -a $OUTPFIL
98                       fi
99                       continue
100                    fi
101              fi              fi
102    
103              ADJOINT=              ADJOINT=
# Line 93  make_resdir_list() Line 128  make_resdir_list()
128              ttt=`echo $day | 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]$//'`
129              day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`              day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`
130    
131              if [ $day -lt $FIRSTDAY ] ; then              if [ $day -lt $BEFORE ] ; then
132                  echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist                  echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist
133              elif [ $day -le $LASTDAY ] ; then              elif [ $day -ge $FIRSTDAY -a $day -le $LASTDAY ] ; then
134                  echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist                  echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist
135              else              else
136                  if test $dBug = 't' ; then                  if test $dBug = 't' ; then
# Line 127  CURR_DAY=`date +%Y%m%d` Line 162  CURR_DAY=`date +%Y%m%d`
162  MACHINES='_All_'  MACHINES='_All_'
163  FIRSTDAY=$CURR_DAY  FIRSTDAY=$CURR_DAY
164  LASTDAY="30000000"  LASTDAY="30000000"
165    BEFORE="30000000"
166  OUTPFIL=`basename $0`'.log'  OUTPFIL=`basename $0`'.log'
167  NBLDIFF=5  NBLDIFF=5
168  ADDRESS='none'  ADDRESS='none'
# Line 170  for ac_option ; do Line 206  for ac_option ; do
206          -upto=* | --upto=*)          -upto=* | --upto=*)
207              LASTDAY=$ac_optarg ;;              LASTDAY=$ac_optarg ;;
208    
209            -before | --before | -b | --b)
210                ac_prev=BEFORE ;;
211            -before=* | --before=*)
212                BEFORE=$ac_optarg ;;
213    
214          -outp | --outp | -o | --o)          -outp | --outp | -o | --o)
215              ac_prev=OUTPFIL ;;              ac_prev=OUTPFIL ;;
216          -outp=* | --outp=*)          -outp=* | --outp=*)
# Line 204  if test "x$ttt" != 'xyz' ; then Line 245  if test "x$ttt" != 'xyz' ; then
245    exit 2    exit 2
246  fi  fi
247  if test $LASTDAY = "30000000" ; then LASTDAY=$FIRSTDAY ; fi  if test $LASTDAY = "30000000" ; then LASTDAY=$FIRSTDAY ; fi
248    if test  $BEFORE = "30000000" ; then  BEFORE=$FIRSTDAY ; fi
249  CMDLINE=$0  CMDLINE=$0
250  for xx in "$@" ; do nw=`echo $xx | wc -w`  for xx in "$@" ; do nw=`echo $xx | wc -w`
251    if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"    if test $nw = '1' ; then CMDLINE="$CMDLINE $xx"
252                        else CMDLINE="$CMDLINE '$xx'" ; fi                        else CMDLINE="$CMDLINE '$xx'" ; fi
253  done  done
254    
255  PERIOD=`echo $FIRSTDAY | sed 's/[0-9][0-9]$//'`  PERIOD=`echo $LASTDAY | sed 's/[0-9][0-9]$//'`
256  PP=`expr $PERIOD - 1`  PP=`expr $PERIOD - 1`
257  PM=`echo $PP | sed 's/^[0-9][0-9][0-9][0-9]//'`  PM=`echo $PP | sed 's/^[0-9][0-9][0-9][0-9]//'`
258  PY=`echo $PP | sed 's/[0-9][0-9]$//'`  PY=`echo $PP | sed 's/[0-9][0-9]$//'`
# Line 231  echo "CMDLINE='$CMDLINE'" > $OUTPFIL Line 273  echo "CMDLINE='$CMDLINE'" > $OUTPFIL
273  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL  echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'" >> $OUTPFIL
274  echo "INDIR='$INDIR'" >> $OUTPFIL  echo "INDIR='$INDIR'" >> $OUTPFIL
275  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL  echo "Checking latest output from $FIRSTDAY until $LASTDAY" >> $OUTPFIL
276    echo "  versus latest from before $BEFORE" >> $OUTPFIL
277    
278  if test $dBug = 't' ; then  if test $dBug = 't' ; then
279    echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'"    echo "PERIOD='$PERIOD' , PREV_P='$PREV_P'"
280    echo "FIRSTDAY='$FIRSTDAY' , LASTDAY='$LASTDAY'"    echo "FIRSTDAY='$FIRSTDAY' , LASTDAY='$LASTDAY' , BEFORE='$BEFORE'"
281  fi  fi
282  if test -d $INDIR ; then  if test -d $INDIR ; then
283    dirP=`echo $INDIR | sed "s/$PERIOD/$PREV_P/"`    dirP=`echo $INDIR | sed "s/$PERIOD/$PREV_P/"`
# Line 250  else Line 293  else
293  fi  fi
294    
295  #- a short summary of this checking :  #- a short summary of this checking :
296  OUTPSUM=`echo $FIRSTDAY | sed 's/^20../_/'`  OUTPSUM=`echo $LASTDAY | sed 's/^20../_/'`
297  OUTPSUM=`basename $0`"$OUTPSUM.txt"  OUTPSUM=`basename $0`"$OUTPSUM.txt"
298  if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi  if test -e $OUTPSUM ; then mv -f $OUTPSUM $OUTPSUM'_bak' ; fi
299  echo ' '$CMDLINE > $OUTPSUM  echo ' '$CMDLINE > $OUTPSUM
# Line 260  if test $FIRSTDAY = $LASTDAY ; then Line 303  if test $FIRSTDAY = $LASTDAY ; then
303  else  else
304    echo -n "Checking latest output from $FIRSTDAY until $LASTDAY" | tee -a $OUTPSUM    echo -n "Checking latest output from $FIRSTDAY until $LASTDAY" | tee -a $OUTPSUM
305  fi  fi
306  echo " versus latest prior to this period" | tee -a $OUTPSUM  if test $FIRSTDAY = $BEFORE ; then
307      echo " versus latest prior to this period" | tee -a $OUTPSUM
308    else
309      echo " versus latest from before $BEFORE" | tee -a $OUTPSUM
310    fi
311  echo "    Machine   Tot. Nb.   no    Nb with  Nb diff" >> $OUTPSUM  echo "    Machine   Tot. Nb.   no    Nb with  Nb diff" >> $OUTPSUM
312  echo "     name     checked   comp    Diff    lines"  >> $OUTPSUM  echo "     name     checked   comp    Diff    lines"  >> $OUTPSUM
313    
314  ( 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
315    
316  if test "x$MACHINES" = "x_All_" ; then  if test "x$MACHINES" = "x_All_" ; then
317    MACHINES="faulks meander lagoon harbor dickens danton aces"    MACHINES="faulks meander aces.jmc aces.ce107 baudelaire dickens danton beagle harbor"
318    MACHINES="$MACHINES beagle columbia pleiades edvir rays solasrv sx8 xd1"    MACHINES="$MACHINES columbia pleiades iblade rays solssrv solasrv sx8"
319    MACHINES="$MACHINES bigred starp"    MACHINES="$MACHINES trane dodongo dokdo bigred"
320    
321    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`
322    for madd in $MALL ; do    for madd in $MALL ; do
323      present=0      present=0
324      for m in $MACHINES ; do      for m in $MACHINES ; do
325          echo $madd | grep $m > /dev/null 2>&1          mm=`echo $m | sed 's/\./ /g' | awk '{print $1}'`
326            echo $madd | grep $mm > /dev/null 2>&1
327          RETVAL=$?          RETVAL=$?
328          test $RETVAL = 0  &&  present=1          test $RETVAL = 0  &&  present=1
329          continue          continue
# Line 283  if test "x$MACHINES" = "x_All_" ; then Line 331  if test "x$MACHINES" = "x_All_" ; then
331      test $present = 0  &&  MACHINES="$MACHINES $madd"      test $present = 0  &&  MACHINES="$MACHINES $madd"
332    done    done
333  fi  fi
334    #echo "MACHINES=$MACHINES" ; exit
335    
336    for pname in $MACHINES ; do
337    
338  for mname in $MACHINES ; do      mname=`echo $pname | sed 's/\./ /g' | awk '{print $1}'`
339        sUser=
340        if test $mname != $pname ; then
341          # to select results from user "sUser"
342          sUser=`echo $pname | sed 's/\./ /g' | awk '{print $2}'`
343        fi
344    
345      if test $dBug = 't' ; then echo "  $mname" ; fi      if test $dBug = 't' ; then echo "  $pname" ; fi
346      echo " name='$mname'" >> $OUTPFIL      echo " name='$pname'" >> $OUTPFIL
347      ctot=0 ; cmis=0 ; cdif=0      ctot=0 ; cmis=0 ; cdif=0
348    
349      # put results from selected period in "slist",      # put results from selected period in "slist",
350      #     results from previous period in "plist"      #     results from previous period in "plist"
351      rm -f ./plist ./slist ; touch ./plist ./slist      rm -f ./plist ./slist ; touch ./plist ./slist
352    
# Line 319  for mname in $MACHINES ; do Line 375  for mname in $MACHINES ; do
375            fi            fi
376            #- discard unsafe test:            #- discard unsafe test:
377            dd=`echo $optf | grep -c 'gfortran+mth'`            dd=`echo $optf | grep -c 'gfortran+mth'`
378            #if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi            if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi
379            #if test $mname = 'harbor' -a $dd = 1 ; then num=-1 ; fi            if test $mname = 'harbor' -a $dd = 1 ; then num=-1 ; fi
380            #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
381            #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
382            dd=`echo $optf | grep -c 'bigred.*+mth'`            dd=`echo $optf | grep -c 'bigred.*noieee'`
383            #if test $mname = 'bigred' -a $dd = 1 ; then num=-1 ; fi            if test $mname = 'bigred' -a $dd = 1 ; then num=-1 ; fi
384            if test $num -lt 0 ; then            if test $num -lt 0 ; then
385              echo "  discard $sdir : $type , of='$optf'" | tee -a $OUTPFIL              echo "  discard $sdir : $type , of='$optf'" | tee -a $OUTPFIL
386              cmis=`expr $cmis + 1`              cmis=`expr $cmis + 1`
# Line 333  for mname in $MACHINES ; do Line 389  for mname in $MACHINES ; do
389              cmis=`expr $cmis + 1`              cmis=`expr $cmis + 1`
390            else            else
391              pline=`grep "^$key " ./plist | head -1`              pline=`grep "^$key " ./plist | head -1`
392              if test $dBug = 't' ; then              if test $dBug = 't' ; then
393                  echo "s='$sline'" | tee -a $OUTPFIL                  echo "s='$sline'" | tee -a $OUTPFIL
394                  echo "p='$pline'" | tee -a $OUTPFIL                  echo "p='$pline'" | tee -a $OUTPFIL
395              fi              fi
# Line 391  for mname in $MACHINES ; do Line 447  for mname in $MACHINES ; do
447                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL
448                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL
449                  cat tmpdf >> $OUTPFIL                  cat tmpdf >> $OUTPFIL
450                  if [ $cdif -eq 0 ] ; then                  if [ $cdif -eq 0 ] ; then
451                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
452                  else                  else
453                    clin="$clin,"`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`                    clin="$clin,"`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
454                  fi                  fi
455                  cdif=`expr $cdif + 1`                  cdif=`expr $cdif + 1`
# Line 405  for mname in $MACHINES ; do Line 461  for mname in $MACHINES ; do
461            fi            fi
462          done          done
463          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi
464          printf '%11s :  %3i      %4s   %3i  ' $mname $ctot $tmis $cdif >> $OUTPSUM          printf '%11s :  %3i      %4s   %3i  ' $pname $ctot $tmis $cdif >> $OUTPSUM
465          if [ $cdif -gt 0 ] ; then          if [ $cdif -gt 0 ] ; then
466            echo "   $clin" >> $OUTPSUM            echo "   $clin" >> $OUTPSUM
467         else echo "" >> $OUTPSUM ; fi         else echo "" >> $OUTPSUM ; fi
468      fi      fi
469    

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.25

  ViewVC Help
Powered by ViewVC 1.1.22