1 |
#! /usr/bin/env bash |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/csail/test_dickens,v 1.22 2012/12/14 02:43:04 jmc Exp $ |
4 |
|
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 |
# 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 |
|
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 |
dInWeek=`date +%a` |
29 |
TESTDIR="/tmp/jmc/test_"`hostname -s` |
30 |
MC=13 |
31 |
checkOut=1 |
32 |
sepDir=0 |
33 |
option= |
34 |
#tst_list='g7a adm mpa g77 gfo+rs mth mp2+rs mpi ifc' |
35 |
#tst_list='g77 adm gfo ifc mth pgi+rs' |
36 |
tst_list='g77 gfo+rs mth' |
37 |
|
38 |
#option="-nc" ; checkOut=0 |
39 |
#option="-q" ; checkOut=0 |
40 |
|
41 |
TODAY=`date +%d` |
42 |
tdir=$TESTDIR |
43 |
if test $checkOut = '0' ; then |
44 |
if test -e $tdir/MITgcm/CVS ; then |
45 |
echo $tdir/MITgcm/CVS 'exist' |
46 |
if test $sepDir = 0 ; then |
47 |
echo -n "Update the MITgcm code using: $cmdCVS ..." |
48 |
cd $tdir/MITgcm |
49 |
$cmdCVS update -P -d |
50 |
echo " done" |
51 |
fi |
52 |
else |
53 |
echo -n $tdir/MITgcm 'missing ; ' |
54 |
checkOut=1 |
55 |
fi |
56 |
fi |
57 |
if test $checkOut = '1' ; then |
58 |
if test -e $tdir ; then |
59 |
echo -n "Removing working copy: $tdir/MITgcm ..." |
60 |
test -e $tdir/MITgcm && rm -rf $tdir/MITgcm |
61 |
else |
62 |
echo -n "Creating a working dir: $tdir ..." |
63 |
mkdir $tdir |
64 |
fi |
65 |
echo " done" |
66 |
echo -n "Downloading the MITgcm code using: $cmdCVS ..." |
67 |
cd $tdir |
68 |
$cmdCVS co -P MITgcm > /dev/null |
69 |
echo " done" |
70 |
else |
71 |
cd $tdir |
72 |
fi |
73 |
|
74 |
#------------------------------------------------------------------------ |
75 |
|
76 |
firstTst=`echo $tst_list | awk '{print $1}'` |
77 |
last_Tst=`echo $tst_list | awk '{print $NF}'` |
78 |
for tt in $tst_list |
79 |
do |
80 |
|
81 |
echo "================================================================" |
82 |
typ=`echo $tt | sed 's/+rs//'` |
83 |
#- check day and time: |
84 |
curDay=`date +%d` ; curHour=`date +%H` |
85 |
if [ $curDay -ne $TODAY ] ; then |
86 |
date ; echo "day is over => skip test $typ" |
87 |
continue |
88 |
fi |
89 |
if [ $curHour -ge 18 ] ; then |
90 |
date ; echo "too late to run test $typ" |
91 |
continue |
92 |
fi |
93 |
#- clean-up old output files |
94 |
rm -f $tdir/output_${typ}* |
95 |
touch $tdir/output_$tt |
96 |
if test $sepDir = 1 ; then |
97 |
new_dir="MITgcm_$typ" |
98 |
if test -d $new_dir/CVS -a $checkOut = '0' ; then |
99 |
pushd $new_dir |
100 |
if test $tt != $typ ; then |
101 |
( cd verification ; ../tools/do_tst_2+2 -clean ) |
102 |
fi |
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 |
else |
113 |
pushd MITgcm |
114 |
fi |
115 |
cd verification |
116 |
|
117 |
#-- set the testreport command: |
118 |
comm="./testreport" |
119 |
if test $typ = 'g7a' -o $typ = 'adm' -o $typ = 'mpa' ; then |
120 |
comm="$comm -adm" |
121 |
elif test $typ = 'tlm' ; then |
122 |
comm="$comm -tlm" |
123 |
elif test $typ = 'mth' -o $typ = 'mp2' ; then |
124 |
export GOMP_STACKSIZE=400m |
125 |
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 |
'gfo'|'adm'|'tlm'|'mth') comm="$comm -match $MC" |
134 |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
135 |
'ifc') OPTFILE='../tools/build_options/linux_amd64_ifort11' ;; |
136 |
'pgi') OPTFILE='../tools/build_options/linux_amd64_pgf77' ;; |
137 |
'mpa'|'mpi'|'mp2') comm="$comm -match $MC" ; MPI=6 |
138 |
OPTFILE='../tools/build_options/linux_amd64_gfortran' ;; |
139 |
*) OPTFILE= ;; |
140 |
esac |
141 |
#-- set MPI command: |
142 |
if test $MPI != 0 ; then |
143 |
if test $typ = 'mp2' ; then MPI=3 ; fi |
144 |
if test $typ = 'mpa' ; then |
145 |
EXE="mpirun -np TR_NPROC ./mitgcmuv_ad" |
146 |
else |
147 |
EXE="mpirun -np TR_NPROC ./mitgcmuv" |
148 |
fi |
149 |
fi |
150 |
|
151 |
#-- 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 |
#listT='fizhi-cs-32x32x40 fizhi-cs-aqualev20' |
157 |
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 |
|
162 |
if test $sepDir = 0 -a $checkOut = '0' -a $tt = $firstTst ; then |
163 |
#-- cleaning: |
164 |
echo "======================" |
165 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
166 |
cmdCLN="./testreport -clean" |
167 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
168 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
169 |
echo "======================" |
170 |
echo "" | tee -a $tdir/output_$tt |
171 |
fi |
172 |
|
173 |
#-- run the testreport command: |
174 |
echo -n "Running testreport using:" | tee -a $tdir/output_$tt |
175 |
if test "x$OPTFILE" != x ; then |
176 |
comm="$comm -of=$OPTFILE" |
177 |
fi |
178 |
if test $MPI = 0 ; then echo '' | tee -a $tdir/output_$tt |
179 |
else echo " (EXE='$EXE')" | tee -a $tdir/output_$tt |
180 |
comm="$comm -MPI $MPI -command \"\$EXE\"" |
181 |
fi |
182 |
if test "x$option" != x ; then comm="$comm $option" ; fi |
183 |
#if test $typ = 'pgi' ; then comm="$comm -t \"\$listT\"" ; fi |
184 |
echo " \"eval $comm\"" | tee -a $tdir/output_$tt |
185 |
echo "======================" |
186 |
eval $comm >> $tdir/output_$tt 2>&1 |
187 |
sed -n "/^An email /,/^======== End of testreport / p" $tdir/output_$tt |
188 |
echo "" | tee -a $tdir/output_$tt |
189 |
|
190 |
#-- also test restart (test 2+2=4) |
191 |
if test $tt != $typ |
192 |
then |
193 |
echo "testing restart using:" | tee -a $tdir/output_$tt |
194 |
comm="../tools/do_tst_2+2 -a jmc@mitgcm.org" |
195 |
if test $MPI = 0 ; then |
196 |
echo " \"$comm\"" | tee -a $tdir/output_$tt |
197 |
echo "======================" |
198 |
$comm >> $tdir/output_$tt 2>&1 |
199 |
else |
200 |
echo " \"$comm -mpi -exe $EXE\"" | tee -a $tdir/output_$tt |
201 |
echo "======================" |
202 |
$comm -mpi -exe "$EXE" >> $tdir/output_$tt 2>&1 |
203 |
fi |
204 |
echo ; cat tst_2+2_out.txt |
205 |
echo |
206 |
fi |
207 |
export OMP_NUM_THREADS=1 |
208 |
|
209 |
if test $sepDir = 0 ; then |
210 |
#-- cleaning: |
211 |
echo "======================" |
212 |
echo "Cleaning test directories:" | tee -a $tdir/output_$tt |
213 |
if test $tt != $typ ; then |
214 |
cmdCLN="../tools/do_tst_2+2 -clean" |
215 |
echo " clean tst_2+2 running: $cmdCLN" | tee -a $tdir/output_$tt |
216 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
217 |
fi |
218 |
if test $tt != $last_Tst ; then |
219 |
cmdCLN="./testreport -clean" |
220 |
echo " clean dir running: $cmdCLN" | tee -a $tdir/output_$tt |
221 |
$cmdCLN >> $tdir/output_$tt 2>&1 |
222 |
fi |
223 |
echo "======================" |
224 |
echo |
225 |
fi |
226 |
popd |
227 |
|
228 |
done |