/[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.16 by jmc, Thu Jul 9 19:12:56 2009 UTC
# Line 32  usage() Line 32  usage()
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                OPTFILE=
48                if test -r $dir/summary.txt ; then
49                    comm=`grep 'OPTFILE=' $dir/summary.txt`
50                    eval $comm
51                    OPTFILE=${OPTFILE##*/}
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                    OPTFILE=${OPTFILE##*/}
57                fi
58                if test "x$OPTFILE" = x ; then
59                    comm=`grep '^# OPTFILE=' $dir/*/Makefile* 2>/dev/null | head -1`
60                    comm=${comm##*#}
61                    eval $comm
62                    OPTFILE=${OPTFILE##*/}
63                fi
64                if test "x$OPTFILE" = x ; then
65                    OPTFILE="not_explicitly_specified"
66                fi
67    
68                ADJOINT=
69                RESTART=0
70                NOI3E=0
71                MTH=0
72                if test -r $dir/summary.txt ; then
73                    comm=`grep 'ADJOINT=true' $dir/summary.txt 2>/dev/null`
74                    eval $comm
75                    RESTART=`grep -c 'test 2+2=4 summary' $dir/summary.txt`
76                    NOI3E=`grep -c "^run: .*testreport.* '*-noieee'*" $dir/summary.txt`
77                    MTH=`grep -c "^run: .*testreport.* -mth" $dir/summary.txt`
78                fi
79                if test "x$RESTART" = x0 ; then
80                    kind="forward"
81                    test "x$ADJOINT" = xtrue  &&  kind="adjoint"
82                else
83                    kind="restart"
84                fi
85                if test "x$MTH" = x1 ; then
86                    yy=`echo $OPTFILE | grep -c '+mth$'`
87                    if test $yy = 0 ; then OPTFILE="${OPTFILE}+mth" ; fi
88                fi
89                if test "x$NOI3E" = x1 ; then
90                    OPTFILE="${OPTFILE}.noieee"
91                fi
92                day=`echo $i   | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
93                ttt=`echo $day | sed -e 's/_[0-9]$//' | sed -e 's/_[0-9][0-9]$//'`
94                day=`echo $ttt | sed -e 's|_| |g' |awk '{print $NF}'`
95    
96                if [ $day -lt $FIRSTDAY ] ; then
97                    echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./plist
98                elif [ $day -le $LASTDAY ] ; then
99                    echo "$OPTFILE$kind $day $OPTFILE $kind $i" >> ./slist
100                else
101                    if test $dBug = 't' ; then
102                       echo "discard day='$day' from: $i" | tee -a $OUTPFIL
103                    fi
104                fi
105    
106            done
107            if test $dBug = 't' ; then
108              if test $monthDir == 1 ; then
109                echo "---- current list (n=$monthDir) :" | tee -a $OUTPFIL
110                    cat ./slist | tee -a $OUTPFIL
111              fi
112              num1=`wc -l ./slist | awk '{print $1}'`
113              if test $num1 -gt 0 ; then
114              echo   ".... previous list (n=$monthDir):" | tee -a $OUTPFIL
115                    cat ./plist | tee -a $OUTPFIL | head -20
116              fi
117              echo "----" | tee -a $OUTPFIL
118            fi
119    }
120    
121    #--------------------------------------------------------------------------
122    # here starts the sequential part of the script:
123    
124  #CURR_PER=`date +%Y`"_"`date +%m`  #CURR_PER=`date +%Y`"_"`date +%m`
125  CURR_DAY=`date +%Y%m%d`  CURR_DAY=`date +%Y%m%d`
126  # defaults  # defaults
# Line 205  for mname in $MACHINES ; do Line 294  for mname in $MACHINES ; do
294      #     results from previous period in "plist"      #     results from previous period in "plist"
295      rm -f ./plist ./slist ; touch ./plist ./slist      rm -f ./plist ./slist ; touch ./plist ./slist
296    
297      for n in $listNum ; do      #- create list of results (slist & plist) from current month directory
298        num1=`wc -l ./slist | awk '{print $1}'`      monthDir=1
299        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  
300    
301      #  Do we have any data?  If so, create the latest pointer.      #  Do we have any data?  If so, create the latest pointer.
302      num=`wc -l ./slist | awk '{print $1}'`      num=`wc -l ./slist | awk '{print $1}'`
# Line 308  for mname in $MACHINES ; do Line 311  for mname in $MACHINES ; do
311            kind=`echo $sline | cut -d " " -f 4`            kind=`echo $sline | cut -d " " -f 4`
312            optf=`echo $sline | cut -d " " -f 3`            optf=`echo $sline | cut -d " " -f 3`
313            num=`grep -c "^$key" ./plist`            num=`grep -c "^$key" ./plist`
314              if test $num = 0 -a $monthDir = 1 ; then
315              #- add results from previous month directory to "plist".
316                monthDir=2
317                make_resdir_list
318                num=`grep -c "^$key" ./plist`
319              fi
320            #- discard unsafe test:            #- discard unsafe test:
321            dd=`echo $optf | grep -c 'gfortran.*mth'`            dd=`echo $optf | grep -c 'gfortran.*mth'`
322            #if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi            #if test $mname = 'lagoon' -a $dd = 1 ; then num=-1 ; fi

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

  ViewVC Help
Powered by ViewVC 1.1.22