1 |
#! /bin/sh |
#! /usr/bin/env bash |
2 |
|
|
3 |
# $Header$ |
# $Header$ |
4 |
# $Name$ |
# $Name$ |
5 |
|
|
6 |
|
bdPfx='build'; # build-dir prefix |
7 |
|
|
8 |
#- default: |
#- default: |
9 |
Npr=3 ; NpOc=1 ; |
Npr=3 ; NpOc=1 ; |
10 |
#Npr=25; NpOc=12; |
#Npr=25; NpOc=12; |
11 |
MTH= |
MTH= |
12 |
MTHo= |
MTHo= |
13 |
MTHa= |
MTHa= |
14 |
GMKopt='-ieee' |
GMKopt='-devel' |
15 |
|
#GMKopt='-ieee' |
16 |
#GMKopt= |
#GMKopt= |
17 |
rnkO=1 ; rnkA=`expr $rnkO + $NpOc` |
rnkO=1 ; rnkA=`expr $rnkO + $NpOc` |
18 |
|
|
22 |
if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi |
if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi |
23 |
if test -f input_atm/eedata.mth ; then MTHa=$MTH ; fi |
if test -f input_atm/eedata.mth ; then MTHa=$MTH ; fi |
24 |
fi ; fi |
fi ; fi |
25 |
if [ $# -ne 1 ] |
#- allows more argument for building step (step=1) |
26 |
then |
chkArg=$# ; if [ $# -gt 1 ]; then chkArg=$1 ; fi |
27 |
echo 'Usage:'`basename $0`' [opt] step' |
if [ $chkArg -ne 1 ]; then |
28 |
|
echo 'Usage:'`basename $0`' [opt] step [bld-arg]' |
29 |
echo ' => test coupled set-up on linux box (1.cpu)' |
echo ' => test coupled set-up on linux box (1.cpu)' |
30 |
echo 'opt = -mth : compile and run (if eedata.mth) 2-threads for ocn & atm' |
echo 'opt = -mth : compile and run (if eedata.mth) 2-threads for ocn & atm' |
31 |
echo ' step = 0 : clean all directories' |
echo ' step = 0 : clean all directories' |
32 |
echo ' step = 1 : compile the 3 executables (cpl,ocn,atm)' |
echo ' step = 1 : compile the 3 executables (cpl,ocn,atm); optional arg:' |
33 |
|
echo ' -of Optfile_Name : using option-file "Optfile_Name"' |
34 |
echo ' step = 2 : copy input files and dir(s)' |
echo ' step = 2 : copy input files and dir(s)' |
35 |
echo " step = 3 : run with $Npr mpi processes" |
echo " step = 3 : run with $Npr mpi processes" |
36 |
echo ' step = 4 : check the results' |
echo ' step = 4 : check the results' |
45 |
if test $kpr = 0 |
if test $kpr = 0 |
46 |
then |
then |
47 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
48 |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
rm -f ${bdPfx}_???/TTT.*make.* ${bdPfx}_???/TTT.mkdepend.* |
49 |
/bin/rm -r -f rank_? rank_1? rank_2? |
/bin/rm -r -f rank_? rank_1? rank_2? |
50 |
if test -f build_cpl/Makefile ; then cd build_cpl ; make Clean ; cd .. ; fi |
if test -f ${bdPfx}_cpl/Makefile ; then cd ${bdPfx}_cpl ; make Clean ; cd .. ; fi |
51 |
if test -f build_ocn/Makefile ; then cd build_ocn ; make Clean ; cd .. ; fi |
if test -f ${bdPfx}_ocn/Makefile ; then cd ${bdPfx}_ocn ; make Clean ; cd .. ; fi |
52 |
if test -f build_atm/Makefile ; then cd build_atm ; make Clean ; cd .. ; fi |
if test -f ${bdPfx}_atm/Makefile ; then cd ${bdPfx}_atm ; make Clean ; cd .. ; fi |
53 |
fi |
fi |
54 |
if test $kpr = 5 |
if test $kpr = 5 |
55 |
then |
then |
56 |
echo 'remove output files in rank_0,1,2 dir.' |
echo 'remove output files in rank_0,1,2 dir.' |
57 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
58 |
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
test -f rank_0/Coupler.0000.clog && rm -f rank_0/Coupler.0000.clog |
59 |
if test -d rank_$rnkO |
if test -d rank_$rnkO ; then |
60 |
then cd rank_$rnkO ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
( cd rank_$rnkO ; rm -f *.data *.meta *.txt *.log STD???.00?? UV-*.00??.clog ) |
61 |
if test -d rank_$rnkA |
fi |
62 |
then cd rank_$rnkA ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
if test -d rank_$rnkA ; then |
63 |
|
( cd rank_$rnkA ; rm -f *.data *.meta *.txt *.log STD???.00?? UV-*.00??.clog ) |
64 |
|
fi |
65 |
fi |
fi |
66 |
|
|
67 |
if test $kpr = 1 |
if test $kpr = 1 |
68 |
then |
then |
69 |
|
|
70 |
#- choice of the optfile: take a local one in dir verification with sufix '+mpi' |
#- choice of the optfile: |
71 |
|
# default: take a local one in dir verification with sufix '+mpi' |
72 |
nbOpF=`ls ../linux_* | grep '+mpi' 2> /dev/null | wc -l` |
nbOpF=`ls ../linux_* | grep '+mpi' 2> /dev/null | wc -l` |
73 |
|
# or take the one given as argument: |
74 |
|
if [ $# -ge 3 ]; then |
75 |
|
if test $2 = '-of' -a -f $3 ; then nbOpF=-1 ; OPTFILE=$3 ; fi |
76 |
|
fi |
77 |
if test $nbOpF = 1 ; then |
if test $nbOpF = 1 ; then |
78 |
OPTFILE=`ls ../linux_* | grep '+mpi'` |
OPTFILE=`ls ../linux_* | grep '+mpi'` |
|
zz=`grep '^FC=' $OPTFILE` |
|
|
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
|
79 |
elif [ $nbOpF -ge 2 ] ; then |
elif [ $nbOpF -ge 2 ] ; then |
80 |
echo "pick the 1rst of these ( $nbOpF ) optfiles:" |
echo "pick the 1rst of these ( $nbOpF ) optfiles:" |
81 |
ls ../linux_* | grep '+mpi' |
ls ../linux_* | grep '+mpi' |
82 |
OPTFILE=`ls ../linux_* | grep '+mpi' | head -1` |
OPTFILE=`ls ../linux_* | grep '+mpi' | head -1` |
83 |
zz=`grep '^FC=' $OPTFILE` |
elif [ $nbOpF -ne -1 ] ; then |
|
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
|
|
else |
|
84 |
echo "Pb in finding optfile: found $nbOpF :" |
echo "Pb in finding optfile: found $nbOpF :" |
85 |
ls ../linux_* | grep '+mpi' ; exit |
ls ../linux_* | grep '+mpi' ; exit |
86 |
fi |
fi |
87 |
|
zz=`grep '^ *FC=' $OPTFILE | tail -1` |
88 |
|
echo " Using optfile: $OPTFILE (compiler: $zz) $MTH" |
89 |
zz=`echo $OPTFILE | grep -c '^\/'` |
zz=`echo $OPTFILE | grep -c '^\/'` |
90 |
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
91 |
#--- |
#--- |
92 |
echo '==== compile coupler:' |
echo '==== compile coupler:' |
93 |
cd build_cpl |
cd ${bdPfx}_cpl |
94 |
echo ' --- genmake2 (cpl):' |
echo ' --- genmake2 (cpl):' |
95 |
../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt > TTT.genmake.$$ 2>&1 |
96 |
tail -5 TTT.genmake.$$ |
RetVal=$? ; tail -5 TTT.genmake.$$ |
97 |
|
if test "x$RetVal" != x0 ; then |
98 |
|
echo "Error in genmake2 (cpl)" ; exit 11 |
99 |
|
fi |
100 |
echo ' --- make depend (cpl):' |
echo ' --- make depend (cpl):' |
101 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ 2>&1 |
102 |
tail -5 TTT.mkdepend.$$ |
RetVal=$? ; tail -5 TTT.mkdepend.$$ |
103 |
echo ' --- make (cpl):' |
if test "x$RetVal" != x0 ; then |
104 |
make > TTT.make.$$ 2>&1 |
echo "Error in mkdepend (cpl)" ; exit 12 |
105 |
tail -10 TTT.make.$$ |
fi |
106 |
|
echo ' --- make (cpl):' ; touch TTT.make.$$ |
107 |
|
#do_make_syntax.sh obj > TTT.make.$$ 2>&1 |
108 |
|
make >> TTT.make.$$ 2>&1 |
109 |
|
RetVal=$? ; tail -10 TTT.make.$$ |
110 |
|
if test "x$RetVal" != x0 ; then |
111 |
|
echo "Error in make (cpl)" ; exit 13 |
112 |
|
fi |
113 |
echo ' ' ; cd $dir |
echo ' ' ; cd $dir |
114 |
|
|
115 |
echo '==== compile OGCM:' |
echo '==== compile OGCM:' |
116 |
cd build_ocn |
cd ${bdPfx}_ocn |
117 |
echo ' --- genmake2 (ocn):' |
echo ' --- genmake2 (ocn):' |
118 |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt > TTT.genmake.$$ 2>&1 |
119 |
tail -5 TTT.genmake.$$ |
RetVal=$? ; tail -5 TTT.genmake.$$ |
120 |
|
if test "x$RetVal" != x0 ; then |
121 |
|
echo "Error in genmake2 (ocn)" ; exit 21 |
122 |
|
fi |
123 |
echo ' --- make depend (ocn):' |
echo ' --- make depend (ocn):' |
124 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ 2>&1 |
125 |
tail -10 TTT.mkdepend.$$ |
RetVal=$? ; tail -10 TTT.mkdepend.$$ |
126 |
echo ' --- make (ocn):' |
if test "x$RetVal" != x0 ; then |
127 |
make > TTT.make.$$ 2>&1 |
echo "Error in mkdepend (ocn)" ; exit 22 |
128 |
tail -10 TTT.make.$$ |
fi |
129 |
|
echo ' --- make (ocn):' ; touch TTT.make.$$ |
130 |
|
#do_make_syntax.sh obj > TTT.make.$$ 2>&1 |
131 |
|
make >> TTT.make.$$ 2>&1 |
132 |
|
RetVal=$? ; tail -10 TTT.make.$$ |
133 |
|
if test "x$RetVal" != x0 ; then |
134 |
|
echo "Error in make (ocn)" ; exit 23 |
135 |
|
fi |
136 |
echo ' ' ; cd $dir |
echo ' ' ; cd $dir |
137 |
|
|
138 |
echo '==== compile AGCM:' |
echo '==== compile AGCM:' |
139 |
cd build_atm |
cd ${bdPfx}_atm |
140 |
echo ' --- genmake2 (atm):' |
echo ' --- genmake2 (atm):' |
141 |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt > TTT.genmake.$$ 2>&1 |
142 |
tail -5 TTT.genmake.$$ |
RetVal=$? ; tail -5 TTT.genmake.$$ |
143 |
|
if test "x$RetVal" != x0 ; then |
144 |
|
echo "Error in genmake2 (atm)" ; exit 31 |
145 |
|
fi |
146 |
echo ' --- make depend (atm):' |
echo ' --- make depend (atm):' |
147 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ 2>&1 |
148 |
tail -10 TTT.mkdepend.$$ |
RetVal=$? ; tail -10 TTT.mkdepend.$$ |
149 |
echo ' --- make (atm):' |
if test "x$RetVal" != x0 ; then |
150 |
make > TTT.make.$$ 2>&1 |
echo "Error in mkdepend (atm)" ; exit 32 |
151 |
tail -10 TTT.make.$$ |
fi |
152 |
|
echo ' --- make (atm):' ; touch TTT.make.$$ |
153 |
|
#do_make_syntax.sh obj > TTT.make.$$ 2>&1 |
154 |
|
make >> TTT.make.$$ 2>&1 |
155 |
|
RetVal=$? ; tail -10 TTT.make.$$ |
156 |
|
if test "x$RetVal" != x0 ; then |
157 |
|
echo "Error in make (atm)" ; exit 33 |
158 |
|
fi |
159 |
echo ' ' ; cd $dir |
echo ' ' ; cd $dir |
160 |
|
|
161 |
ls -l build_???/mitgcmuv |
ls -l ${bdPfx}_???/mitgcmuv |
162 |
|
|
163 |
fi |
fi |
164 |
|
|
237 |
rm -f pr_group ; touch pr_group |
rm -f pr_group ; touch pr_group |
238 |
for xx in $list |
for xx in $list |
239 |
do |
do |
240 |
echo $xx $nn $dir/build_$dd1/mitgcmuv >> pr_group |
echo $xx $nn $dir/${bdPfx}_$dd1/mitgcmuv >> pr_group |
241 |
nc=`expr $nc + 1` |
nc=`expr $nc + 1` |
242 |
if [ $nc -le $NpOc ] ; then dd1=ocn ; else dd1=atm ; fi |
if [ $nc -le $NpOc ] ; then dd1=ocn ; else dd1=atm ; fi |
243 |
nn=1 |
nn=1 |
244 |
done |
done |
245 |
|
NpAt=`expr $Npr - 1 - $NpOc` |
246 |
|
RunOpt="-np 1 ./${bdPfx}_cpl/mitgcmuv" |
247 |
|
RunOpt="$RunOpt : -np $NpOc ./${bdPfx}_ocn/mitgcmuv" |
248 |
|
RunOpt="$RunOpt : -np $NpAt ./${bdPfx}_atm/mitgcmuv" |
249 |
|
|
250 |
cd $ROOTDIR |
cd $ROOTDIR |
251 |
if test "x$MTH" != x ; then |
if test "x$MTH" != x ; then |
258 |
fi |
fi |
259 |
echo "" |
echo "" |
260 |
fi |
fi |
261 |
# /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 |
mpich=`which mpirun` |
262 |
#- with mpich-1 (on danton, ACES): |
echo $mpich | grep 'mpich-mx' > /dev/null 2>&1 |
263 |
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
mpichmx=$? |
264 |
#- with mpich-mx (on beagle): |
echo $mpich | grep 'mpich-1' > /dev/null 2>&1 |
265 |
# mpirun -pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
mpich1=$? |
266 |
|
echo $mpich | grep 'mpich2' > /dev/null 2>&1 |
267 |
|
mpich2=$? |
268 |
|
echo $mpich | grep 'openmpi' > /dev/null 2>&1 |
269 |
|
opnmpi=$? |
270 |
|
if test $mpich1 == 0 ; then |
271 |
|
# /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 ./${bdPfx}_cpl/mitgcmuv > std_outp 2>&1 |
272 |
|
#- with mpich-1 (on danton, old aces: ao, geo, itrda): |
273 |
|
echo "execute 'mpirun -p4pg pr_group -v ./${bdPfx}_cpl/mitgcmuv' :" |
274 |
|
mpirun -p4pg pr_group -v ./${bdPfx}_cpl/mitgcmuv > std_outp 2>&1 |
275 |
|
elif test $mpichmx == 0 ; then |
276 |
|
#- with mpich-mx (on beagle): |
277 |
|
echo "execute 'mpirun -pg pr_group -v ./${bdPfx}_cpl/mitgcmuv' :" |
278 |
|
mpirun -pg pr_group -v ./${bdPfx}_cpl/mitgcmuv > std_outp 2>&1 |
279 |
|
elif test $mpich2 == 0 -o $opnmpi == 0 ; then |
280 |
|
#- with Hydra mpich2 (on baudelaire) or with openmpi: |
281 |
|
echo "execute 'mpirun $RunOpt' :" |
282 |
|
mpirun $RunOpt > std_outp 2>&1 |
283 |
|
else |
284 |
|
#- new mpich (mpich2) installation often just put in "mpich" dir |
285 |
|
echo "execute 'mpirun $RunOpt' :" |
286 |
|
mpirun $RunOpt > std_outp 2>&1 |
287 |
|
fi |
288 |
tail -20 std_outp |
tail -20 std_outp |
289 |
ls -l rank_$rnkO/pickup*.ckptA.001.001.data |
ls -l rank_$rnkO/pickup*.ckptA.001.001.data |
290 |
ls -l rank_$rnkA/pickup*.ckptA.001.001.data |
ls -l rank_$rnkA/pickup*.ckptA.001.001.data |
293 |
|
|
294 |
if test $kpr = 4 |
if test $kpr = 4 |
295 |
then |
then |
296 |
|
CompRes="$HOME/bin/comp_res" |
297 |
|
|
298 |
if test -f rank_$rnkO/STDOUT.0000 |
if test -f rank_$rnkO/STDOUT.0000 |
299 |
then echo '==> check Ocean output:' |
then echo '==> check Ocean output:' |
300 |
/home/jmc/bin/comp_res rank_$rnkO/STDOUT.0000 results/ocnSTDOUT.0000 |
$CompRes rank_$rnkO/STDOUT.0000 results/ocnSTDOUT.0000 |
301 |
mv -f comp_res.log comp_res.ocn |
mv -f comp_res.log comp_res.ocn |
302 |
echo ' ' |
echo ' ' |
303 |
else echo "No Ocean output file in rank_$rnkO" ; fi |
else echo "No Ocean output file in rank_$rnkO" ; fi |
305 |
if test -f rank_$rnkA/STDOUT.0000 |
if test -f rank_$rnkA/STDOUT.0000 |
306 |
then |
then |
307 |
echo '==> check Atmos output:' |
echo '==> check Atmos output:' |
308 |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 |
$CompRes rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 |
309 |
mv -f comp_res.log comp_res.atm |
mv -f comp_res.log comp_res.atm |
310 |
echo '==> check Land output:' |
echo '==> check Land output:' |
311 |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 L |
$CompRes rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 L |
312 |
mv -f comp_res.log comp_res.land |
mv -f comp_res.log comp_res.land |
313 |
echo '==> check thSIce output:' |
echo '==> check thSIce output:' |
314 |
/home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 I |
$CompRes rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 I |
315 |
mv -f comp_res.log comp_res.sice |
mv -f comp_res.log comp_res.sice |
316 |
echo ' ' |
echo ' ' |
317 |
else echo "No Atmos output file in rank_$rnkA" ; fi |
else echo "No Atmos output file in rank_$rnkA" ; fi |