/[MITgcm]/MITgcm/tools/example_scripts/csail/test_baudelaire
ViewVC logotype

Diff of /MITgcm/tools/example_scripts/csail/test_baudelaire

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

revision 1.1 by jmc, Fri Oct 29 21:13:57 2010 UTC revision 1.29 by jmc, Sun Jul 10 14:30:24 2016 UTC
# Line 2  Line 2 
2    
3  # $Header$  # $Header$
4    
5  #  Ed Hill  #  Test script for MITgcm that should work on most of the csail.mit.edu Linux machines.
6    
7  #  Test script for MITgcm that should work on most of the csail.mit.edu  tst_grp=0 ; if test $# = 1 ; then tst_grp=$1 ; fi
8  #  Linux machines.  if test $tst_grp != 'a' -a $tst_grp != 'b' ; then
9      echo "missing or invalid argument (expect: 'a' or 'b') ==> exit"
10      exit 1
11    fi
12    
13  # defaults  # defaults
14  #export PATH="$PATH:/usr/local/bin"  #export PATH="$PATH:/usr/local/bin"
# Line 14  if [ -d ~/bin ]; then export PATH=$PATH: Line 17  if [ -d ~/bin ]; then export PATH=$PATH:
17  export LC_ALL="en_US.UTF-8"  export LC_ALL="en_US.UTF-8"
18  #  Turn off stack limit for FIZHI & AD-tests  #  Turn off stack limit for FIZHI & AD-tests
19  ulimit -s unlimited  ulimit -s unlimited
20    #  MPI test (for now, only with gfortran)
21       export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3
22       export MPI_INC_DIR=$MPI_GCC_DIR/include
23       export PATH="$PATH:$MPI_GCC_DIR/bin"
24    
25  #- method to acces CVS:  #- method to acces CVS:
26   # export CVSROOT='/u/gcmpack'   # export CVSROOT='/u/gcmpack'
# Line 23  ulimit -s unlimited Line 30  ulimit -s unlimited
30  cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack'  cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack'
31  cmdCVS='cvs -d /u/gcmpack'  cmdCVS='cvs -d /u/gcmpack'
32    
33  TESTDIR="/scratch/jmc/test_"`hostname -s`  # checkOut=2 : download new code ;
34  MC=10  #   =3 : skip download but, if sepDir, use a new copy
35  checkOut=1  #   =1 : update code       (if no existing code -> swith to 2)
36    #   =0 : use existing code (if no existing code -> swith to 2)
37    dInWeek=`date +%a`
38    outDir=`hostname -s`
39    TESTDIR="/scratch/jmc/test_${outDir}"
40    outDir="${outDir}-${tst_grp}"
41    MC=13
42  sepDir=1  sepDir=1
43  option=  option=
44  tst_list='g77 adm gfo+rs mth ifc'  #tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc'
45  #tst_list='g77 adm gfo ifc mth pgi+rs'  #if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi
46  #tst_list='adm g77 gfo+rs mth'  if test $tst_grp = 'a' ; then
47     checkOut=2
48     tst_list='g7a mpa mth mp2+rs mpi oad'
49    else
50     checkOut=3
51     tst_list='adm g77 gfo+rs ifc'
52     if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi
53    fi
54    echo " test: $outDir ; list='$tst_list'"
55    
56  #option="-nc" ; checkOut=0  #option="-nc" ; checkOut=1
57  #option="-q"  ; checkOut=0  #option="-q"  ; checkOut=1
58    
59  TODAY=`date +%d`  TODAY=`date +%d`
60  tdir=$TESTDIR  tdir=$TESTDIR
61  if test $checkOut = '0' ; then  if test $checkOut != 2 ; then
62   if test -e $tdir/MITgcm/CVS ; then    if test -e $tdir/MITgcm/CVS ; then
63    echo $tdir/MITgcm/CVS 'exist'      echo $tdir/MITgcm/CVS 'exist'
64    echo -n "Update the MITgcm code using: $cmdCVS ..."      if test $sepDir = 0 -a $checkOut = 1 ; then
65    cd $tdir/MITgcm        echo -n "Update the MITgcm code using: $cmdCVS ..."
66    if test $sepDir = 1 ; then        cd $tdir/MITgcm
67      $cmdCVS update -P -d > /dev/null        $cmdCVS update -P -d
68          echo "  done"
69        fi
70    else    else
71      $cmdCVS update -P -d      echo -n $tdir/MITgcm 'missing ; '
72        checkOut=2
73    fi    fi
   echo "  done"  
  else  
   echo -n $tdir/MITgcm 'missing ; '  
   checkOut=1  
  fi  
74  fi  fi
75  if test $checkOut = '1' ; then  if test $checkOut = 2 ; then
76    if test -e $tdir ; then    if test -e $tdir ; then
77      echo -n "Removing working copy: $tdir/MITgcm ..."      echo -n "Removing working copy: $tdir/MITgcm ..."
78      test -e $tdir/MITgcm  &&  rm -rf $tdir/MITgcm      test -e $tdir/MITgcm  &&  rm -rf $tdir/MITgcm
# Line 66  if test $checkOut = '1' ; then Line 85  if test $checkOut = '1' ; then
85    cd $tdir    cd $tdir
86    $cmdCVS co -P MITgcm > /dev/null    $cmdCVS co -P MITgcm > /dev/null
87    echo "  done"    echo "  done"
88      if test -d other_input ; then
89        list_dirs=`(cd other_input ; ls 2> /dev/null )`
90        echo "Updating ( $cmdCVS update -P -d ) 'other_input' extra dirs:"
91        for exd in $list_dirs ; do
92         if test -d other_input/$exd/CVS ; then echo "  $exd"
93          ( cd other_input/$exd ; $cmdCVS update -P -d )
94         fi
95        done
96        echo " <-- update of 'other_input' dirs done"
97      fi
98  else  else
99    cd $tdir    cd $tdir
100  fi  fi
# Line 77  last_Tst=`echo $tst_list | awk '{print $ Line 106  last_Tst=`echo $tst_list | awk '{print $
106  for tt in $tst_list  for tt in $tst_list
107  do  do
108    
109   echo "================================================================"    echo "================================================================"
110   typ=`echo $tt | sed 's/+rs//'`    typ=`echo $tt | sed 's/+rs//'`
111   #- check day and time:    #- define list of additional experiences to test:
112   curDay=`date +%d` ; curHour=`date +%H`    addExp=''
113   if [ $curDay -ne $TODAY ] ; then    if test $typ = 'mp2' -o $typ = 'ifc' ; then
114     date ; echo "day is over => skip test $typ"      addExp="offline_cheapaml atm_gray"
115     continue    fi
116   fi    if test $typ = 'gfo' -o $typ = 'ifc' ; then
117   if [ $curHour -ge 18 ] ; then      addExp="$addExp global_oce_biogeo_bling"
118     date ; echo "too late to run test $typ"      addExp="$addExp shelfice_remeshing"
119     continue    fi
120   fi    if test $typ = 'mpi' ; then
121   #- clean-up old output files      addExp="$addExp global_oce_cs32"
122   rm -f $tdir/output_${typ}*    fi
123   if test $sepDir = 1 ; then    #- check day and time:
124    new_dir="MITgcm_$typ"    curDay=`date +%d` ; curHour=`date +%H`
125    if test -d $new_dir/CVS -a $checkOut = '0' ; then    if [ $curDay -ne $TODAY ] ; then
126      pushd $new_dir      date ; echo "day is over => skip test $typ"
127      echo -n "Update the MITgcm code using: $cmdCVS ..."      continue
128      $cmdCVS update -P -d    fi
129      echo "  done"    if [ $curHour -ge 18 ] ; then
130        date ; echo "too late to run test $typ"
131        continue
132      fi
133      if test $sepDir = 0 -a "x$option" != x -a  $tt != $last_Tst ; then
134        echo "using option='$option' prevent multi-tests => skip test $typ"
135        continue
136      fi
137      #- clean-up old output files
138      rm -f $tdir/output_${typ}*
139      touch $tdir/output_$tt
140      if test $sepDir = 1 ; then
141        new_dir="MITgcm_$typ"
142        reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi
143        if test -d $new_dir/CVS -a $reUse = 1 ; then
144          pushd $new_dir
145          if test $tt != $typ ; then
146            ( cd verification ; ../tools/do_tst_2+2 -clean )
147          fi
148          if test $checkOut = 1 ; then
149            echo -n "Update the MITgcm code using: $cmdCVS ..."
150            $cmdCVS update -P -d
151            echo "  done"
152          fi
153        else
154          if test -d prev ; then
155          #-- save previous summary:
156            oldS=`ls -t ${new_dir}/verification/tr_${outDir}_*/summary.txt 2> /dev/null | head -1`
157            if test "x$oldS" != x ; then cp -p -f $oldS prev/tr_out.$typ ; fi
158           if test $tt != $typ ; then
159            oldS=`ls -t ${new_dir}/verification/rs_${outDir}_*/summary.txt 2> /dev/null | head -1`
160            if test "x$oldS" != x ; then cp -p -f $oldS prev/rs_out.$typ ; fi
161           fi
162          fi
163          test -e $new_dir  &&  rm -rf $new_dir
164          mkdir $new_dir
165          pushd $new_dir
166          cp -ra ../MITgcm/* .
167          #-- download additional experience from Contrib:
168          for exp2add in $addExp ; do
169            echo " add dir: $exp2add (from Contrib:verification_other)"
170            ( cd verification ;  $cmdCVS co -P -d $exp2add \
171                 MITgcm_contrib/verification_other/$exp2add > /dev/null )
172            if test $exp2add = 'global_oce_cs32' ; then
173              echo " link dir 'other_input/gael_oce_cs32_input' to 'input_fields'"
174              ( cd verification/${exp2add}
175                ln -s ../../../other_input/gael_oce_cs32_input input_fields )
176            fi
177            if test $exp2add = 'shelfice_remeshing' ; then
178              echo " link dir 'other_input/remeshing_code' to 'extra_code'"
179              ( cd verification/${exp2add}
180                ln -s ../../../other_input/remeshing_code extra_code )
181            fi
182          done
183        fi
184    else    else
185      test -e $new_dir  &&  rm -rf $new_dir      pushd MITgcm
     mkdir $new_dir  
     pushd $new_dir  
     cp -ra ../MITgcm/* .  
   fi  
  else  
   pushd MITgcm  
  fi  
  cd verification  
   
  case $typ in  
   'g77') OPTFILE='../tools/build_options/linux_amd64_g77' ;;  
   'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;;  
   'gfo') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;  
   'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;  
   'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort' ;;  
   'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;  
   'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran'  
          export GOMP_STACKSIZE=400m ;;  
    *) OPTFILE= ;;  
  esac  
   
  if test $sepDir = 0 -a $checkOut = '1' -a  $tt = $firstTst ; then  
 #-- cleaning:  
   echo "======================"  
   echo "Cleaning test directories:"  
     cmdCLN="./testreport -clean"  
     echo " clean dir running: $cmdCLN"  
     $cmdCLN > /dev/null 2>&1  
   echo "======================"  
   echo  
  fi  
   
  if test $typ = 'g77'  
  then  
   
   echo "Running testreport using:"  
   comm="./testreport -a jmc@mitgcm.org"  
 # comm="$comm -match $MC"  
   if test "x$OPTFILE" != x ; then  
     comm="$comm -of=$OPTFILE"  
186    fi    fi
187    if test "x$option" != x ; then comm="$comm $option" ; fi    cd verification
188    echo "  \"$comm\""  
189    echo "======================"  #-- set the testreport command:
190    $comm > $tdir/output_$typ 2>&1    comm="./testreport"
191    tail -100 $tdir/output_$typ    if test $typ = 'g7a' -o  $typ = 'adm' -o  $typ = 'mpa' ; then
192    echo      comm="$comm -adm"
193      elif test $typ = 'oad' ; then
194   fi      comm="$comm -oad"
195      elif test $typ = 'tlm' ; then
196   if test $typ = 'gfo'      comm="$comm -tlm"
197   then    elif test $typ = 'mth' -o  $typ = 'mp2' ; then
198        export GOMP_STACKSIZE=400m
199    echo "Running testreport using:"      export OMP_NUM_THREADS=2
200    comm="./testreport -a jmc@mitgcm.org"      comm="$comm -mth"
201    comm="$comm -match $MC"    else
202    if test "x$OPTFILE" != x ; then      comm="$comm -md cyrus-makedepend"
     comm="$comm -of=$OPTFILE"  
203    fi    fi
204    if test "x$option" != x ; then comm="$comm $option" ; fi    comm="$comm -odir $outDir -a jmc@mitgcm.org"
205    echo "  \"$comm\""  #-- set the optfile (+ mpi & match-precision)
206    echo "======================"    MPI=0
207    $comm > $tdir/output_$typ 2>&1    case $typ in
208    tail -100 $tdir/output_$typ     'g77'|'g7a')         OPTFILE='../tools/build_options/linux_amd64_g77' ;;
209    echo     'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel"
210                            OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
211   fi     'ifc')               comm="$comm -devel"
212                            OPTFILE='../tools/build_options/linux_amd64_ifort11' ;;
213   if test $typ = 'adm'     'pgi')               OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;
214   then     'mpa'|'mpi'|'mp2')   comm="$comm -match $MC -devel" ; MPI=6
215                            OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
216    echo "Running testreport using:"         *)               OPTFILE= ;;
217    comm="./testreport -adm -a jmc@mitgcm.org"    esac
218    comm="$comm -match $MC"  #-- set MPI command:
219    if test "x$OPTFILE" != x ; then    if test $MPI != 0 ; then
220      comm="$comm -of=$OPTFILE"      if test $typ = 'mp2' ; then MPI=3 ; fi
221        if test $typ = 'mpa' ; then
222          EXE="mpirun -np TR_NPROC ./mitgcmuv_ad"
223        else
224          EXE="mpirun -np TR_NPROC ./mitgcmuv"
225        fi
226      fi
227    
228    #-- set specific Env Vars:
229      if test $typ = 'oad' ; then
230        source ~jmc/mitgcm/bin/setenv_OpenAD.sh
231      fi
232      if test $typ = 'ifc' ; then
233        source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64
234      fi
235      if test $typ = 'pgi' ; then
236       #listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20'
237        export PGI=/srv/software/pgi/pgi-10.9
238        export PATH="$PATH:$PGI/linux86-64/10.9/bin"
239        export LM_LICENSE_FILE=$PGI/license.dat
240    fi    fi
241    if test "x$option" != x ; then comm="$comm $option" ; fi  
242    echo "  \"$comm\""    if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then
243    echo "======================"  #-- cleaning:
244    $comm > $tdir/output_$typ 2>&1      echo "======================"
245    tail -60 $tdir/output_$typ      echo "Cleaning test directories:"   | tee -a $tdir/output_$tt
246    echo      cmdCLN="./testreport -clean"
247        echo " clean dir running: $cmdCLN"  | tee -a $tdir/output_$tt
248   fi      $cmdCLN >> $tdir/output_$tt 2>&1
249        echo "======================"
250   if test $typ = 'ifc'      echo ""                             | tee -a $tdir/output_$tt
  then  
   
   source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64  
   echo "Running testreport using:"  
   comm="./testreport -a jmc@mitgcm.org"  
   comm="$comm -match $MC"  
   if test "x$OPTFILE" != x ; then  
     comm="$comm -of=$OPTFILE"  
251    fi    fi
252    if test "x$option" != x ; then comm="$comm $option" ; fi  
253    echo "  \"$comm\""  #-- run the testreport command:
254    echo "======================"    echo -n "Running testreport using:"   | tee -a $tdir/output_$tt
   $comm > $tdir/output_$typ 2>&1  
   tail -100 $tdir/output_$typ  
   echo  
   
  fi  
   
  if test $typ = 'mth'  
  then  
   
   export OMP_NUM_THREADS=2  
   echo "Running testreport using:"  
   comm="./testreport -mth -a jmc@mitgcm.org"  
   comm="$comm -match $MC"  
255    if test "x$OPTFILE" != x ; then    if test "x$OPTFILE" != x ; then
256      comm="$comm -of=$OPTFILE"      comm="$comm -of=$OPTFILE"
257    fi    fi
258    if test "x$option" != x ; then comm="$comm $option" ; fi    if test $MPI = 0 ; then  echo ''      | tee -a $tdir/output_$tt
259    echo "  \"$comm\""    else echo " (EXE='$EXE')"             | tee -a $tdir/output_$tt
260    echo "======================"      comm="$comm -MPI $MPI -command \"\$EXE\""
   $comm > $tdir/output_$typ 2>&1  
   tail -100 $tdir/output_$typ  
   echo  
   
  fi  
   
  if test $typ = 'pgi'  
  then  
   
   export PGI=/srv/software/pgi/pgi-10.9  
   export PATH=$PGI/linux86-64/10.9/bin:$PATH  
   export LM_LICENSE_FILE=$PGI/license.dat  
   echo "Running testreport using:"  
   comm="./testreport -dd"  
   comm="$comm -match $MC"  
   #comm="$comm -skd tutorial_advection_in_gyre"  
   if test "x$OPTFILE" != x ; then  
     comm="$comm -of=$OPTFILE"  
261    fi    fi
262    if test "x$option" != x ; then comm="$comm $option" ; fi    if test "x$option" != x ; then comm="$comm $option" ; fi
263    echo "  \"$comm\""   #if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi
264    echo "======================"    echo "  \"eval $comm\""               | tee -a $tdir/output_$tt
   $comm > $tdir/output_${typ}_1 2>&1  
   tail -100 $tdir/output_${typ}_1  
   echo  
   echo "Running testreport using:"  
   comm="./testreport -q -a jmc@mitgcm.org"  
   comm="$comm -match $MC"  
   #comm="$comm -skd tutorial_advection_in_gyre"  
   if test "x$OPTFILE" != x ; then  
     comm="$comm -of=$OPTFILE"  
   fi  
   echo "  \"$comm\""  
265    echo "======================"    echo "======================"
266    $comm > $tdir/output_${typ}_2 2>&1    eval $comm >> $tdir/output_$tt 2>&1
267    tail -100 $tdir/output_${typ}_2    sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt
268    echo    echo ""                               | tee -a $tdir/output_$tt
   
  fi  
269    
270  #-- also test restart (test 2+2=4)  #-- also test restart (test 2+2=4)
271   if test $tt != $typ    if test $tt != $typ
272   then    then
273     echo "testing restart using:"      echo "testing restart using:"       | tee -a $tdir/output_$tt
274     comm="../tools/do_tst_2+2 -a jmc@mitgcm.org"      comm="../tools/do_tst_2+2 -o $outDir -a jmc@mitgcm.org"
275     echo "  \"$comm\""      if test $MPI = 0 ; then
276     echo "======================"        echo "  \"$comm\""                | tee -a $tdir/output_$tt
277     $comm > $tdir/output_2+2 2>&1        echo "======================"
278    #tail -100 $tdir/output_2+2        $comm >> $tdir/output_$tt 2>&1
279     echo ; cat tst_2+2_out.txt      else
280     echo        echo "  \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt
281   fi        echo "======================"
282   export OMP_NUM_THREADS=1        $comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1
283        fi
284        echo ; cat tst_2+2_out.txt
285        echo
286      fi
287      export OMP_NUM_THREADS=1
288    
289   if test $sepDir = 0 ; then    if test $sepDir = 0 ; then
290  #-- cleaning:  #-- cleaning:
291    echo "======================"      echo "======================"
292    echo "Cleaning test directories:"      echo "Cleaning test directories:"   | tee -a $tdir/output_$tt
293    if test $tt != $typ ; then      if test $tt != $typ ; then
294      cmdCLN="../tools/do_tst_2+2 -clean"        cmdCLN="../tools/do_tst_2+2 -clean"
295      echo " clean tst_2+2 running: $cmdCLN"        echo " clean tst_2+2 running: $cmdCLN"    | tee -a $tdir/output_$tt
296      $cmdCLN >> $tdir/output_2+2 2>&1        $cmdCLN >> $tdir/output_$tt 2>&1
297        fi
298        if test $tt != $last_Tst ; then
299          cmdCLN="./testreport -clean"
300          echo " clean dir running: $cmdCLN"        | tee -a $tdir/output_$tt
301          $cmdCLN >> $tdir/output_$tt 2>&1
302        fi
303        echo "======================"
304        echo
305    fi    fi
306    if test $tt != $last_Tst ; then    popd
     cmdCLN="./testreport -clean"  
     echo " clean dir running: $cmdCLN"  
     $cmdCLN > /dev/null 2>&1  
   fi  
   echo "======================"  
   echo  
  fi  
  popd  
307    
308  done  done

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.22