/[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.39 by jmc, Wed Jul 10 16:32:53 2013 UTC revision 1.40 by jmc, Thu Aug 22 21:32:54 2013 UTC
# Line 39  usage() Line 39  usage()
39  make_resdir_list()  make_resdir_list()
40  {  {
41        if test $monthDir == 1 ; then        if test $monthDir == 1 ; then
42          dir_list=`grep '.._'$mname ./dir_all`          dir_list=`grep '.._'$mname $TMP.dir_all`
43        else        else
44          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//' )`
45          #echo "dir_list='$dir_list'"          #echo "dir_list='$dir_list'"
# Line 186  make_resdir_list() Line 186  make_resdir_list()
186              day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`              day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`
187    
188              if [ $day -lt $BEFORE ] ; then              if [ $day -lt $BEFORE ] ; then
189                  echo "$OPTFILE$order $day $OPTFILE $kind $i" >> ./plist                  echo "$OPTFILE$order $day $OPTFILE $kind $i" >> $TMP.plist
190              elif [ $day -ge $FIRSTDAY -a $day -le $LASTDAY ] ; then              elif [ $day -ge $FIRSTDAY -a $day -le $LASTDAY ] ; then
191                  echo "$OPTFILE$order $day $OPTFILE $kind $i" >> ./slist                  echo "$OPTFILE$order $day $OPTFILE $kind $i" >> $TMP.slist
192              else              else
193                  if test $dBug = 't' ; then                  if test $dBug = 't' ; then
194                     echo "discard day='$day' from: $i" | tee -a $OUTPFIL                     echo "discard day='$day' from: $i" | tee -a $OUTPFIL
# Line 199  make_resdir_list() Line 199  make_resdir_list()
199          if test $dBug = 't' ; then          if test $dBug = 't' ; then
200            if test $monthDir == 1 ; then            if test $monthDir == 1 ; then
201              echo "---- current list (n=$monthDir) :" | tee -a $OUTPFIL              echo "---- current list (n=$monthDir) :" | tee -a $OUTPFIL
202                  cat ./slist | tee -a $OUTPFIL                  cat $TMP.slist | tee -a $OUTPFIL
203            fi            fi
204            num1=`wc -l ./slist | awk '{print $1}'`            num1=`wc -l $TMP.slist | awk '{print $1}'`
205            if test $num1 -gt 0 ; then            if test $num1 -gt 0 ; then
206            echo   ".... previous list (n=$monthDir):" | tee -a $OUTPFIL            echo   ".... previous list (n=$monthDir):" | tee -a $OUTPFIL
207                  cat ./plist | tee -a $OUTPFIL | head -20                  cat $TMP.plist | tee -a $OUTPFIL | head -20
208            fi            fi
209            echo "----" | tee -a $OUTPFIL            echo "----" | tee -a $OUTPFIL
210          fi          fi
# Line 242  for ac_option ; do Line 242  for ac_option ; do
242      fi      fi
243    
244      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`      ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
   
245      case $ac_option in      case $ac_option in
246                    
247          -help | --help | -h | --h) usage ;;          -help | --help | -h | --h) usage ;;
# Line 272  for ac_option ; do Line 271  for ac_option ; do
271    
272          *) echo "Error: don't understand argument \"$ac_option\""          *) echo "Error: don't understand argument \"$ac_option\""
273             usage ;;             usage ;;
   
274       esac       esac
275    
276  done  done
277    
278    #TMP=./chkoutp_$$
279    #- try to put temporary files in system-local /tmp dir
280    TMP=/tmp/chkoutp_$$
281    touch $TMP ; retVal=$?
282    if [ $retVal -eq 0 ] ; then
283      if test ! -r $TMP ; then TMP=./chkoutp_$$ ; fi
284    else
285      TMP=./chkoutp_$$
286    fi
287    rm -f $TMP
288    if test $dBug = 't' ; then echo "temp files: $TMP" ; fi
289    
290  #-- test FIRSTDAY content ; interpret as "date -d" arg. if not YYYYMMDD  #-- test FIRSTDAY content ; interpret as "date -d" arg. if not YYYYMMDD
291  ttt=`echo "y$FIRSTDAY" | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/z/'`  ttt=`echo "y$FIRSTDAY" | sed 's/[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/z/'`
292  if test "x$ttt" != 'xyz' ; then  if test "x$ttt" != 'xyz' ; then
# Line 319  if test $t4update = 1 ; then Line 330  if test $t4update = 1 ; then
330      if test $PRC_MAILS -ot $OUTPSUM ; then      if test $PRC_MAILS -ot $OUTPSUM ; then
331        echo ' '$CMDLINE | tee -a $OUTPSUM        echo ' '$CMDLINE | tee -a $OUTPSUM
332        echo " t4update: skip "`basename $0`" ( $PRC_MAILS older than $OUTPSUM )" | tee -a $OUTPSUM        echo " t4update: skip "`basename $0`" ( $PRC_MAILS older than $OUTPSUM )" | tee -a $OUTPSUM
333        echo "End  time:   "`date` | tee -a $OUTPSUM        echo " End  time:  "`date` | tee -a $OUTPSUM
334        exit 0        exit 0
335      else      else
336        if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi        if test -e $OUTPFIL ; then mv -f $OUTPFIL $OUTPFIL'_bak' ; fi
# Line 372  fi Line 383  fi
383  echo "    Machine   Tot. Nb.   no    Nb with  Nb diff" >> $OUTPSUM  echo "    Machine   Tot. Nb.   no    Nb with  Nb diff" >> $OUTPSUM
384  echo "     name     checked   comp    Diff    lines"  >> $OUTPSUM  echo "     name     checked   comp    Diff    lines"  >> $OUTPSUM
385    
386  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > ./dir_all  ( cd $INDIR ; ls -1 -t */summary.txt | sed 's/\/summary.txt//' ) > $TMP.dir_all
387    
388  if test "x$MACHINES" = "x_All_" ; then  if test "x$MACHINES" = "x_All_" ; then
389    MACHINES="aces- acesgrid baudelaire dickens danton beagle"    MACHINES="aces- acesgrid baudelaire dickens danton beagle"
390    MACHINES="$MACHINES pleiades iblade sx8 uv100 solasrv stomp weber"    MACHINES="$MACHINES pleiades iblade sx8 uv100 solasrv stomp weber"
391    
392    MALL=`cat ./dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`    MALL=`cat $TMP.dir_all | sed -e 's|_| |g' | awk '{print $2}' | sort | uniq`
393    for madd in $MALL ; do    for madd in $MALL ; do
394      present=0      present=0
395      for m in $MACHINES ; do      for m in $MACHINES ; do
# Line 407  for pname in $MACHINES ; do Line 418  for pname in $MACHINES ; do
418      echo " name='$pname'" >> $OUTPFIL      echo " name='$pname'" >> $OUTPFIL
419      ctot=0 ; cmis=0 ; cdif=0      ctot=0 ; cmis=0 ; cdif=0
420    
421      # put results from selected period in "slist",      # put results from selected period in "TMP.slist",
422      #     results from previous period in "plist"      #     results from previous period in "TMP.plist"
423      rm -f ./plist ./slist ; touch ./plist ./slist      rm -f $TMP.plist $TMP.slist ; touch $TMP.plist $TMP.slist
424    
425      #- create list of results (slist & plist) from current month directory      #- create list of results (slist & plist) from current month directory
426      monthDir=1      monthDir=1
427      make_resdir_list      make_resdir_list
428    
429      #  Do we have any data?  If so, create the latest pointer.      #  Do we have any data?  If so, create the latest pointer.
430      num=`wc -l ./slist | awk '{print $1}'`      num=`wc -l $TMP.slist | awk '{print $1}'`
431      if test $num -gt 0 ; then      if test $num -gt 0 ; then
432    
433          keys=`cat ./slist | cut -d " " -f 1 | sort | uniq`          keys=`cat $TMP.slist | cut -d " " -f 1 | sort | uniq`
434    
435          for key in $keys ; do          for key in $keys ; do
436            ctot=`expr $ctot + 1`            ctot=`expr $ctot + 1`
437            sline=`grep "^$key " ./slist | head -1`            sline=`grep "^$key " $TMP.slist | head -1`
438            sdir=`echo $sline | cut -d " " -f 5`            sdir=`echo $sline | cut -d " " -f 5`
439            type=`echo $sline | cut -d " " -f 4`            type=`echo $sline | cut -d " " -f 4`
440            optf=`echo $sline | cut -d " " -f 3`            optf=`echo $sline | cut -d " " -f 3`
441            num=`grep -c "^$key" ./plist`            num=`grep -c "^$key" $TMP.plist`
442            if test $num = 0 -a $monthDir = 1 ; then            if test $num = 0 -a $monthDir = 1 ; then
443            #- add results from previous month directory to "plist".            #- add results from previous month directory to "plist".
444              monthDir=2              monthDir=2
445              make_resdir_list              make_resdir_list
446              num=`grep -c "^$key" ./plist`              num=`grep -c "^$key" $TMP.plist`
447            fi            fi
448            #- discard unsafe test:            #- discard unsafe test:
449            dd=`echo $optf | grep -c 'gfortran+mth'`            dd=`echo $optf | grep -c 'gfortran+mth'`
# Line 449  for pname in $MACHINES ; do Line 460  for pname in $MACHINES ; do
460              echo "no previous test for:" $key | tee -a $OUTPFIL              echo "no previous test for:" $key | tee -a $OUTPFIL
461              cmis=`expr $cmis + 1`              cmis=`expr $cmis + 1`
462            else            else
463              pline=`grep "^$key " ./plist | head -1`              pline=`grep "^$key " $TMP.plist | head -1`
464              if test $dBug = 't' ; then              if test $dBug = 't' ; then
465                  echo "s='$sline'" | tee -a $OUTPFIL                  echo "s='$sline'" | tee -a $OUTPFIL
466                  echo "p='$pline'" | tee -a $OUTPFIL                  echo "p='$pline'" | tee -a $OUTPFIL
# Line 458  for pname in $MACHINES ; do Line 469  for pname in $MACHINES ; do
469              outs="$INDIR/$sdir/summary.txt"              outs="$INDIR/$sdir/summary.txt"
470              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outs ) | tail -1`              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outs ) | tail -1`
471              sed "1,$xx d" $outs | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \              sed "1,$xx d" $outs | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \
472                                  | grep -v '^[A-S][a-t]* time:  ' > tmpfs                                  | grep -v '^[A-S][a-t]* time:  ' > $TMP.fs
473              outp="$INDIR/$pdir/summary.txt"              outp="$INDIR/$pdir/summary.txt"
474              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outp ) | tail -1`              xx=`( echo 5 ; sed -n '/^  OPTFILE=/=' $outp ) | tail -1`
475              sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \              sed "1,$xx d" $outp | sed '/^[YN] [YN] [YN] [YN]/ s/ \. //g' \
476                                  | grep -v '^[A-S][a-t]* time:  ' > tmpfp                                  | grep -v '^[A-S][a-t]* time:  ' > $TMP.fp
477              #-- check if list of exp are the same (and in the same order)              #-- check if list of exp are the same (and in the same order)
478              sed 's/  (e=.*, w=.*)$//' tmpfs > tmpfn              sed 's/  (e=.*, w=.*)$//' $TMP.fs > $TMP.fn
479              listDs=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'`              listDs=`grep '^[YN] [YN] [YN] [YN]' $TMP.fn | awk '{print $NF}'`
480              #mv -f tmpfn tmpfs              #mv -f $TMP.fn $TMP.fs
481              rm -f tmpfn              rm -f $TMP.fn
482              sed 's/  (e=.*, w=.*)$//' tmpfp > tmpfn              sed 's/  (e=.*, w=.*)$//' $TMP.fp > $TMP.fn
483              listDp=`grep '^[YN] [YN] [YN] [YN]' tmpfn | awk '{print $NF}'`              listDp=`grep '^[YN] [YN] [YN] [YN]' $TMP.fn | awk '{print $NF}'`
484              #mv -f tmpfn tmpfp              #mv -f $TMP.fn $TMP.fp
485              rm -f tmpfn              rm -f $TMP.fn
486              #echo "listDs='$listDs'" ;  echo "listDp='$listDp'"              #echo "listDs='$listDs'" ;  echo "listDp='$listDp'"
487              if test "$listDs" != "$listDp" ; then              if test "$listDs" != "$listDp" ; then
488                  if test $dBug = 't' ; then echo ' -> re-order list of exp' ; fi                  if test $dBug = 't' ; then echo ' -> re-order list of exp' ; fi
489                  #-- re-order list of exp (according to local "sort" order)                  #-- re-order list of exp (according to local "sort" order)
490                  listDs=`echo "$listDs" | sort`                  listDs=`echo "$listDs" | sort`
491                  for xx in $listDs ; do                  for xx in $listDs ; do
492                      sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfs > tmpfn                      sed -e "/ $xx\$/d" -e "/ $xx /d" $TMP.fs > $TMP.fn
493                      sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfs >> tmpfn                      sed -n -e "/ $xx\$/p" -e "/ $xx /p" $TMP.fs >> $TMP.fn
494                      mv -f tmpfn tmpfs                      mv -f $TMP.fn $TMP.fs
495                  done                  done
496                  listDp=`echo "$listDp" | sort`                  listDp=`echo "$listDp" | sort`
497                  for xx in $listDp ; do                  for xx in $listDp ; do
498                      sed -e "/ $xx\$/d" -e "/ $xx /d" tmpfp > tmpfn                      sed -e "/ $xx\$/d" -e "/ $xx /d" $TMP.fp > $TMP.fn
499                      sed -n -e "/ $xx\$/p" -e "/ $xx /p" tmpfp >> tmpfn                      sed -n -e "/ $xx\$/p" -e "/ $xx /p" $TMP.fp >> $TMP.fn
500                      mv -f tmpfn tmpfp                      mv -f $TMP.fn $TMP.fp
501                  done                  done
502              #else              #else
503              #   echo 'same list of exp => skip re-ordering'              #   echo 'same list of exp => skip re-ordering'
504              fi              fi
505              echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL              echo -n "=== diff $sdir $pdir :" | tee -a $OUTPFIL
506              diff tmpfs tmpfp > tmpdf              diff $TMP.fs $TMP.fp > $TMP.dif
507              yy=$?              yy=$?
508              if test $yy != '0' ; then              if test $yy != '0' ; then
509                  echo " $type , of='$optf'" | tee -a $OUTPFIL                  echo " $type , of='$optf'" | tee -a $OUTPFIL
510                  #grep '^run: ' $outp                  #grep '^run: ' $outp
511                  #grep '^run: ' $outs                  #grep '^run: ' $outs
512                  #-- score for each test:                  #-- score for each test:
513                  grep '^[YN] [YN] [YN] [YN]' tmpfs > tmploc 2>/dev/null                  grep '^[YN] [YN] [YN] [YN]' $TMP.fs > tmploc 2>/dev/null
514                  t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`                  t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`
515                  t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`                  t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`
516                  score_s=`printf '%2i' $t_pass`":$t_tot"                  score_s=`printf '%2i' $t_pass`":$t_tot"
517                  grep '^[YN] [YN] [YN] [YN]' tmpfp > tmploc 2>/dev/null                  grep '^[YN] [YN] [YN] [YN]' $TMP.fp > tmploc 2>/dev/null
518                  t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`                  t_tot=`cat tmploc | wc -l | sed -e 's| ||g'`
519                  t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`                  t_pass=`grep '^Y Y Y Y' tmploc | grep 'pass ' | wc -l | sed -e 's| ||g'`
520                  score_p=`printf '%2i' $t_pass`":$t_tot"                  score_p=`printf '%2i' $t_pass`":$t_tot"
521                  rm -f tmploc                  rm -f tmploc
522                  #-- count Nb of different lines                  #-- count Nb of different lines
523                  ndf=`wc -l tmpdf | awk '{print $1}'`                  ndf=`wc -l $TMP.dif | awk '{print $1}'`
524                  ndf=`expr $ndf / 2`                  ndf=`expr $ndf / 2`
525                  nn=`grep -c '^---' tmpdf`                  nn=`grep -c '^---' $TMP.dif`
526                  ndf=`expr $ndf - $nn`                  ndf=`expr $ndf - $nn`
527                  if [ $ndf -le $NBLDIFF ] ; then                  if [ $ndf -le $NBLDIFF ] ; then
528                    cat tmpdf                    cat $TMP.dif
529                  else                  else
530                    echo " $ndf lines differ ( $score_s , $score_p )"                    echo " $ndf lines differ ( $score_s , $score_p )"
531                  fi                  fi
532                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL                  echo "< "`head -1 $outs`" ( $score_s )" >> $OUTPFIL
533                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL                  echo "> "`head -1 $outp`" ( $score_p )" >> $OUTPFIL
534                  cat tmpdf >> $OUTPFIL                  cat $TMP.dif >> $OUTPFIL
535                  if [ $cdif -eq 0 ] ; then                  if [ $cdif -eq 0 ] ; then
536                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`                    clin=`printf '%3i (%5s,%5s)' $ndf $score_s $score_p`
537                  else                  else
# Line 531  for pname in $MACHINES ; do Line 542  for pname in $MACHINES ; do
542              else              else
543                  echo " $type , of='$optf'" | tee -a $OUTPFIL                  echo " $type , of='$optf'" | tee -a $OUTPFIL
544              fi              fi
545              rm -f tmpfs tmpfp tmpdf              rm -f $TMP.fs $TMP.fp $TMP.dif
546            fi            fi
547          done          done
548          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi          if [ $cmis -gt 0 ] ; then tmis='(-'$cmis')' ; else tmis='(--)' ; fi
# Line 544  for pname in $MACHINES ; do Line 555  for pname in $MACHINES ; do
555  done  done
556    
557  echo "Start time:  $sTime" | tee -a $OUTPFIL  echo "Start time:  $sTime" | tee -a $OUTPFIL
558  echo "End  time:   "`date` | tee -a $OUTPFIL | tee -a $OUTPSUM  echo "End time:    "`date` | tee -a $OUTPFIL | tee -a $OUTPSUM
559    
560  rm -f ./dir_all ./slist ./plist  rm -f $TMP.dir_all $TMP.slist $TMP.plist
561  if test $OUTPFIL = "TTT.$$" ; then rm -f $OUTPFIL ; fi  if test $OUTPFIL = "TTT.$$" ; then rm -f $OUTPFIL ; fi
562  if test "x$ADDRESS" != 'xnone' ; then  if test "x$ADDRESS" != 'xnone' ; then
563    echo ".. send $OUTPSUM to $ADDRESS"    echo ".. send $OUTPSUM to $ADDRESS"

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

  ViewVC Help
Powered by ViewVC 1.1.22