3 |
# $Header$ |
# $Header$ |
4 |
# $Name$ |
# $Name$ |
5 |
|
|
6 |
Np=3 |
#- default: |
7 |
#- parse options: |
Npr=3 ; NpOc=1 ; |
8 |
|
#Npr=25; NpOc=12; |
9 |
MTH= |
MTH= |
10 |
MTHo= |
MTHo= |
11 |
MTHa= |
MTHa= |
12 |
|
GMKopt='-ieee' |
13 |
|
#GMKopt= |
14 |
|
rnkO=1 ; rnkA=`expr $rnkO + $NpOc` |
15 |
|
|
16 |
|
#- parse options: |
17 |
if [ $# -ge 1 ] ; then if test $1 = '-mth' ; then |
if [ $# -ge 1 ] ; then if test $1 = '-mth' ; then |
18 |
MTH='-omp' ; shift |
MTH='-omp' ; shift |
19 |
if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi |
if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi |
27 |
echo ' step = 0 : clean all directories' |
echo ' step = 0 : clean all directories' |
28 |
echo ' step = 1 : compile the 3 executables (cpl,ocn,atm)' |
echo ' step = 1 : compile the 3 executables (cpl,ocn,atm)' |
29 |
echo ' step = 2 : copy input files and dir(s)' |
echo ' step = 2 : copy input files and dir(s)' |
30 |
echo " step = 3 : run with $Np mpi processes" |
echo " step = 3 : run with $Npr mpi processes" |
31 |
echo ' step = 4 : check the results' |
echo ' step = 4 : check the results' |
32 |
echo ' step = 5 : remove output files in rank_0,1,2 dir.' |
echo ' step = 5 : remove output files in rank_0,1,2 dir.' |
33 |
exit |
exit |
41 |
then |
then |
42 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
43 |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
44 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
/bin/rm -r -f rank_? rank_1? rank_2? |
45 |
if test -f build_cpl/Makefile ; then cd build_cpl ; make CLEAN ; cd .. ; fi |
if test -f build_cpl/Makefile ; then cd build_cpl ; make Clean ; cd .. ; fi |
46 |
if test -f build_ocn/Makefile ; then cd build_ocn ; make CLEAN ; cd .. ; fi |
if test -f build_ocn/Makefile ; then cd build_ocn ; make Clean ; cd .. ; fi |
47 |
if test -f build_atm/Makefile ; then cd build_atm ; make CLEAN ; cd .. ; fi |
if test -f build_atm/Makefile ; then cd build_atm ; make Clean ; cd .. ; fi |
48 |
fi |
fi |
49 |
if test $kpr = 5 |
if test $kpr = 5 |
50 |
then |
then |
51 |
echo 'remove output files in rank_0,1,2 dir.' |
echo 'remove output files in rank_0,1,2 dir.' |
52 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
53 |
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
54 |
if test -d rank_1 |
if test -d rank_$rnkO |
55 |
then cd rank_1 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
then cd rank_$rnkO ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
56 |
if test -d rank_2 |
if test -d rank_$rnkA |
57 |
then cd rank_2 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
then cd rank_$rnkA ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
58 |
fi |
fi |
59 |
|
|
60 |
if test $kpr = 1 |
if test $kpr = 1 |
61 |
then |
then |
62 |
|
|
63 |
#- choice of the optfile: take a local one in dir verification with sufix '+mpi' |
#- choice of the optfile: take a local one in dir verification with sufix '+mpi' |
64 |
nbOpF=`ls ../linux_*+mpi 2> /dev/null | wc -l` |
nbOpF=`ls ../linux_* | grep '+mpi' 2> /dev/null | wc -l` |
65 |
if test $nbOpF = 1 |
if test $nbOpF = 1 ; then |
66 |
then |
OPTFILE=`ls ../linux_* | grep '+mpi'` |
67 |
OPTFILE=`ls ../linux_*+mpi` |
zz=`grep '^FC=' $OPTFILE` |
68 |
|
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
69 |
|
elif [ $nbOpF -ge 2 ] ; then |
70 |
|
echo "pick the 1rst of these ( $nbOpF ) optfiles:" |
71 |
|
ls ../linux_* | grep '+mpi' |
72 |
|
OPTFILE=`ls ../linux_* | grep '+mpi' | head -1` |
73 |
zz=`grep '^FC=' $OPTFILE` |
zz=`grep '^FC=' $OPTFILE` |
74 |
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
75 |
else echo 'Pb in finding optfile' ; exit; |
else |
76 |
|
echo "Pb in finding optfile: found $nbOpF :" |
77 |
|
ls ../linux_* | grep '+mpi' ; exit |
78 |
fi |
fi |
79 |
zz=`echo $OPTFILE | grep -c '^\/'` |
zz=`echo $OPTFILE | grep -c '^\/'` |
80 |
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
82 |
echo '==== compile coupler:' |
echo '==== compile coupler:' |
83 |
cd build_cpl |
cd build_cpl |
84 |
echo ' --- genmake2 (cpl):' |
echo ' --- genmake2 (cpl):' |
85 |
../../../tools/genmake2 -of $OPTFILE -mpi -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt > TTT.genmake.$$ |
86 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
87 |
echo ' --- make depend (cpl):' |
echo ' --- make depend (cpl):' |
88 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
95 |
echo '==== compile OGCM:' |
echo '==== compile OGCM:' |
96 |
cd build_ocn |
cd build_ocn |
97 |
echo ' --- genmake2 (ocn):' |
echo ' --- genmake2 (ocn):' |
98 |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHo -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt > TTT.genmake.$$ |
99 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
100 |
echo ' --- make depend (ocn):' |
echo ' --- make depend (ocn):' |
101 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
108 |
echo '==== compile AGCM:' |
echo '==== compile AGCM:' |
109 |
cd build_atm |
cd build_atm |
110 |
echo ' --- genmake2 (atm):' |
echo ' --- genmake2 (atm):' |
111 |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHa -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt > TTT.genmake.$$ |
112 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
113 |
echo ' --- make depend (atm):' |
echo ' --- make depend (atm):' |
114 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
124 |
|
|
125 |
if test $kpr = 2 |
if test $kpr = 2 |
126 |
then |
then |
127 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
echo 'rm dir:' rank_? rank_1? rank_2? |
128 |
echo 'CP dir:' input_cpl '->' rank_0 |
/bin/rm -r -f rank_? rank_1? rank_2? |
129 |
cp -p -r input_cpl rank_0 |
echo 'Link files from dir:' input_cpl '->' rank_0 |
130 |
|
mkdir rank_0 |
131 |
echo 'CP dir:' input_ocn '->' rank_1 |
( cd rank_0 ; ln -s ../input_cpl/* . ) |
132 |
cp -p -r input_ocn rank_1 |
|
133 |
cd rank_1 |
n=$rnkO |
134 |
./prepare_run |
echo 'Link files from dir:' input_ocn '->' rank_$n |
135 |
|
mkdir rank_$n |
136 |
|
cd rank_$n |
137 |
|
ln -s ../input_ocn/* . |
138 |
|
if test -x prepare_run ; then ./prepare_run ; fi |
139 |
if test "x$MTHo" != x ; then |
if test "x$MTHo" != x ; then |
140 |
echo " MTH run: mv -f eedata.mth eedata" |
echo " MTH run: mv -f eedata.mth eedata" |
141 |
|
if test -h eedata ; then rm -f eedata ; fi |
142 |
mv -f eedata.mth eedata |
mv -f eedata.mth eedata |
143 |
fi |
fi |
144 |
cd $dir |
cd $dir |
145 |
|
n=`expr $n + 1` |
146 |
echo 'CP dir:' input_atm '->' rank_2 |
while [ $n -le $NpOc ] ; do |
147 |
cp -p -r input_atm rank_2 |
ln -s rank_$rnkO rank_$n |
148 |
cd rank_2 |
n=`expr $n + 1` |
149 |
./prepare_run |
done |
150 |
|
|
151 |
|
n=$rnkA |
152 |
|
echo 'Link files from dir:' input_atm '->' rank_$n |
153 |
|
mkdir rank_$n |
154 |
|
cd rank_$n |
155 |
|
ln -s ../input_atm/* . |
156 |
|
if test -x prepare_run ; then ./prepare_run ; fi |
157 |
if test "x$MTHa" != x ; then |
if test "x$MTHa" != x ; then |
158 |
echo " MTH run: mv -f eedata.mth eedata" |
echo " MTH run: mv -f eedata.mth eedata" |
159 |
|
if test -h eedata ; then rm -f eedata ; fi |
160 |
mv -f eedata.mth eedata |
mv -f eedata.mth eedata |
161 |
fi |
fi |
162 |
cd $dir |
cd $dir |
163 |
|
n=`expr $n + 1` |
164 |
|
while [ $n -lt $Npr ] ; do |
165 |
|
ln -s rank_$rnkA rank_$n |
166 |
|
n=`expr $n + 1` |
167 |
|
done |
168 |
|
|
169 |
fi |
fi |
170 |
|
|
171 |
if test $kpr = 3 |
if test $kpr = 3 |
172 |
then |
then |
173 |
ROOTDIR=$dir |
ROOTDIR=$dir |
174 |
rm -f rank_?/pickup*.ckptA.00?.00?.??ta |
# rm -f rank_?/pickup*.ckptA.00?.00?.??ta |
175 |
echo $ROOTDIR |
echo $ROOTDIR |
176 |
tmpfil=TTT.$$ |
tmpfil=TTT.$$ |
177 |
|
|
178 |
rm -f pr_group ; touch pr_group |
#--- running on the same node: |
179 |
nc=0; xx=`hostname` |
list='' ; nc=0; xx=`hostname` |
180 |
for dd1 in cpl ocn atm |
while [ $nc -lt $Npr ] ; do list="$list $xx" ; nc=`expr $nc + 1` ; done |
181 |
do |
#-- On darwin cluster node (from qrsh session): |
182 |
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
# JOB_ID=`qstat | sed -n '3,$ p' | grep " $USER " | awk '{print $1}'` |
183 |
nc=1 |
# NODEFILE="/tmp/$JOB_ID.1.darwin/machines" |
184 |
done |
# echo " JOB_ID = '$JOB_ID' ; NODEFILE = '$NODEFILE'" |
185 |
|
#-- On ACES cluster (in PBS batch job): |
186 |
cd $ROOTDIR |
# NODEFILE=$PBS_NODEFILE |
187 |
if test "x$MTH" != x ; then |
#--- running on different nodes: |
188 |
export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m |
# ls -l $NODEFILE |
189 |
if test "x$MTHo" != x ; then |
# nprc=`cat $NODEFILE | uniq | wc -l` |
190 |
echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;" |
# if [ $nprc -ge $Npr ] ; then |
191 |
fi |
# list=`cat $NODEFILE | uniq | head -$Npr` |
192 |
if test "x$MTHa" != x ; then |
# else |
193 |
echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;" |
# list=`cat $NODEFILE | head -$Npr` |
194 |
fi |
# fi |
195 |
echo "" |
|
196 |
fi |
nc=0; nn=0; dd1=cpl ; |
197 |
|
rm -f pr_group ; touch pr_group |
198 |
|
for xx in $list |
199 |
|
do |
200 |
|
echo $xx $nn $dir/build_$dd1/mitgcmuv >> pr_group |
201 |
|
nc=`expr $nc + 1` |
202 |
|
if [ $nc -le $NpOc ] ; then dd1=ocn ; else dd1=atm ; fi |
203 |
|
nn=1 |
204 |
|
done |
205 |
|
|
206 |
|
cd $ROOTDIR |
207 |
|
if test "x$MTH" != x ; then |
208 |
|
export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m |
209 |
|
if test "x$MTHo" != x ; then |
210 |
|
echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;" |
211 |
|
fi |
212 |
|
if test "x$MTHa" != x ; then |
213 |
|
echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;" |
214 |
|
fi |
215 |
|
echo "" |
216 |
|
fi |
217 |
# /usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpirun.ch_gm -pg pr_group -wd $ROOTDIR --gm-kill 5 -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
# /usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpirun.ch_gm -pg pr_group -wd $ROOTDIR --gm-kill 5 -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
218 |
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
#- with mpich-1 (on danton, ACES): |
219 |
tail -20 std_outp |
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
220 |
ls -l rank_?/pickup*.ckptA.001.001.data |
#- with mpich-mx (on beagle): |
221 |
|
# mpirun -pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
222 |
|
tail -20 std_outp |
223 |
|
ls -l rank_$rnkO/pickup*.ckptA.001.001.data |
224 |
|
ls -l rank_$rnkA/pickup*.ckptA.001.001.data |
225 |
|
|
226 |
fi |
fi |
227 |
|
|
228 |
if test $kpr = 4 |
if test $kpr = 4 |
229 |
then |
then |
230 |
|
|
231 |
if test -f rank_1/STDOUT.0000 |
if test -f rank_$rnkO/STDOUT.0000 |
232 |
then echo '==> check Ocean output:' |
then echo '==> check Ocean output:' |
233 |
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
/home/jmc/bin/comp_res rank_$rnkO/STDOUT.0000 results/ocnSTDOUT.0000 |
234 |
mv -f comp_res.log comp_res.ocn |
mv -f comp_res.log comp_res.ocn |
235 |
echo ' ' |
echo ' ' |
236 |
else echo 'No Ocean output file in rank_1' ; fi |
else echo "No Ocean output file in rank_$rnkO" ; fi |
237 |
|
|
238 |
if test -f rank_2/STDOUT.0000 |
if test -f rank_$rnkA/STDOUT.0000 |
239 |
then |
then |
240 |
echo '==> check Atmos output:' |
echo '==> check Atmos output:' |
241 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 |
242 |
mv -f comp_res.log comp_res.atm |
mv -f comp_res.log comp_res.atm |
243 |
echo '==> check Land output:' |
echo '==> check Land output:' |
244 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 L |
245 |
mv -f comp_res.log comp_res.land |
mv -f comp_res.log comp_res.land |
246 |
echo '==> check thSIce output:' |
echo '==> check thSIce output:' |
247 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 I |
248 |
mv -f comp_res.log comp_res.sice |
mv -f comp_res.log comp_res.sice |
249 |
echo ' ' |
echo ' ' |
250 |
else echo 'No Atmos output file in rank_2' ; fi |
else echo "No Atmos output file in rank_$rnkA" ; fi |
251 |
|
|
252 |
fi |
fi |
253 |
|
|