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

Annotation of /MITgcm/tools/example_scripts/csail/test_baudelaire

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


Revision 1.12 - (hide annotations) (download)
Tue Aug 21 18:15:07 2012 UTC (11 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.11: +27 -28 lines
improve report to log file

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.12 # $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.11 2012/08/16 17:12:17 jmc Exp $
4 jmc 1.1
5     # Test script for MITgcm that should work on most of the csail.mit.edu
6     # Linux machines.
7    
8     # defaults
9     #export PATH="$PATH:/usr/local/bin"
10     if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi
11     #- to get case insensitive "ls" (and order of tested experiments)
12     export LC_ALL="en_US.UTF-8"
13     # Turn off stack limit for FIZHI & AD-tests
14     ulimit -s unlimited
15 jmc 1.4 # MPI test (for now, only with gfortran)
16     export MPI_GCC_DIR=/srv/software/gcc/gcc-packages/gcc-4.4.5/mpich2/mpich2-1.3
17     export MPI_INC_DIR=$MPI_GCC_DIR/include
18     export PATH="$PATH:$MPI_GCC_DIR/bin"
19 jmc 1.1
20     #- method to acces CVS:
21     # export CVSROOT='/u/gcmpack'
22     # export CVSROOT=':ext:@mitgcm.org:/u/gcmpack'
23     # export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null
24     # cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null
25     cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack'
26     cmdCVS='cvs -d /u/gcmpack'
27    
28 jmc 1.11 dInWeek=`date +%a`
29 jmc 1.1 TESTDIR="/scratch/jmc/test_"`hostname -s`
30 jmc 1.3 MC=13
31 jmc 1.1 checkOut=1
32     sepDir=1
33     option=
34 jmc 1.4 tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc'
35 jmc 1.11 if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi
36 jmc 1.1 #tst_list='g77 adm gfo ifc mth pgi+rs'
37 jmc 1.9 #tst_list='adm gfo+rs mth'
38 jmc 1.1
39     #option="-nc" ; checkOut=0
40     #option="-q" ; checkOut=0
41    
42     TODAY=`date +%d`
43     tdir=$TESTDIR
44     if test $checkOut = '0' ; then
45 jmc 1.7 if test -e $tdir/MITgcm/CVS ; then
46     echo $tdir/MITgcm/CVS 'exist'
47     echo -n "Update the MITgcm code using: $cmdCVS ..."
48     cd $tdir/MITgcm
49     if test $sepDir = 1 ; then
50     $cmdCVS update -P -d > /dev/null
51     else
52     $cmdCVS update -P -d
53     fi
54     echo " done"
55 jmc 1.1 else
56 jmc 1.7 echo -n $tdir/MITgcm 'missing ; '
57     checkOut=1
58 jmc 1.1 fi
59     fi
60     if test $checkOut = '1' ; then
61     if test -e $tdir ; then
62     echo -n "Removing working copy: $tdir/MITgcm ..."
63     test -e $tdir/MITgcm && rm -rf $tdir/MITgcm
64     else
65     echo -n "Creating a working dir: $tdir ..."
66     mkdir $tdir
67     fi
68     echo " done"
69     echo -n "Downloading the MITgcm code using: $cmdCVS ..."
70     cd $tdir
71     $cmdCVS co -P MITgcm > /dev/null
72     echo " done"
73     else
74     cd $tdir
75     fi
76    
77     #------------------------------------------------------------------------
78    
79     firstTst=`echo $tst_list | awk '{print $1}'`
80     last_Tst=`echo $tst_list | awk '{print $NF}'`
81     for tt in $tst_list
82     do
83    
84 jmc 1.5 echo "================================================================"
85     typ=`echo $tt | sed 's/+rs//'`
86     #- check day and time:
87     curDay=`date +%d` ; curHour=`date +%H`
88     if [ $curDay -ne $TODAY ] ; then
89     date ; echo "day is over => skip test $typ"
90     continue
91     fi
92     if [ $curHour -ge 18 ] ; then
93     date ; echo "too late to run test $typ"
94     continue
95     fi
96     #- clean-up old output files
97     rm -f $tdir/output_${typ}*
98 jmc 1.12 touch $tdir/output_$tt
99 jmc 1.5 if test $sepDir = 1 ; then
100     new_dir="MITgcm_$typ"
101     if test -d $new_dir/CVS -a $checkOut = '0' ; then
102     pushd $new_dir
103     echo -n "Update the MITgcm code using: $cmdCVS ..."
104     $cmdCVS update -P -d
105     echo " done"
106     else
107     test -e $new_dir && rm -rf $new_dir
108     mkdir $new_dir
109     pushd $new_dir
110     cp -ra ../MITgcm/* .
111     fi
112 jmc 1.1 else
113 jmc 1.5 pushd MITgcm
114 jmc 1.1 fi
115 jmc 1.5 cd verification
116 jmc 1.1
117 jmc 1.5 #-- set the testreport command:
118 jmc 1.7 comm="./testreport"
119     if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then
120 jmc 1.12 comm="$comm -adm"
121 jmc 1.11 elif test $typ = 'tlm' ; then
122 jmc 1.12 comm="$comm -tlm"
123 jmc 1.5 elif test $typ = 'mth' -o $typ = 'mp2' ; then
124 jmc 1.4 export GOMP_STACKSIZE=400m
125 jmc 1.5 export OMP_NUM_THREADS=2
126     comm="$comm -mth"
127     fi
128     comm="$comm -a jmc@mitgcm.org"
129     #-- set the optfile (+ mpi & match-precision)
130     MPI=0
131     case $typ in
132     'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;;
133 jmc 1.11 'gfo'|'adm'|'tlm'|'mth') comm="$comm -match $MC -devel"
134     OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
135 jmc 1.5 'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;;
136     'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;;
137 jmc 1.11 'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6
138     OPTFILE='../tools/build_options/linux_amd64_gfortran' ;;
139 jmc 1.5 *) OPTFILE= ;;
140     esac
141     #-- set MPI command:
142 jmc 1.8 if test $MPI != 0 ; then
143     if test $typ = 'mp2' ; then MPI=3 ; fi
144 jmc 1.7 if test $typ = 'mpa' ; then
145 jmc 1.6 EXE="mpirun -np TR_NPROC ./mitgcmuv_ad"
146 jmc 1.5 else
147 jmc 1.6 EXE="mpirun -np TR_NPROC ./mitgcmuv"
148 jmc 1.5 fi
149     fi
150 jmc 1.1
151 jmc 1.7 #-- set specific Env Vars:
152     if test $typ = 'ifc' ; then
153     source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64
154     fi
155     if test $typ = 'pgi' ; then
156 jmc 1.8 #listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20'
157 jmc 1.7 export PGI=/srv/software/pgi/pgi-10.9
158     export PATH="$PATH:$PGI/linux86-64/10.9/bin"
159     export LM_LICENSE_FILE=$PGI/license.dat
160     fi
161 jmc 1.12 basename $OPTFILE | grep gfortran > /dev/null 2>&1 ; retv=$? ;
162     GFORTRAN_OPTFILE=f ; if test $retv == 0 ; then GFORTRAN_OPTFILE='t' ; fi
163 jmc 1.10 export GFORTRAN_OPTFILE
164 jmc 1.7
165 jmc 1.5 if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then
166 jmc 1.1 #-- cleaning:
167 jmc 1.5 echo "======================"
168 jmc 1.12 echo "Cleaning test directories:" | tee -a $tdir/output_$tt
169 jmc 1.1 cmdCLN="./testreport -clean"
170 jmc 1.12 echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
171     $cmdCLN >> $tdir/output_$tt 2>&1
172 jmc 1.5 echo "======================"
173 jmc 1.12 echo "" | tee -a $tdir/output_$tt
174 jmc 1.1 fi
175    
176 jmc 1.5 #-- run the testreport command:
177 jmc 1.12 echo -n "Running testreport using:" | tee -a $tdir/output_$tt
178 jmc 1.1 if test "x$OPTFILE" != x ; then
179     comm="$comm -of=$OPTFILE"
180     fi
181 jmc 1.12 if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt
182     else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt
183 jmc 1.8 comm="$comm -MPI $MPI -command \"\$EXE\""
184     fi
185 jmc 1.1 if test "x$option" != x ; then comm="$comm $option" ; fi
186 jmc 1.8 #if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi
187 jmc 1.12 echo " \"eval $comm\"" | tee -a $tdir/output_$tt
188 jmc 1.1 echo "======================"
189 jmc 1.12 eval $comm >> $tdir/output_$tt 2>&1
190     sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt
191     echo "" | tee -a $tdir/output_$tt
192 jmc 1.1
193 jmc 1.5 #-- also test restart (test 2+2=4)
194     if test $tt != $typ
195     then
196 jmc 1.12 echo "testing restart using:" | tee -a $tdir/output_$tt
197 jmc 1.5 comm="../tools/do_tst_2+2 -a jmc@mitgcm.org"
198 jmc 1.8 if test $MPI = 0 ; then
199 jmc 1.12 echo " \"$comm\"" | tee -a $tdir/output_$tt
200 jmc 1.8 echo "======================"
201 jmc 1.12 $comm >> $tdir/output_$tt 2>&1
202 jmc 1.8 else
203 jmc 1.12 echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt
204 jmc 1.5 echo "======================"
205 jmc 1.12 $comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1
206 jmc 1.5 fi
207     echo ; cat tst_2+2_out.txt
208     echo
209 jmc 1.1 fi
210 jmc 1.5 export OMP_NUM_THREADS=1
211 jmc 1.1
212 jmc 1.5 if test $sepDir = 0 ; then
213     #-- cleaning:
214 jmc 1.7 echo "======================"
215 jmc 1.12 echo "Cleaning test directories:" | tee -a $tdir/output_$tt
216 jmc 1.7 if test $tt != $typ ; then
217     cmdCLN="../tools/do_tst_2+2 -clean"
218 jmc 1.12 echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt
219     $cmdCLN >> $tdir/output_$tt 2>&1
220 jmc 1.7 fi
221     if test $tt != $last_Tst ; then
222     cmdCLN="./testreport -clean"
223 jmc 1.12 echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt
224     $cmdCLN >> $tdir/output_$tt 2>&1
225 jmc 1.7 fi
226     echo "======================"
227     echo
228     fi
229     popd
230 jmc 1.1
231     done

  ViewVC Help
Powered by ViewVC 1.1.22