1 |
#! /bin/sh |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/verification/cpl_aim+ocn/run_cpl_test,v 1.10 2007/11/07 01:45:02 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 linux box (1.cpu)' |
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 with $Np mpi processes" |
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 |
#============================================================================ |
23 |
|
24 |
if test $kpr = 0 |
25 |
then |
26 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
27 |
rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* |
28 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
29 |
if test -f build_cpl/Makefile ; then cd build_cpl ; make CLEAN ; cd .. ; fi |
30 |
if test -f build_ocn/Makefile ; then cd build_ocn ; make CLEAN ; cd .. ; fi |
31 |
if test -f build_atm/Makefile ; then cd build_atm ; make CLEAN ; cd .. ; fi |
32 |
fi |
33 |
if test $kpr = 5 |
34 |
then |
35 |
echo 'remove output files in rank_0,1,2 dir.' |
36 |
rm -f pr_group std_outp comp_res.{ocn,atm,land,sice} |
37 |
if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi |
38 |
if test -d rank_1 |
39 |
then cd rank_1 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
40 |
if test -d rank_2 |
41 |
then cd rank_2 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi |
42 |
fi |
43 |
|
44 |
if test $kpr = 1 |
45 |
then |
46 |
|
47 |
#- choice of the optfile: take a local one in dir verification with sufix '.mpi' |
48 |
nbOpF=`ls ../linux_*.mpi 2> /dev/null | wc -l` |
49 |
if test $nbOpF = 1 |
50 |
then |
51 |
OPTFILE=`ls ../linux_*.mpi` |
52 |
zz=`grep '^FC=' $OPTFILE` |
53 |
echo " Using optfile: $OPTFILE (compiler=$zz)" |
54 |
else echo 'Pb in finding optfile' ; exit; |
55 |
fi |
56 |
zz=`echo $OPTFILE | grep -c '^\/'` |
57 |
if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi |
58 |
#--- |
59 |
echo '==== compile coupler:' |
60 |
cd build_cpl |
61 |
echo ' --- genmake2 (cpl):' |
62 |
../../../tools/genmake2 -of $OPTFILE -mpi -ieee > TTT.genmake.$$ |
63 |
tail -5 TTT.genmake.$$ |
64 |
echo ' --- make depend (cpl):' |
65 |
make depend > TTT.mkdepend.$$ |
66 |
tail -5 TTT.mkdepend.$$ |
67 |
echo ' --- make (cpl):' |
68 |
make > TTT.make.$$ 2>&1 |
69 |
tail -10 TTT.make.$$ |
70 |
echo ' ' ; cd $dir |
71 |
|
72 |
echo '==== compile OGCM:' |
73 |
cd build_ocn |
74 |
echo ' --- genmake2 (ocn):' |
75 |
../../../tools/genmake2 -of $OPTFILE -mpi -ieee > TTT.genmake.$$ |
76 |
tail -5 TTT.genmake.$$ |
77 |
echo ' --- make depend (ocn):' |
78 |
make depend > TTT.mkdepend.$$ |
79 |
tail -10 TTT.mkdepend.$$ |
80 |
echo ' --- make (ocn):' |
81 |
make > TTT.make.$$ 2>&1 |
82 |
tail -10 TTT.make.$$ |
83 |
echo ' ' ; cd $dir |
84 |
|
85 |
echo '==== compile AGCM:' |
86 |
cd build_atm |
87 |
echo ' --- genmake2 (atm):' |
88 |
../../../tools/genmake2 -of $OPTFILE -mpi -ieee > TTT.genmake.$$ |
89 |
tail -5 TTT.genmake.$$ |
90 |
echo ' --- make depend (atm):' |
91 |
make depend > TTT.mkdepend.$$ |
92 |
tail -10 TTT.mkdepend.$$ |
93 |
echo ' --- make (atm):' |
94 |
make > TTT.make.$$ 2>&1 |
95 |
tail -10 TTT.make.$$ |
96 |
echo ' ' ; cd $dir |
97 |
|
98 |
ls -l build_???/mitgcmuv |
99 |
|
100 |
fi |
101 |
|
102 |
if test $kpr = 2 |
103 |
then |
104 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
105 |
echo 'CP dir:' input_cpl '->' rank_0 |
106 |
cp -p -r input_cpl rank_0 |
107 |
|
108 |
echo 'CP dir:' input_ocn '->' rank_1 |
109 |
cp -p -r input_ocn rank_1 |
110 |
cd rank_1 |
111 |
./prepare_run |
112 |
cd $dir |
113 |
|
114 |
echo 'CP dir:' input_atm '->' rank_2 |
115 |
cp -p -r input_atm rank_2 |
116 |
cd rank_2 |
117 |
./prepare_run |
118 |
cd $dir |
119 |
|
120 |
fi |
121 |
|
122 |
if test $kpr = 3 |
123 |
then |
124 |
ROOTDIR=$dir |
125 |
rm -f rank_?/pickup*.ckptA.00?.00?.??ta |
126 |
echo $ROOTDIR |
127 |
tmpfil=TTT.$$ |
128 |
|
129 |
rm -f pr_group ; touch pr_group |
130 |
nc=0; xx=`hostname` |
131 |
for dd1 in cpl ocn atm |
132 |
do |
133 |
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
134 |
nc=1 |
135 |
done |
136 |
|
137 |
cd $ROOTDIR |
138 |
# /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 |
139 |
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
140 |
tail -20 std_outp |
141 |
ls -l rank_?/pickup*.ckptA.001.001.data |
142 |
|
143 |
fi |
144 |
|
145 |
if test $kpr = 4 |
146 |
then |
147 |
|
148 |
if test -f rank_1/STDOUT.0000 |
149 |
then echo '==> check Ocean output:' |
150 |
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
151 |
mv -f comp_res.log comp_res.ocn |
152 |
echo ' ' |
153 |
else echo 'No Ocean output file in rank_1' ; fi |
154 |
|
155 |
if test -f rank_2/STDOUT.0000 |
156 |
then |
157 |
echo '==> check Atmos output:' |
158 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
159 |
mv -f comp_res.log comp_res.atm |
160 |
echo '==> check Land output:' |
161 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
162 |
mv -f comp_res.log comp_res.land |
163 |
echo '==> check thSIce output:' |
164 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
165 |
mv -f comp_res.log comp_res.sice |
166 |
echo ' ' |
167 |
else echo 'No Atmos output file in rank_1' ; fi |
168 |
|
169 |
fi |
170 |
|
171 |
exit 0 |