3 |
# $Header$ |
# $Header$ |
4 |
# $Name$ |
# $Name$ |
5 |
|
|
6 |
|
#- default: |
7 |
Np=3 |
Np=3 |
8 |
if [ $# -lt 1 ] |
MTH= |
9 |
then |
MTHo= |
10 |
echo 'Usage:'`basename $0`' step ' |
MTHa= |
11 |
echo ' => test coupled set-up on myrinet cluster' |
GMKopt='-ieee' |
12 |
echo 'step = 0 : clean all directories' |
|
13 |
echo 'step = 1 : compile the 3 executables (cpl,ocn,atm)' |
#- parse options: |
14 |
echo 'step = 2 : copy input files and dir(s)' |
if [ $# -ge 1 ] ; then if test $1 = '-mth' ; then |
15 |
echo "step = 3 : run on $Np processor" |
MTH='-omp' ; shift |
16 |
echo 'step = 4 : check the results' |
if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi |
17 |
|
if test -f input_atm/eedata.mth ; then MTHa=$MTH ; fi |
18 |
|
fi ; fi |
19 |
|
if [ $# -ne 1 ] |
20 |
|
then |
21 |
|
echo 'Usage:'`basename $0`' [opt] step' |
22 |
|
echo ' => test coupled set-up on linux box (1.cpu)' |
23 |
|
echo 'opt = -mth : compile and run (if eedata.mth) 2-threads for ocn & atm' |
24 |
|
echo ' step = 0 : clean all directories' |
25 |
|
echo ' step = 1 : compile the 3 executables (cpl,ocn,atm)' |
26 |
|
echo ' step = 2 : copy input files and dir(s)' |
27 |
|
echo " step = 3 : run with $Np mpi processes" |
28 |
|
echo ' step = 4 : check the results' |
29 |
|
echo ' step = 5 : remove output files in rank_0,1,2 dir.' |
30 |
exit |
exit |
31 |
fi |
fi |
32 |
kpr=$1 |
kpr=$1 |
33 |
dir=`pwd` |
dir=`pwd` |
34 |
|
|
|
#- only works from a 3 nodes PBS bach session ( qsub -I -l nodes=3:p4 ) |
|
|
# on myrinet cluster: |
|
|
xx=`hostname | sed 's/[0-9]/X/g'` |
|
|
if test $xx != 'myrinet-X-XX' |
|
|
then |
|
|
echo ' hostname='`hostname` |
|
|
echo 'for now, works only on myrinet cluster' |
|
|
exit 9 |
|
|
fi |
|
|
if test 'dummy'$PBS_NODEFILE = 'dummy' |
|
|
then |
|
|
echo ' $PBS_NODEFILE not defined' |
|
|
echo "for now, works only from a $Np nodes PBS bach session" |
|
|
exit 8 |
|
|
else ncpus=`wc -l $PBS_NODEFILE | awk '{print $1}'` |
|
|
if test $ncpus != $Np ; then |
|
|
echo ' Nb of nodes from $PBS_NODEFILE =' $ncpus |
|
|
echo "for now, works only from a $Np nodes PBS bach session" |
|
|
exit 8 |
|
|
fi |
|
|
fi |
|
|
|
|
35 |
#============================================================================ |
#============================================================================ |
36 |
|
|
37 |
if test $kpr = 0 |
if test $kpr = 0 |
38 |
then |
then |
39 |
rm -f genmake_optfile pr_group std_outp |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
40 |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
41 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
42 |
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 |
43 |
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 |
44 |
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 |
45 |
fi |
fi |
46 |
|
if test $kpr = 5 |
47 |
|
then |
48 |
|
echo 'remove output files in rank_0,1,2 dir.' |
49 |
|
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
50 |
|
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
51 |
|
if test -d rank_1 |
52 |
|
then cd rank_1 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
53 |
|
if test -d rank_2 |
54 |
|
then cd rank_2 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
55 |
|
fi |
56 |
|
|
57 |
if test $kpr = 1 |
if test $kpr = 1 |
58 |
then |
then |
59 |
|
|
60 |
# cp -p ../../tools/build_options/linux_ia32_ifc+mpi_cg01 genmake_optfile |
#- choice of the optfile: take a local one in dir verification with sufix '+mpi' |
61 |
cp optfile genmake_optfile |
nbOpF=`ls ../linux_* | grep '+mpi' 2> /dev/null | wc -l` |
62 |
|
if test $nbOpF = 1 |
63 |
|
then |
64 |
|
OPTFILE=`ls ../linux_* | grep '+mpi'` |
65 |
|
zz=`grep '^FC=' $OPTFILE` |
66 |
|
echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" |
67 |
|
else |
68 |
|
echo "Pb in finding optfile: found $nbOpF :" |
69 |
|
ls ../linux_* | grep '+mpi' ; exit |
70 |
|
fi |
71 |
|
zz=`echo $OPTFILE | grep -c '^\/'` |
72 |
|
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
73 |
|
#--- |
74 |
echo '==== compile coupler:' |
echo '==== compile coupler:' |
75 |
cd build_cpl |
cd build_cpl |
76 |
echo ' --- genmake2 (cpl):' |
echo ' --- genmake2 (cpl):' |
77 |
../../../tools/genmake2 -of ../genmake_optfile -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt > TTT.genmake.$$ |
78 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
79 |
echo ' --- make depend (cpl):' |
echo ' --- make depend (cpl):' |
80 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
87 |
echo '==== compile OGCM:' |
echo '==== compile OGCM:' |
88 |
cd build_ocn |
cd build_ocn |
89 |
echo ' --- genmake2 (ocn):' |
echo ' --- genmake2 (ocn):' |
90 |
../../../tools/genmake2 -of ../genmake_optfile -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt > TTT.genmake.$$ |
91 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
92 |
echo ' --- make depend (ocn):' |
echo ' --- make depend (ocn):' |
93 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
100 |
echo '==== compile AGCM:' |
echo '==== compile AGCM:' |
101 |
cd build_atm |
cd build_atm |
102 |
echo ' --- genmake2 (atm):' |
echo ' --- genmake2 (atm):' |
103 |
../../../tools/genmake2 -of ../genmake_optfile -ieee > TTT.genmake.$$ |
../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt > TTT.genmake.$$ |
104 |
tail -5 TTT.genmake.$$ |
tail -5 TTT.genmake.$$ |
105 |
echo ' --- make depend (atm):' |
echo ' --- make depend (atm):' |
106 |
make depend > TTT.mkdepend.$$ |
make depend > TTT.mkdepend.$$ |
116 |
|
|
117 |
if test $kpr = 2 |
if test $kpr = 2 |
118 |
then |
then |
119 |
|
/bin/rm -r -f rank_0 rank_1 rank_2 |
120 |
|
echo 'CP dir:' input_cpl '->' rank_0 |
121 |
cp -p -r input_cpl rank_0 |
cp -p -r input_cpl rank_0 |
|
cp -p -r input_ocn rank_1 |
|
|
cp -p -r input_atm rank_2 |
|
122 |
|
|
123 |
|
echo 'CP dir:' input_ocn '->' rank_1 |
124 |
|
cp -p -r input_ocn rank_1 |
125 |
cd rank_1 |
cd rank_1 |
126 |
./IMPORT_INPUT_FILES |
./prepare_run |
127 |
|
if test "x$MTHo" != x ; then |
128 |
|
echo " MTH run: mv -f eedata.mth eedata" |
129 |
|
mv -f eedata.mth eedata |
130 |
|
fi |
131 |
cd $dir |
cd $dir |
132 |
|
|
133 |
|
echo 'CP dir:' input_atm '->' rank_2 |
134 |
|
cp -p -r input_atm rank_2 |
135 |
cd rank_2 |
cd rank_2 |
136 |
./SHARE_OCN_GRID '../rank_1' |
./prepare_run |
137 |
|
if test "x$MTHa" != x ; then |
138 |
|
echo " MTH run: mv -f eedata.mth eedata" |
139 |
|
mv -f eedata.mth eedata |
140 |
|
fi |
141 |
cd $dir |
cd $dir |
142 |
|
|
|
mkdir cpl ocn atm |
|
|
if test -f build_cpl/mitgcmuv ; then cp -p build_cpl/mitgcmuv cpl |
|
|
else echo 'file: build_cpl/mitgcmuv not found => stop'; exit; fi |
|
|
if test -f build_ocn/mitgcmuv ; then cp -p build_ocn/mitgcmuv ocn |
|
|
else echo 'file: build_ocn/mitgcmuv not found => stop'; exit; fi |
|
|
if test -f build_atm/mitgcmuv ; then cp -p build_atm/mitgcmuv atm |
|
|
else echo 'file: build_atm/mitgcmuv not found => stop'; exit; fi |
|
|
|
|
143 |
fi |
fi |
144 |
|
|
145 |
if test $kpr = 3 |
if test $kpr = 3 |
149 |
echo $ROOTDIR |
echo $ROOTDIR |
150 |
tmpfil=TTT.$$ |
tmpfil=TTT.$$ |
151 |
|
|
|
echo $PBS_NODEFILE |
|
|
list=`cat $PBS_NODEFILE` |
|
152 |
rm -f pr_group ; touch pr_group |
rm -f pr_group ; touch pr_group |
153 |
nc=0 ; dd1=cpl ; |
nc=0; xx=`hostname` |
154 |
for xx in $list |
for dd1 in cpl ocn atm |
155 |
do |
do |
156 |
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
|
if test $nc = 0 ; then dd1=ocn ; else dd1=atm ; fi |
|
157 |
nc=1 |
nc=1 |
158 |
done |
done |
159 |
|
|
160 |
cd $ROOTDIR |
cd $ROOTDIR |
161 |
/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 |
if test "x$MTH" != x ; then |
162 |
|
export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m |
163 |
|
if test "x$MTHo" != x ; then |
164 |
|
echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;" |
165 |
|
fi |
166 |
|
if test "x$MTHa" != x ; then |
167 |
|
echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;" |
168 |
|
fi |
169 |
|
echo "" |
170 |
|
fi |
171 |
|
# /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 |
172 |
|
#- on danton (mpich-1): |
173 |
|
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
174 |
|
#- on beagle: |
175 |
|
#mpirun -pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
176 |
tail -20 std_outp |
tail -20 std_outp |
177 |
ls -l rank_?/pickup*.ckptA.001.001.data |
ls -l rank_?/pickup*.ckptA.001.001.data |
178 |
|
|
184 |
if test -f rank_1/STDOUT.0000 |
if test -f rank_1/STDOUT.0000 |
185 |
then echo '==> check Ocean output:' |
then echo '==> check Ocean output:' |
186 |
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
187 |
echo ' ' |
mv -f comp_res.log comp_res.ocn |
188 |
|
echo ' ' |
189 |
else echo 'No Ocean output file in rank_1' ; fi |
else echo 'No Ocean output file in rank_1' ; fi |
190 |
|
|
191 |
if test -f rank_2/STDOUT.0000 |
if test -f rank_2/STDOUT.0000 |
192 |
then |
then |
193 |
echo '==> check Atmos output:' |
echo '==> check Atmos output:' |
194 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
195 |
|
mv -f comp_res.log comp_res.atm |
196 |
echo '==> check Land output:' |
echo '==> check Land output:' |
197 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
198 |
|
mv -f comp_res.log comp_res.land |
199 |
echo '==> check thSIce output:' |
echo '==> check thSIce output:' |
200 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
201 |
echo ' ' |
mv -f comp_res.log comp_res.sice |
202 |
else echo 'No Atmos output file in rank_1' ; fi |
echo ' ' |
203 |
|
else echo 'No Atmos output file in rank_2' ; fi |
204 |
|
|
205 |
fi |
fi |
206 |
|
|