/[MITgcm]/MITgcm/tools/example_scripts/ACESgrid/aces_test_all
ViewVC logotype

Contents of /MITgcm/tools/example_scripts/ACESgrid/aces_test_all

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


Revision 1.20 - (show annotations) (download)
Wed May 12 21:52:00 2010 UTC (14 years ago) by jmc
Branch: MAIN
CVS Tags: checkpoint62g, checkpoint62i, checkpoint62h
Changes since 1.19: +10 -4 lines
add a g77 Adjoint test (without mpi)

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/aces_test_all,v 1.19 2010/05/11 18:33:32 jmc Exp $
4 # $Name: $
5
6 # action =2 : submit test jobs ; =1 : get jobs output ; =3 : do both
7 case $1 in
8 '-subOnly') action=2 ; shift ;;
9 '-getOnly') action=1 ; shift ;;
10 '-sub+get') action=3 ; shift ;;
11 *) action=3 ;;
12 esac
13 #echo "action= $action , Arg= $# "
14
15 today=`date +%Y%m%d`
16
17 if test $# = 0
18 then
19 tst_list='g77 gnu ifc pgi adm mp2 mth tuv'
20 else
21 tst_list=$*
22 fi
23
24 # QSUB="/usr/local/bin/qsub"
25 # QSTAT="/usr/local/bin/qstat"
26 QSUB=qsub
27 QSTAT=qstat
28 TST_DIR="/home/jmc/test_ACES"
29 MPACK="MITgcm_tools/mpack-1.6/mpack"
30 SUB_DIR="MITgcm_tools/example_scripts/ACESgrid"
31
32 TMP_FIL="$TST_DIR/output/TTT.$$"
33 LOG_FIL="$TST_DIR/output/tst_all."`date +%m%d`".log"
34
35 #-- clean up old log files and start a new one:
36 cd $TST_DIR/output
37
38 rm -f tst_all.*.log_bak
39 if test -f $LOG_FIL ; then mv -f $LOG_FIL ${LOG_FIL}_bak ; fi
40 echo -n '-- Starting: ' | tee -a $LOG_FIL
41 date | tee -a $LOG_FIL
42
43 n=$(( `ls tst_all.*.log | wc -l` - 10 ))
44 if test $n -gt 0 ; then
45 echo ' remove old log files:' | tee -a $LOG_FIL
46 ls -lt tst_all.*.log | tail -"$n" | tee -a $LOG_FIL
47 ls -t tst_all.*.log | tail -"$n" | xargs rm -f
48 fi
49
50 . /etc/profile.d/modules.sh
51 module list >> $LOG_FIL 2>&1
52
53 #-- now really do something:
54 cd $TST_DIR
55
56 nbtst=0
57 for i in $tst_list
58 do
59 case $i in
60 'mth') sfx='ifc_'${i} ;;
61 'tuv') sfx='op64_'${i} ;;
62 'mp2') sfx=${i}'_mth' ;;
63 'g77') sfx=${i}'_adm' ;;
64 *) sfx=${i}'_mpi' ;;
65 esac
66 if test -f $SUB_DIR/aces_test_$sfx ; then
67 JOB="tst_"$i
68 job_exist=`$QSTAT -a | grep $USER | grep $JOB | wc -l`
69 if [ $action -ge 2 ] ; then
70 #-- to submit job
71 if test "x_$job_exist" = x_0 ; then
72 echo -n " $JOB : " | tee -a $LOG_FIL
73 $QSUB $SUB_DIR/aces_test_$sfx | tee -a $LOG_FIL
74 eval M_$i='submitted'
75 nbtst=`expr $nbtst + 1`
76 else
77 echo $JOB | tee -a $LOG_FIL
78 $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
79 echo 'job already exist => skip this test' | tee -a $LOG_FIL
80 eval M_$i='skipped'
81 fi
82 else
83 #-- to get outp back:
84 if test "x_$job_exist" = x_0 ; then
85 echo -n "did not find any job: $JOB" | tee -a $LOG_FIL
86 eval M_$i='skipped'
87 else
88 echo -n "found a job: $JOB" | tee -a $LOG_FIL
89 $QSTAT -a | grep $USER | grep $JOB | tee -a $LOG_FIL
90 eval M_$i='submitted'
91 nbtst=`expr $nbtst + 1`
92 fi
93 fi
94 else
95 echo 'no file:' aces_test_$sfx 'to submit' | tee -a $LOG_FIL
96 eval M_$i='skipped'
97 fi
98 done
99
100 if test $action = 2 ; then
101 count=0
102 else
103 #date_str=`date +%Y%m%d`"_0"
104
105 MPACKDIR=`dirname $MPACK`
106 #- build the mpack utility (from build_mpack in testreport):
107 ( cd $MPACKDIR && ./configure && make ) > TTT.build_mpack.$$ 2>&1
108 RETVAL=$?
109 if test "x$RETVAL" != x0 ; then
110 echo
111 echo "Error building the mpack tools at: $MPACK_DIR" | tee -a $LOG_FIL
112 if test -x $MPACK ; then
113 HAVE_MPACK=t
114 echo " use (old ?) executable:" | tee -a $LOG_FIL
115 ls -l $MPACK | tee -a $LOG_FIL
116 else
117 HAVE_MPACK=f
118 fi
119 else
120 if test -x $MPACK ; then
121 rm -f TTT.build_mpack.$$
122 HAVE_MPACK=t
123 echo " building mpack: OK" | tee -a $LOG_FIL
124 else
125 echo " $MPACK not executable" | tee -a $LOG_FIL
126 HAVE_MPACK=f
127 fi
128 fi
129 echo
130
131 count=$nbtst
132 fi
133
134 #- when it's done, retrieve output and send e-mail
135 minutes=0 ; freq=10
136 fsec=`expr $freq \* 60`
137 echo "Check every $freq mn for $count test(s) to finish" | tee -a $LOG_FIL
138 echo "- start at :" `date` | tee -a $LOG_FIL
139 while test $count != 0 ; do
140
141 sleep $fsec
142 minutes=$(( $minutes + $freq ))
143
144 for i in $tst_list ; do
145
146 eval comm=\$M_$i
147 if test $comm = 'submitted' ; then
148 JOB="tst_"$i
149 $QSTAT -a > $TMP_FIL
150 RETVAL=$?
151 ready_to_send=`grep $USER $TMP_FIL | grep $JOB | wc -l`
152 rm -f $TMP_FIL
153 if test "x$RETVAL" != x0 ; then
154 echo " $QSTAT returned with error code: $RETVAL" | tee -a $LOG_FIL
155 continue
156 fi
157
158 if test "x_$ready_to_send" = x_0 ; then
159 run_dir=${TST_DIR}"/MITgcm_"$i"/verification"
160 #- results output:
161 tdir=`ls -1 -t $run_dir | grep -v tr_out | grep '^tr_aces' | head -1`
162 if test "x$tdir" != x ; then
163 #- check this is the right output
164 chk=`echo $tdir | grep -c $today`
165 if test $chk = '0' ; then
166 curday=`date +%Y%m%d`
167 chk=`echo $tdir | grep -c $curday`
168 fi
169 if test $chk = '0' ; then
170 echo "tdir='$tdir'" | tee -a $LOG_FIL
171 echo "Output do not match, no email sent for $i" | tee -a $LOG_FIL
172 else
173 rm -f "/tmp/tr_aces-"$i".tar.gz"
174 ( cd $run_dir ; tar -czf "/tmp/tr_aces-"$i".tar.gz" ./$tdir )
175 if test "x$HAVE_MPACK" = xt ; then
176 $MPACK -s MITgcm-test -m 3555000 "/tmp/tr_aces-"$i".tar.gz" jmc@mitgcm.org
177 echo "Email sent for $i at: " `date` | tee -a $LOG_FIL
178 else
179 echo " no email sent for $i (no mpack)" | tee -a $LOG_FIL
180 fi
181 fi
182 else
183 echo " no output found for $i" | tee -a $LOG_FIL
184 fi
185 #- restart output:
186 tdir=`ls -1 -t $run_dir | grep -v tr_out | grep '^rs_aces' | head -1`
187 if test "x$tdir" != x ; then
188 #- check this is the right output
189 chk=`echo $tdir | grep -c $today`
190 if test $chk = '0' ; then
191 curday=`date +%Y%m%d`
192 chk=`echo $tdir | grep -c $curday`
193 fi
194 if test $chk = '0' ; then
195 echo "tdir='$tdir'" | tee -a $LOG_FIL
196 echo "Restart output do not match, no email sent for $i" | tee -a $LOG_FIL
197 else
198 rm -f "/tmp/rs_aces-"$i".tar.gz"
199 ( cd $run_dir ; tar -czf "/tmp/rs_aces-"$i".tar.gz" ./$tdir )
200 if test "x$HAVE_MPACK" = xt ; then
201 $MPACK -s MITgcm-test -m 3555000 "/tmp/rs_aces-"$i".tar.gz" jmc@mitgcm.org
202 echo "Email sent for $i restart:" `date` | tee -a $LOG_FIL
203 else
204 echo " no email sent for $i restart (no mpack)" | tee -a $LOG_FIL
205 fi
206 fi
207 else
208 echo " no restart output for $i" | tee -a $LOG_FIL
209 fi
210 #- record successful sending
211 eval M_$i=done
212 count=`expr $count - 1`
213 chmod 644 output/tst_$i.std*
214 fi
215 fi
216 done
217
218 # "long" queue is 24hrs = 24*60min = 1440min
219 if test $minutes -gt 2160 ; then
220 hrs=$(( $minutes / 60 ));
221 echo "Time expired after $minutes minutes ($hrs hours)" | tee -a $LOG_FIL
222 echo ' ' $count '/' $nbtst 'tests not yet finished' | tee -a $LOG_FIL
223 exit 1
224 fi
225
226 done
227
228 echo "Retrieving $nbtst tests finish :" `date` | tee -a $LOG_FIL
229 exit 0

  ViewVC Help
Powered by ViewVC 1.1.22