1 |
jmc |
1.1 |
#! /usr/bin/env bash |
2 |
|
|
|
3 |
jmc |
1.20 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_baudelaire,v 1.19 2013/06/28 15:38:19 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.19 |
# checkOut=2 : download new code ; |
29 |
jmc |
1.20 |
# =3 : skip download but, if sepDir, use a new copy |
30 |
jmc |
1.19 |
# =1 : update code (if no existing code -> swith to 2) |
31 |
|
|
# =0 : use existing code (if no existing code -> swith to 2) |
32 |
jmc |
1.11 |
dInWeek=`date +%a` |
33 |
jmc |
1.20 |
outDir=`hostname -s` |
34 |
|
|
TESTDIR="/scratch/jmc/test_${outDir}" |
35 |
jmc |
1.3 |
MC=13 |
36 |
jmc |
1.19 |
checkOut=2 |
37 |
jmc |
1.1 |
sepDir=1 |
38 |
|
|
option= |
39 |
jmc |
1.20 |
#tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
40 |
|
|
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm oad" ; fi |
41 |
|
|
outDir="${outDir}-a" |
42 |
|
|
tst_list='g7a mpa mth mp2+rs mpi oad' |
43 |
|
|
#outDir="${outDir}-b" |
44 |
|
|
#tst_list='adm g77 gfo+rs ifc' |
45 |
|
|
#if test "x$dInWeek" = xSun ; then tst_list="$tst_list tlm" ; fi |
46 |
jmc |
1.1 |
|
47 |
jmc |
1.19 |
#option="-nc" ; checkOut=1 |
48 |
|
|
#option="-q" ; checkOut=1 |
49 |
jmc |
1.1 |
|
50 |
|
|
TODAY=`date +%d` |
51 |
|
|
tdir=$TESTDIR |
52 |
jmc |
1.19 |
if test $checkOut != 2 ; then |
53 |
jmc |
1.7 |
if test -e $tdir/MITgcm/CVS ; then |
54 |
|
|
echo $tdir/MITgcm/CVS 'exist' |
55 |
jmc |
1.19 |
if test $sepDir = 0 -a $checkOut = 1 ; then |
56 |
jmc |
1.15 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
57 |
|
|
cd $tdir/MITgcm |
58 |
jmc |
1.7 |
$cmdCVS update -P -d |
59 |
jmc |
1.15 |
echo " done" |
60 |
jmc |
1.7 |
fi |
61 |
jmc |
1.1 |
else |
62 |
jmc |
1.7 |
echo -n $tdir/MITgcm 'missing ; ' |
63 |
jmc |
1.19 |
checkOut=2 |
64 |
jmc |
1.1 |
fi |
65 |
|
|
fi |
66 |
jmc |
1.19 |
if test $checkOut = 2 ; then |
67 |
jmc |
1.1 |
if test -e $tdir ; then |
68 |
|
|
echo -n "Removing working copy: $tdir/MITgcm ..." |
69 |
|
|
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
70 |
|
|
else |
71 |
|
|
echo -n "Creating a working dir: $tdir ..." |
72 |
|
|
mkdir $tdir |
73 |
|
|
fi |
74 |
|
|
echo " done" |
75 |
|
|
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
76 |
|
|
cd $tdir |
77 |
|
|
$cmdCVS co -P MITgcm > /dev/null |
78 |
|
|
echo " done" |
79 |
|
|
else |
80 |
|
|
cd $tdir |
81 |
|
|
fi |
82 |
|
|
|
83 |
|
|
#------------------------------------------------------------------------ |
84 |
|
|
|
85 |
|
|
firstTst=`echo $tst_list | awk '{print $1}'` |
86 |
|
|
last_Tst=`echo $tst_list | awk '{print $NF}'` |
87 |
|
|
for tt in $tst_list |
88 |
|
|
do |
89 |
|
|
|
90 |
jmc |
1.5 |
echo "================================================================" |
91 |
|
|
typ=`echo $tt | sed 's/+rs//'` |
92 |
|
|
#- check day and time: |
93 |
|
|
curDay=`date +%d` ; curHour=`date +%H` |
94 |
|
|
if [ $curDay -ne $TODAY ] ; then |
95 |
|
|
date ; echo "day is over => skip test $typ" |
96 |
|
|
continue |
97 |
|
|
fi |
98 |
|
|
if [ $curHour -ge 18 ] ; then |
99 |
|
|
date ; echo "too late to run test $typ" |
100 |
|
|
continue |
101 |
|
|
fi |
102 |
jmc |
1.19 |
if test $sepDir = 0 -a "x$option" != x -a $tt != $last_Tst ; then |
103 |
|
|
echo "using option='$option' prevent multi-tests => skip test $typ" |
104 |
|
|
continue |
105 |
|
|
fi |
106 |
jmc |
1.5 |
#- clean-up old output files |
107 |
|
|
rm -f $tdir/output_${typ}* |
108 |
jmc |
1.12 |
touch $tdir/output_$tt |
109 |
jmc |
1.5 |
if test $sepDir = 1 ; then |
110 |
|
|
new_dir="MITgcm_$typ" |
111 |
jmc |
1.20 |
reUse=1 ; if [ $checkOut -ge 2 ] ; then reUse=0 ; fi |
112 |
|
|
if test -d $new_dir/CVS -a $reUse = 1 ; then |
113 |
jmc |
1.5 |
pushd $new_dir |
114 |
jmc |
1.14 |
if test $tt != $typ ; then |
115 |
|
|
( cd verification ; ../tools/do_tst_2+2 -clean ) |
116 |
|
|
fi |
117 |
jmc |
1.19 |
if test $checkOut = 1 ; then |
118 |
|
|
echo -n "Update the MITgcm code using: $cmdCVS ..." |
119 |
|
|
$cmdCVS update -P -d |
120 |
|
|
echo " done" |
121 |
|
|
fi |
122 |
jmc |
1.5 |
else |
123 |
|
|
test -e $new_dir && rm -rf $new_dir |
124 |
|
|
mkdir $new_dir |
125 |
|
|
pushd $new_dir |
126 |
|
|
cp -ra ../MITgcm/* . |
127 |
|
|
fi |
128 |
jmc |
1.1 |
else |
129 |
jmc |
1.5 |
pushd MITgcm |
130 |
jmc |
1.1 |
fi |
131 |
jmc |
1.5 |
cd verification |
132 |
jmc |
1.1 |
|
133 |
jmc |
1.5 |
#-- set the testreport command: |
134 |
jmc |
1.7 |
comm="./testreport" |
135 |
|
|
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
136 |
jmc |
1.12 |
comm="$comm -adm" |
137 |
jmc |
1.18 |
elif test $typ = 'oad' ; then |
138 |
|
|
comm="$comm -oad" |
139 |
jmc |
1.11 |
elif test $typ = 'tlm' ; then |
140 |
jmc |
1.12 |
comm="$comm -tlm" |
141 |
jmc |
1.5 |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
142 |
jmc |
1.4 |
export GOMP_STACKSIZE=400m |
143 |
jmc |
1.5 |
export OMP_NUM_THREADS=2 |
144 |
|
|
comm="$comm -mth" |
145 |
jmc |
1.17 |
else |
146 |
|
|
comm="$comm -md cyrus-makedepend" |
147 |
jmc |
1.5 |
fi |
148 |
jmc |
1.20 |
comm="$comm -odir $outDir -a jmc@mitgcm.org" |
149 |
jmc |
1.5 |
#-- set the optfile (+ mpi & match-precision) |
150 |
|
|
MPI=0 |
151 |
|
|
case $typ in |
152 |
|
|
'g77'|'g7a') OPTFILE='../tools/build_options/linux_amd64_g77' ;; |
153 |
jmc |
1.18 |
'gfo'|'adm'|'oad'|'tlm'|'mth') comm="$comm -match $MC -devel" |
154 |
jmc |
1.11 |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
155 |
jmc |
1.20 |
'ifc') comm="$comm -devel" |
156 |
|
|
OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
157 |
jmc |
1.5 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
158 |
jmc |
1.11 |
'mpa'|'mpi'|'mp2') comm="$comm -match $MC -devel" ; MPI=6 |
159 |
|
|
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
160 |
jmc |
1.5 |
*) OPTFILE= ;; |
161 |
|
|
esac |
162 |
|
|
#-- set MPI command: |
163 |
jmc |
1.8 |
if test $MPI != 0 ; then |
164 |
|
|
if test $typ = 'mp2' ; then MPI=3 ; fi |
165 |
jmc |
1.7 |
if test $typ = 'mpa' ; then |
166 |
jmc |
1.6 |
EXE="mpirun -np TR_NPROC ./mitgcmuv_ad" |
167 |
jmc |
1.5 |
else |
168 |
jmc |
1.6 |
EXE="mpirun -np TR_NPROC ./mitgcmuv" |
169 |
jmc |
1.5 |
fi |
170 |
|
|
fi |
171 |
jmc |
1.1 |
|
172 |
jmc |
1.7 |
#-- set specific Env Vars: |
173 |
jmc |
1.18 |
if test $typ = 'oad' ; then |
174 |
|
|
source ~jmc/mitgcm/bin/setenv_OpenAD.sh |
175 |
|
|
fi |
176 |
jmc |
1.7 |
if test $typ = 'ifc' ; then |
177 |
|
|
source /srv/software/intel/intel-11.1.073/bin/ifortvars.sh intel64 |
178 |
|
|
fi |
179 |
|
|
if test $typ = 'pgi' ; then |
180 |
jmc |
1.8 |
#listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20' |
181 |
jmc |
1.7 |
export PGI=/srv/software/pgi/pgi-10.9 |
182 |
|
|
export PATH="$PATH:$PGI/linux86-64/10.9/bin" |
183 |
|
|
export LM_LICENSE_FILE=$PGI/license.dat |
184 |
|
|
fi |
185 |
|
|
|
186 |
jmc |
1.19 |
if test $sepDir = 0 -a "x$option" = x -a $tt = $firstTst -a $checkOut != 2 ; then |
187 |
jmc |
1.1 |
#-- cleaning: |
188 |
jmc |
1.5 |
echo "======================" |
189 |
jmc |
1.12 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
190 |
jmc |
1.1 |
cmdCLN="./testreport -clean" |
191 |
jmc |
1.12 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
192 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
193 |
jmc |
1.5 |
echo "======================" |
194 |
jmc |
1.12 |
echo "" | tee -a $tdir/output_$tt |
195 |
jmc |
1.1 |
fi |
196 |
|
|
|
197 |
jmc |
1.5 |
#-- run the testreport command: |
198 |
jmc |
1.12 |
echo -n "Running testreport using:" | tee -a $tdir/output_$tt |
199 |
jmc |
1.1 |
if test "x$OPTFILE" != x ; then |
200 |
|
|
comm="$comm -of=$OPTFILE" |
201 |
|
|
fi |
202 |
jmc |
1.12 |
if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt |
203 |
|
|
else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt |
204 |
jmc |
1.8 |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
205 |
|
|
fi |
206 |
jmc |
1.1 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
207 |
jmc |
1.8 |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
208 |
jmc |
1.12 |
echo " \"eval $comm\"" | tee -a $tdir/output_$tt |
209 |
jmc |
1.1 |
echo "======================" |
210 |
jmc |
1.12 |
eval $comm >> $tdir/output_$tt 2>&1 |
211 |
|
|
sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt |
212 |
|
|
echo "" | tee -a $tdir/output_$tt |
213 |
jmc |
1.1 |
|
214 |
jmc |
1.5 |
#-- also test restart (test 2+2=4) |
215 |
|
|
if test $tt != $typ |
216 |
|
|
then |
217 |
jmc |
1.12 |
echo "testing restart using:" | tee -a $tdir/output_$tt |
218 |
jmc |
1.20 |
comm="../tools/do_tst_2+2 -o $outDir -a jmc@mitgcm.org" |
219 |
jmc |
1.8 |
if test $MPI = 0 ; then |
220 |
jmc |
1.12 |
echo " \"$comm\"" | tee -a $tdir/output_$tt |
221 |
jmc |
1.8 |
echo "======================" |
222 |
jmc |
1.12 |
$comm >> $tdir/output_$tt 2>&1 |
223 |
jmc |
1.8 |
else |
224 |
jmc |
1.12 |
echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt |
225 |
jmc |
1.5 |
echo "======================" |
226 |
jmc |
1.12 |
$comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1 |
227 |
jmc |
1.5 |
fi |
228 |
|
|
echo ; cat tst_2+2_out.txt |
229 |
|
|
echo |
230 |
jmc |
1.1 |
fi |
231 |
jmc |
1.5 |
export OMP_NUM_THREADS=1 |
232 |
jmc |
1.1 |
|
233 |
jmc |
1.5 |
if test $sepDir = 0 ; then |
234 |
|
|
#-- cleaning: |
235 |
jmc |
1.7 |
echo "======================" |
236 |
jmc |
1.12 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
237 |
jmc |
1.7 |
if test $tt != $typ ; then |
238 |
|
|
cmdCLN="../tools/do_tst_2+2 -clean" |
239 |
jmc |
1.12 |
echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt |
240 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
241 |
jmc |
1.7 |
fi |
242 |
|
|
if test $tt != $last_Tst ; then |
243 |
|
|
cmdCLN="./testreport -clean" |
244 |
jmc |
1.12 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
245 |
|
|
$cmdCLN >> $tdir/output_$tt 2>&1 |
246 |
jmc |
1.7 |
fi |
247 |
|
|
echo "======================" |
248 |
|
|
echo |
249 |
|
|
fi |
250 |
|
|
popd |
251 |
jmc |
1.1 |
|
252 |
|
|
done |