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