1 |
edhill |
1.1 |
#! /bin/sh |
2 |
|
|
|
3 |
jmc |
1.10 |
# $Header: /u/gcmpack/MITgcm/verification/cpl_aim+ocn/run_cpl_test_itrda,v 1.9 2007/03/08 18:25:54 jmc Exp $ |
4 |
edhill |
1.1 |
# $Name: $ |
5 |
|
|
|
6 |
|
|
Np=3 |
7 |
|
|
if [ $# -lt 1 ] |
8 |
|
|
then |
9 |
|
|
echo 'Usage:'`basename $0`' step ' |
10 |
|
|
echo ' => test coupled set-up on myrinet cluster' |
11 |
|
|
echo 'step = 0 : clean all directories' |
12 |
|
|
echo 'step = 1 : compile the 3 executables (cpl,ocn,atm)' |
13 |
|
|
echo 'step = 2 : copy input files and dir(s)' |
14 |
|
|
echo "step = 3 : run on $Np processor" |
15 |
|
|
echo 'step = 4 : check the results' |
16 |
jmc |
1.5 |
echo 'step = 5 : remove output files in rank_0,1,2 dir.' |
17 |
edhill |
1.1 |
exit |
18 |
|
|
fi |
19 |
|
|
kpr=$1 |
20 |
|
|
dir=`pwd` |
21 |
|
|
|
22 |
jmc |
1.9 |
#- only works from a 3 (or more) nodes PBS bach session ( qsub -I -l nodes=3 ) |
23 |
jmc |
1.7 |
# on ACES cluster (tested on itrda). |
24 |
|
|
# need to be on one computer node, |
25 |
|
|
# and with the correct module loaded (i.e, one of the 3): |
26 |
|
|
# > module load mpich/gnu |
27 |
|
|
# > module load mpich/intel |
28 |
|
|
# > module load mpich/pgi |
29 |
edhill |
1.1 |
if test 'dummy'$PBS_NODEFILE = 'dummy' |
30 |
|
|
then |
31 |
|
|
echo ' $PBS_NODEFILE not defined' |
32 |
jmc |
1.9 |
echo "for now, works only from a (at least) $Np nodes PBS bach session" |
33 |
edhill |
1.1 |
exit 8 |
34 |
|
|
else ncpus=`wc -l $PBS_NODEFILE | awk '{print $1}'` |
35 |
jmc |
1.9 |
if [ $ncpus -lt $Np ] ; then |
36 |
edhill |
1.1 |
echo ' Nb of nodes from $PBS_NODEFILE =' $ncpus |
37 |
jmc |
1.9 |
echo "for now, works only from a (at least) $Np nodes PBS bach session" |
38 |
edhill |
1.1 |
exit 8 |
39 |
|
|
fi |
40 |
|
|
fi |
41 |
|
|
|
42 |
|
|
#============================================================================ |
43 |
|
|
|
44 |
|
|
if test $kpr = 0 |
45 |
|
|
then |
46 |
jmc |
1.10 |
rm -f genmake_optfile pr_group std_outp comp_res.{ocn,atm,land,sice} |
47 |
edhill |
1.1 |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
48 |
|
|
/bin/rm -r -f rank_0 rank_1 rank_2 |
49 |
|
|
if test -f build_cpl/Makefile ; then cd build_cpl ; make CLEAN ; cd .. ; fi |
50 |
|
|
if test -f build_ocn/Makefile ; then cd build_ocn ; make CLEAN ; cd .. ; fi |
51 |
|
|
if test -f build_atm/Makefile ; then cd build_atm ; make CLEAN ; cd .. ; fi |
52 |
|
|
fi |
53 |
jmc |
1.5 |
if test $kpr = 5 |
54 |
|
|
then |
55 |
|
|
echo 'remove output files in rank_0,1,2 dir.' |
56 |
jmc |
1.10 |
rm -f genmake_optfile pr_group std_outp comp_res.{ocn,atm,land,sice} |
57 |
jmc |
1.5 |
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
58 |
|
|
if test -d rank_1 |
59 |
|
|
then cd rank_1 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
60 |
|
|
if test -d rank_2 |
61 |
|
|
then cd rank_2 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
62 |
|
|
fi |
63 |
edhill |
1.1 |
|
64 |
|
|
if test $kpr = 1 |
65 |
|
|
then |
66 |
|
|
|
67 |
jmc |
1.6 |
#- find the optfile that corresponds to the currently loaded mpich module |
68 |
|
|
. /etc/profile.d/modules.sh |
69 |
|
|
module list -t >& tmp_compiler |
70 |
|
|
compiler=`sed -n 's/mpich\///p' tmp_compiler` |
71 |
|
|
case $compiler in |
72 |
jmc |
1.8 |
'gnu') cp -p ../../tools/build_options/linux_ia32_g77+mpi_aces genmake_optfile ;; |
73 |
|
|
'intel') cp -p ../../tools/build_options/linux_ia32_ifort+mpi_aces genmake_optfile ;; |
74 |
|
|
'pgi') cp -p ../../tools/build_options/linux_ia32_pgf77+mpi_aces genmake_optfile ;; |
75 |
jmc |
1.6 |
*) echo 'ERROR: cannot use compiler:' $compiler ; |
76 |
|
|
echo ""; cat tmp_compiler ; exit 7 ;; |
77 |
|
|
esac |
78 |
|
|
rm -f tmp_compiler |
79 |
|
|
echo " Using" $compiler "compiler:" |
80 |
|
|
#--- |
81 |
edhill |
1.1 |
echo '==== compile coupler:' |
82 |
|
|
cd build_cpl |
83 |
|
|
echo ' --- genmake2 (cpl):' |
84 |
|
|
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
85 |
|
|
tail -5 TTT.genmake.$$ |
86 |
|
|
echo ' --- make depend (cpl):' |
87 |
|
|
make depend > TTT.mkdepend.$$ |
88 |
|
|
tail -5 TTT.mkdepend.$$ |
89 |
|
|
echo ' --- make (cpl):' |
90 |
|
|
make -j 2 > TTT.make.$$ 2>&1 |
91 |
|
|
tail -10 TTT.make.$$ |
92 |
|
|
echo ' ' ; cd $dir |
93 |
|
|
|
94 |
|
|
echo '==== compile OGCM:' |
95 |
|
|
cd build_ocn |
96 |
|
|
echo ' --- genmake2 (ocn):' |
97 |
|
|
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
98 |
|
|
tail -5 TTT.genmake.$$ |
99 |
|
|
echo ' --- make depend (ocn):' |
100 |
|
|
make depend > TTT.mkdepend.$$ |
101 |
|
|
tail -10 TTT.mkdepend.$$ |
102 |
|
|
echo ' --- make (ocn):' |
103 |
|
|
make -j 2 > TTT.make.$$ 2>&1 |
104 |
|
|
tail -10 TTT.make.$$ |
105 |
|
|
echo ' ' ; cd $dir |
106 |
|
|
|
107 |
|
|
echo '==== compile AGCM:' |
108 |
|
|
cd build_atm |
109 |
|
|
echo ' --- genmake2 (atm):' |
110 |
|
|
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
111 |
|
|
tail -5 TTT.genmake.$$ |
112 |
|
|
echo ' --- make depend (atm):' |
113 |
|
|
make depend > TTT.mkdepend.$$ |
114 |
|
|
tail -10 TTT.mkdepend.$$ |
115 |
|
|
echo ' --- make (atm):' |
116 |
|
|
make -j 2 > TTT.make.$$ 2>&1 |
117 |
|
|
tail -10 TTT.make.$$ |
118 |
|
|
echo ' ' ; cd $dir |
119 |
|
|
|
120 |
|
|
ls -l build_???/mitgcmuv |
121 |
|
|
|
122 |
|
|
fi |
123 |
|
|
|
124 |
|
|
if test $kpr = 2 |
125 |
|
|
then |
126 |
jmc |
1.7 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
127 |
|
|
echo 'CP dir:' input_cpl '->' rank_0 |
128 |
edhill |
1.1 |
cp -p -r input_cpl rank_0 |
129 |
jmc |
1.7 |
|
130 |
|
|
echo 'CP dir:' input_ocn '->' rank_1 |
131 |
edhill |
1.1 |
cp -p -r input_ocn rank_1 |
132 |
|
|
cd rank_1 |
133 |
jmc |
1.7 |
./prepare_run |
134 |
edhill |
1.1 |
cd $dir |
135 |
|
|
|
136 |
jmc |
1.7 |
echo 'CP dir:' input_atm '->' rank_2 |
137 |
|
|
cp -p -r input_atm rank_2 |
138 |
edhill |
1.1 |
cd rank_2 |
139 |
jmc |
1.7 |
./prepare_run |
140 |
edhill |
1.1 |
cd $dir |
141 |
|
|
|
142 |
|
|
fi |
143 |
|
|
|
144 |
|
|
if test $kpr = 3 |
145 |
|
|
then |
146 |
|
|
ROOTDIR=$dir |
147 |
|
|
rm -f rank_?/pickup*.ckptA.00?.00?.??ta |
148 |
|
|
echo $ROOTDIR |
149 |
|
|
tmpfil=TTT.$$ |
150 |
|
|
|
151 |
|
|
echo $PBS_NODEFILE |
152 |
jmc |
1.9 |
list=`cat $PBS_NODEFILE | head -$Np` |
153 |
edhill |
1.1 |
rm -f pr_group ; touch pr_group |
154 |
|
|
nc=0 ; dd1=cpl ; |
155 |
|
|
for xx in $list |
156 |
|
|
do |
157 |
|
|
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
158 |
|
|
if test $nc = 0 ; then dd1=ocn ; else dd1=atm ; fi |
159 |
|
|
nc=1 |
160 |
|
|
done |
161 |
|
|
|
162 |
|
|
cd $ROOTDIR |
163 |
|
|
# /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 |
164 |
|
|
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
165 |
|
|
tail -20 std_outp |
166 |
|
|
ls -l rank_?/pickup*.ckptA.001.001.data |
167 |
|
|
|
168 |
|
|
fi |
169 |
|
|
|
170 |
|
|
if test $kpr = 4 |
171 |
|
|
then |
172 |
|
|
|
173 |
|
|
if test -f rank_1/STDOUT.0000 |
174 |
|
|
then echo '==> check Ocean output:' |
175 |
|
|
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
176 |
jmc |
1.10 |
mv -f comp_res.log comp_res.ocn |
177 |
|
|
echo ' ' |
178 |
edhill |
1.1 |
else echo 'No Ocean output file in rank_1' ; fi |
179 |
|
|
|
180 |
|
|
if test -f rank_2/STDOUT.0000 |
181 |
|
|
then |
182 |
|
|
echo '==> check Atmos output:' |
183 |
|
|
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
184 |
jmc |
1.10 |
mv -f comp_res.log comp_res.atm |
185 |
edhill |
1.1 |
echo '==> check Land output:' |
186 |
|
|
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
187 |
jmc |
1.10 |
mv -f comp_res.log comp_res.land |
188 |
edhill |
1.1 |
echo '==> check thSIce output:' |
189 |
|
|
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
190 |
jmc |
1.10 |
mv -f comp_res.log comp_res.sice |
191 |
|
|
echo ' ' |
192 |
edhill |
1.1 |
else echo 'No Atmos output file in rank_1' ; fi |
193 |
|
|
|
194 |
|
|
fi |
195 |
|
|
|
196 |
|
|
exit 0 |