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