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