1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
|
|
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_faulks,v 1.16 2010/09/18 00:07:53 jmc Exp $ |
4 |
|
|
|
5 |
|
|
# Ed Hill |
6 |
|
|
|
7 |
|
|
# Test script for MITgcm that should work on most of the csail.mit.edu |
8 |
|
|
# Linux machines. |
9 |
|
|
|
10 |
|
|
# defaults |
11 |
|
|
#export PATH="$PATH:/usr/local/bin" |
12 |
|
|
if [ -d ~/bin ]; then export PATH=$PATH:~/bin ; fi |
13 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
14 |
|
|
export LC_ALL="en_US.UTF-8" |
15 |
|
|
# Turn off stack limit for FIZHI & AD-tests |
16 |
|
|
ulimit -s unlimited |
17 |
|
|
|
18 |
|
|
#- method to acces CVS: |
19 |
|
|
# export CVSROOT='/u/gcmpack' |
20 |
|
|
# export CVSROOT=':ext:@mitgcm.org:/u/gcmpack' |
21 |
|
|
# export CVS_RSH='ssh' ; cvs co -P MITgcm > /dev/null |
22 |
|
|
# cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P MITgcm > /dev/null |
23 |
|
|
cmdCVS='cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack' |
24 |
|
|
cmdCVS='cvs -d /u/gcmpack' |
25 |
|
|
|
26 |
|
|
TESTDIR="/scratch/jmc/test_"`hostname -s` |
27 |
|
|
MC=10 |
28 |
|
|
checkOut=1 |
29 |
|
|
sepDir=1 |
30 |
|
|
option= |
31 |
|
|
tst_list='g77 adm gfo+rs mth ifc' |
32 |
|
|
#tst_list='g77 adm gfo ifc mth pgi+rs' |
33 |
|
|
#tst_list='adm g77 gfo+rs mth' |
34 |
|
|
|
35 |
|
|
#option="-nc" ; checkOut=0 |
36 |
|
|
#option="-q" ; checkOut=0 |
37 |
|
|
|
38 |
|
|
TODAY=`date +%d` |
39 |
|
|
tdir=$TESTDIR |
40 |
|
|
if test $checkOut = '0' ; then |
41 |
|
|
if test -e $tdir/MITgcm/CVS ; then |
42 |
|
|
echo $tdir/MITgcm/CVS 'exist' |
43 |
|
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
44 |
|
|
cd $tdir/MITgcm |
45 |
|
|
if test $sepDir = 1 ; then |
46 |
|
|
$cmdCVS update -P -d > /dev/null |
47 |
|
|
else |
48 |
|
|
$cmdCVS update -P -d |
49 |
|
|
fi |
50 |
|
|
echo " done" |
51 |
|
|
else |
52 |
|
|
echo -n $tdir/MITgcm 'missing ; ' |
53 |
|
|
checkOut=1 |
54 |
|
|
fi |
55 |
|
|
fi |
56 |
|
|
if test $checkOut = '1' ; then |
57 |
|
|
if test -e $tdir ; then |
58 |
|
|
echo -n "Removing working copy: $tdir/MITgcm ..." |
59 |
|
|
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
60 |
|
|
else |
61 |
|
|
echo -n "Creating a working dir: $tdir ..." |
62 |
|
|
mkdir $tdir |
63 |
|
|
fi |
64 |
|
|
echo " done" |
65 |
|
|
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
66 |
|
|
cd $tdir |
67 |
|
|
$cmdCVS co -P MITgcm > /dev/null |
68 |
|
|
echo " done" |
69 |
|
|
else |
70 |
|
|
cd $tdir |
71 |
|
|
fi |
72 |
|
|
|
73 |
|
|
#------------------------------------------------------------------------ |
74 |
|
|
|
75 |
|
|
firstTst=`echo $tst_list | awk '{print $1}'` |
76 |
|
|
last_Tst=`echo $tst_list | awk '{print $NF}'` |
77 |
|
|
for tt in $tst_list |
78 |
|
|
do |
79 |
|
|
|
80 |
|
|
echo "================================================================" |
81 |
|
|
typ=`echo $tt | sed 's/+rs//'` |
82 |
|
|
#- check day and time: |
83 |
|
|
curDay=`date +%d` ; curHour=`date +%H` |
84 |
|
|
if [ $curDay -ne $TODAY ] ; then |
85 |
|
|
date ; echo "day is over => skip test $typ" |
86 |
|
|
continue |
87 |
|
|
fi |
88 |
|
|
if [ $curHour -ge 18 ] ; then |
89 |
|
|
date ; echo "too late to run test $typ" |
90 |
|
|
continue |
91 |
|
|
fi |
92 |
|
|
#- clean-up old output files |
93 |
|
|
rm -f $tdir/output_${typ}* |
94 |
|
|
if test $sepDir = 1 ; then |
95 |
|
|
new_dir="MITgcm_$typ" |
96 |
|
|
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
97 |
|
|
pushd $new_dir |
98 |
|
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
99 |
|
|
$cmdCVS update -P -d |
100 |
|
|
echo " done" |
101 |
|
|
else |
102 |
|
|
test -e $new_dir && rm -rf $new_dir |
103 |
|
|
mkdir $new_dir |
104 |
|
|
pushd $new_dir |
105 |
|
|
cp -ra ../MITgcm/* . |
106 |
|
|
fi |
107 |
|
|
else |
108 |
|
|
pushd MITgcm |
109 |
|
|
fi |
110 |
|
|
cd verification |
111 |
|
|
|
112 |
|
|
case $typ in |
113 |
|
|
'g77') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
114 |
|
|
'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
115 |
|
|
'gfo') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
116 |
|
|
'adm') OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
117 |
|
|
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort' ;; |
118 |
|
|
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
119 |
|
|
'mth') OPTFILE='../tools/build_options/linux_amd64_gfortran' |
120 |
|
|
export GOMP_STACKSIZE=400m ;; |
121 |
|
|
*) OPTFILE= ;; |
122 |
|
|
esac |
123 |
|
|
|
124 |
|
|
if test $sepDir = 0 -a $checkOut = '1' -a $tt = $firstTst ; then |
125 |
|
|
#-- cleaning: |
126 |
|
|
echo "======================" |
127 |
|
|
echo "Cleaning test directories:" |
128 |
|
|
cmdCLN="./testreport -clean" |
129 |
|
|
echo " clean dir running: $cmdCLN" |
130 |
|
|
$cmdCLN > /dev/null 2>&1 |
131 |
|
|
echo "======================" |
132 |
|
|
echo |
133 |
|
|
fi |
134 |
|
|
|
135 |
|
|
if test $typ = 'g77' |
136 |
|
|
then |
137 |
|
|
|
138 |
|
|
echo "Running testreport using:" |
139 |
|
|
comm="./testreport -a jmc@mitgcm.org" |
140 |
|
|
# comm="$comm -match $MC" |
141 |
|
|
if test "x$OPTFILE" != x ; then |
142 |
|
|
comm="$comm -of=$OPTFILE" |
143 |
|
|
fi |
144 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
145 |
|
|
echo " \"$comm\"" |
146 |
|
|
echo "======================" |
147 |
|
|
$comm > $tdir/output_$typ 2>&1 |
148 |
|
|
tail -100 $tdir/output_$typ |
149 |
|
|
echo |
150 |
|
|
|
151 |
|
|
fi |
152 |
|
|
|
153 |
|
|
if test $typ = 'gfo' |
154 |
|
|
then |
155 |
|
|
|
156 |
|
|
echo "Running testreport using:" |
157 |
|
|
comm="./testreport -a jmc@mitgcm.org" |
158 |
|
|
comm="$comm -match $MC" |
159 |
|
|
if test "x$OPTFILE" != x ; then |
160 |
|
|
comm="$comm -of=$OPTFILE" |
161 |
|
|
fi |
162 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
163 |
|
|
echo " \"$comm\"" |
164 |
|
|
echo "======================" |
165 |
|
|
$comm > $tdir/output_$typ 2>&1 |
166 |
|
|
tail -100 $tdir/output_$typ |
167 |
|
|
echo |
168 |
|
|
|
169 |
|
|
fi |
170 |
|
|
|
171 |
|
|
if test $typ = 'adm' |
172 |
|
|
then |
173 |
|
|
|
174 |
|
|
echo "Running testreport using:" |
175 |
|
|
comm="./testreport -adm -a jmc@mitgcm.org" |
176 |
|
|
comm="$comm -match $MC" |
177 |
|
|
if test "x$OPTFILE" != x ; then |
178 |
|
|
comm="$comm -of=$OPTFILE" |
179 |
|
|
fi |
180 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
181 |
|
|
echo " \"$comm\"" |
182 |
|
|
echo "======================" |
183 |
|
|
$comm > $tdir/output_$typ 2>&1 |
184 |
|
|
tail -60 $tdir/output_$typ |
185 |
|
|
echo |
186 |
|
|
|
187 |
|
|
fi |
188 |
|
|
|
189 |
|
|
if test $typ = 'ifc' |
190 |
|
|
then |
191 |
|
|
|
192 |
|
|
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
193 |
|
|
echo "Running testreport using:" |
194 |
|
|
comm="./testreport -a jmc@mitgcm.org" |
195 |
|
|
comm="$comm -match $MC" |
196 |
|
|
if test "x$OPTFILE" != x ; then |
197 |
|
|
comm="$comm -of=$OPTFILE" |
198 |
|
|
fi |
199 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
200 |
|
|
echo " \"$comm\"" |
201 |
|
|
echo "======================" |
202 |
|
|
$comm > $tdir/output_$typ 2>&1 |
203 |
|
|
tail -100 $tdir/output_$typ |
204 |
|
|
echo |
205 |
|
|
|
206 |
|
|
fi |
207 |
|
|
|
208 |
|
|
if test $typ = 'mth' |
209 |
|
|
then |
210 |
|
|
|
211 |
|
|
export OMP_NUM_THREADS=2 |
212 |
|
|
echo "Running testreport using:" |
213 |
|
|
comm="./testreport -mth -a jmc@mitgcm.org" |
214 |
|
|
comm="$comm -match $MC" |
215 |
|
|
if test "x$OPTFILE" != x ; then |
216 |
|
|
comm="$comm -of=$OPTFILE" |
217 |
|
|
fi |
218 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
219 |
|
|
echo " \"$comm\"" |
220 |
|
|
echo "======================" |
221 |
|
|
$comm > $tdir/output_$typ 2>&1 |
222 |
|
|
tail -100 $tdir/output_$typ |
223 |
|
|
echo |
224 |
|
|
|
225 |
|
|
fi |
226 |
|
|
|
227 |
|
|
if test $typ = 'pgi' |
228 |
|
|
then |
229 |
|
|
|
230 |
|
|
export PGI=/srv/software/pgi/pgi-10.9 |
231 |
|
|
export PATH=$PGI/linux86-64/10.9/bin:$PATH |
232 |
|
|
export LM_LICENSE_FILE=$PGI/license.dat |
233 |
|
|
echo "Running testreport using:" |
234 |
|
|
comm="./testreport -dd" |
235 |
|
|
comm="$comm -match $MC" |
236 |
|
|
#comm="$comm -skd tutorial_advection_in_gyre" |
237 |
|
|
if test "x$OPTFILE" != x ; then |
238 |
|
|
comm="$comm -of=$OPTFILE" |
239 |
|
|
fi |
240 |
|
|
if test "x$option" != x ; then comm="$comm $option" ; fi |
241 |
|
|
echo " \"$comm\"" |
242 |
|
|
echo "======================" |
243 |
|
|
$comm > $tdir/output_${typ}_1 2>&1 |
244 |
|
|
tail -100 $tdir/output_${typ}_1 |
245 |
|
|
echo |
246 |
|
|
echo "Running testreport using:" |
247 |
|
|
comm="./testreport -q -a jmc@mitgcm.org" |
248 |
|
|
comm="$comm -match $MC" |
249 |
|
|
#comm="$comm -skd tutorial_advection_in_gyre" |
250 |
|
|
if test "x$OPTFILE" != x ; then |
251 |
|
|
comm="$comm -of=$OPTFILE" |
252 |
|
|
fi |
253 |
|
|
echo " \"$comm\"" |
254 |
|
|
echo "======================" |
255 |
|
|
$comm > $tdir/output_${typ}_2 2>&1 |
256 |
|
|
tail -100 $tdir/output_${typ}_2 |
257 |
|
|
echo |
258 |
|
|
|
259 |
|
|
fi |
260 |
|
|
|
261 |
|
|
#-- also test restart (test 2+2=4) |
262 |
|
|
if test $tt != $typ |
263 |
|
|
then |
264 |
|
|
echo "testing restart using:" |
265 |
|
|
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
266 |
|
|
echo " \"$comm\"" |
267 |
|
|
echo "======================" |
268 |
|
|
$comm > $tdir/output_2+2 2>&1 |
269 |
|
|
#tail -100 $tdir/output_2+2 |
270 |
|
|
echo ; cat tst_2+2_out.txt |
271 |
|
|
echo |
272 |
|
|
fi |
273 |
|
|
export OMP_NUM_THREADS=1 |
274 |
|
|
|
275 |
|
|
if test $sepDir = 0 ; then |
276 |
|
|
#-- cleaning: |
277 |
|
|
echo "======================" |
278 |
|
|
echo "Cleaning test directories:" |
279 |
|
|
if test $tt != $typ ; then |
280 |
|
|
cmdCLN="../tools/do_tst_2+2 -clean" |
281 |
|
|
echo " clean tst_2+2 running: $cmdCLN" |
282 |
|
|
$cmdCLN >> $tdir/output_2+2 2>&1 |
283 |
|
|
fi |
284 |
|
|
if test $tt != $last_Tst ; then |
285 |
|
|
cmdCLN="./testreport -clean" |
286 |
|
|
echo " clean dir running: $cmdCLN" |
287 |
|
|
$cmdCLN > /dev/null 2>&1 |
288 |
|
|
fi |
289 |
|
|
echo "======================" |
290 |
|
|
echo |
291 |
|
|
fi |
292 |
|
|
popd |
293 |
|
|
|
294 |
|
|
done |