1 |
#! /bin/sh |
2 |
|
3 |
# $Header: /u/gcmpack/MITgcm/verification/cpl_aim+ocn/run_cpl_test_itrda,v 1.10 2007/09/18 03:07:23 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 genmake_optfile 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 genmake_optfile 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 |
yy=`ls ../linux_*.mpi` ; cp -p $yy genmake_optfile |
52 |
zz=`grep '^FC=' genmake_optfile` |
53 |
echo " Using optfile: $yy (compiler=$zz)" |
54 |
else echo 'Pb in finding optfile' ; exit; |
55 |
fi |
56 |
#--- |
57 |
echo '==== compile coupler:' |
58 |
cd build_cpl |
59 |
echo ' --- genmake2 (cpl):' |
60 |
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
61 |
tail -5 TTT.genmake.$$ |
62 |
echo ' --- make depend (cpl):' |
63 |
make depend > TTT.mkdepend.$$ |
64 |
tail -5 TTT.mkdepend.$$ |
65 |
echo ' --- make (cpl):' |
66 |
make > TTT.make.$$ 2>&1 |
67 |
tail -10 TTT.make.$$ |
68 |
echo ' ' ; cd $dir |
69 |
|
70 |
echo '==== compile OGCM:' |
71 |
cd build_ocn |
72 |
echo ' --- genmake2 (ocn):' |
73 |
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
74 |
tail -5 TTT.genmake.$$ |
75 |
echo ' --- make depend (ocn):' |
76 |
make depend > TTT.mkdepend.$$ |
77 |
tail -10 TTT.mkdepend.$$ |
78 |
echo ' --- make (ocn):' |
79 |
make > TTT.make.$$ 2>&1 |
80 |
tail -10 TTT.make.$$ |
81 |
echo ' ' ; cd $dir |
82 |
|
83 |
echo '==== compile AGCM:' |
84 |
cd build_atm |
85 |
echo ' --- genmake2 (atm):' |
86 |
../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ |
87 |
tail -5 TTT.genmake.$$ |
88 |
echo ' --- make depend (atm):' |
89 |
make depend > TTT.mkdepend.$$ |
90 |
tail -10 TTT.mkdepend.$$ |
91 |
echo ' --- make (atm):' |
92 |
make > TTT.make.$$ 2>&1 |
93 |
tail -10 TTT.make.$$ |
94 |
echo ' ' ; cd $dir |
95 |
|
96 |
ls -l build_???/mitgcmuv |
97 |
|
98 |
fi |
99 |
|
100 |
if test $kpr = 2 |
101 |
then |
102 |
/bin/rm -r -f rank_0 rank_1 rank_2 |
103 |
echo 'CP dir:' input_cpl '->' rank_0 |
104 |
cp -p -r input_cpl rank_0 |
105 |
|
106 |
echo 'CP dir:' input_ocn '->' rank_1 |
107 |
cp -p -r input_ocn rank_1 |
108 |
cd rank_1 |
109 |
./prepare_run |
110 |
cd $dir |
111 |
|
112 |
echo 'CP dir:' input_atm '->' rank_2 |
113 |
cp -p -r input_atm rank_2 |
114 |
cd rank_2 |
115 |
./prepare_run |
116 |
cd $dir |
117 |
|
118 |
fi |
119 |
|
120 |
if test $kpr = 3 |
121 |
then |
122 |
ROOTDIR=$dir |
123 |
rm -f rank_?/pickup*.ckptA.00?.00?.??ta |
124 |
echo $ROOTDIR |
125 |
tmpfil=TTT.$$ |
126 |
|
127 |
rm -f pr_group ; touch pr_group |
128 |
nc=0; xx=`hostname` |
129 |
for dd1 in cpl ocn atm |
130 |
do |
131 |
echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group |
132 |
nc=1 |
133 |
done |
134 |
|
135 |
cd $ROOTDIR |
136 |
# /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 |
137 |
mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 |
138 |
tail -20 std_outp |
139 |
ls -l rank_?/pickup*.ckptA.001.001.data |
140 |
|
141 |
fi |
142 |
|
143 |
if test $kpr = 4 |
144 |
then |
145 |
|
146 |
if test -f rank_1/STDOUT.0000 |
147 |
then echo '==> check Ocean output:' |
148 |
/home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 |
149 |
mv -f comp_res.log comp_res.ocn |
150 |
echo ' ' |
151 |
else echo 'No Ocean output file in rank_1' ; fi |
152 |
|
153 |
if test -f rank_2/STDOUT.0000 |
154 |
then |
155 |
echo '==> check Atmos output:' |
156 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 |
157 |
mv -f comp_res.log comp_res.atm |
158 |
echo '==> check Land output:' |
159 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L |
160 |
mv -f comp_res.log comp_res.land |
161 |
echo '==> check thSIce output:' |
162 |
/home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I |
163 |
mv -f comp_res.log comp_res.sice |
164 |
echo ' ' |
165 |
else echo 'No Atmos output file in rank_1' ; fi |
166 |
|
167 |
fi |
168 |
|
169 |
exit 0 |