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