/[MITgcm]/MITgcm_contrib/jmc_script/run_cpl_test.aces
ViewVC logotype

Annotation of /MITgcm_contrib/jmc_script/run_cpl_test.aces

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Mon Aug 1 23:52:33 2011 UTC (13 years, 11 months ago) by jmc
Branch: MAIN
Changes since 1.1: +2 -1 lines
add umask.

1 jmc 1.1 #! /bin/sh
2    
3 jmc 1.2 # $Header: /u/gcmpack/MITgcm_contrib/jmc_script/run_cpl_test.aces,v 1.1 2010/12/06 02:56:35 jmc Exp $
4 jmc 1.1 # $Name: $
5    
6     #- default:
7     Npr=3 ; NpOc=1 ;
8     #Npr=25; NpOc=12;
9     MTH=
10     MTHo=
11     MTHa=
12     GMKopt='-ieee'
13     #GMKopt=
14     rnkO=1 ; rnkA=`expr $rnkO + $NpOc`
15    
16     #- parse options:
17     if [ $# -ge 1 ] ; then if test $1 = '-mth' ; then
18     MTH='-omp' ; shift
19     if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi
20     if test -f input_atm/eedata.mth ; then MTHa=$MTH ; fi
21     fi ; fi
22     if [ $# -ne 1 ]
23     then
24     echo 'Usage:'`basename $0`' [opt] step'
25     echo ' => test coupled set-up on ACES cluster'
26     echo 'opt = -mth : compile and run (if eedata.mth) 2-threads for ocn & atm'
27     echo ' step = 0 : clean all directories'
28     echo ' step = 1 : compile the 3 executables (cpl,ocn,atm)'
29     echo ' step = 2 : copy input files and dir(s)'
30     echo " step = 3 : run with $Npr mpi processes"
31     echo ' step = 4 : check the results'
32     echo ' step = 5 : remove output files in rank_0,1,2 dir.'
33     exit
34     fi
35     kpr=$1
36     dir=`pwd`
37    
38     #============================================================================
39    
40     #- only works from a 3 (or more) nodes PBS bach session on ACES cluster
41     # (tested on ao) ( qsub -I -l nodes=3 -or-
42     # qsub -I -l nodes=3:ppn=2 )
43     # need to be on one computer node,
44     # and with the correct module loaded (i.e, one of the 3):
45     # > module load mpich/gnu
46     # > module load mpich/intel netcdf/3.6.1/icc
47     # export MPI_INC_DIR='/usr/local/pkg/mpich/mpich-intel/include/'
48     # > module load mpich/pgi
49     if test 'dummy'$PBS_NODEFILE = 'dummy'
50     then
51     echo ' $PBS_NODEFILE not defined'
52     echo "for now, works only from a (at least) $Npr nodes PBS bach session"
53     exit 8
54     else nprc=`wc -l $PBS_NODEFILE | awk '{print $1}'`
55     if [ $nprc -lt $Npr ] ; then
56     echo ' Nb of nodes from $PBS_NODEFILE =' $nprc
57     echo "for now, works only from a (at least) $Npr nodes PBS bach session"
58     exit 8
59     fi
60     fi
61 jmc 1.2 umask 0022
62 jmc 1.1
63     #============================================================================
64    
65     if test $kpr = 0
66     then
67     rm -f pr_group std_outp comp_res.{ocn,atm,land,sice}
68     rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.*
69     /bin/rm -r -f rank_? rank_1? rank_2?
70     if test -f build_cpl/Makefile ; then cd build_cpl ; make Clean ; cd .. ; fi
71     if test -f build_ocn/Makefile ; then cd build_ocn ; make Clean ; cd .. ; fi
72     if test -f build_atm/Makefile ; then cd build_atm ; make Clean ; cd .. ; fi
73     fi
74     if test $kpr = 5
75     then
76     echo 'remove output files in rank_0,1,2 dir.'
77     rm -f pr_group std_outp comp_res.{ocn,atm,land,sice}
78     if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi
79     if test -d rank_$rnkO
80     then cd rank_$rnkO ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi
81     if test -d rank_$rnkA
82     then cd rank_$rnkA ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi
83     fi
84    
85     if test $kpr = 1
86     then
87    
88     #- find the optfile that corresponds to the currently loaded mpich module
89     . /etc/profile.d/modules.sh
90     module list -t >& tmp_compiler
91     compiler=`sed -n 's/mpich.*\///p' tmp_compiler`
92     case $compiler in
93     'gnu') OPTFILE="../../tools/build_options/linux_ia32_g77+mpi_aces" ;;
94     'intel') OPTFILE="../../tools/build_options/linux_ia32_ifort+mpi_aces" ;;
95     'pgi') OPTFILE="../../tools/build_options/linux_ia32_pgf77+mpi_aces" ;;
96     *) echo 'ERROR: cannot use compiler:' $compiler ;
97     echo ""; cat tmp_compiler ; exit 7 ;;
98     esac
99     rm -f tmp_compiler
100     echo " Using optfile: $OPTFILE (compiler=$compiler) $MTH"
101     zz=`echo $OPTFILE | grep -c '^\/'`
102     if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi
103     #---
104    
105     echo '==== compile coupler:'
106     cd build_cpl
107     echo ' --- genmake2 (cpl):'
108     ../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt > TTT.genmake.$$
109     tail -5 TTT.genmake.$$
110     echo ' --- make depend (cpl):'
111     make depend > TTT.mkdepend.$$
112     tail -5 TTT.mkdepend.$$
113     echo ' --- make (cpl):'
114     make > TTT.make.$$ 2>&1
115     tail -10 TTT.make.$$
116     echo ' ' ; cd $dir
117    
118     echo '==== compile OGCM:'
119     cd build_ocn
120     echo ' --- genmake2 (ocn):'
121     ../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt > TTT.genmake.$$
122     tail -5 TTT.genmake.$$
123     echo ' --- make depend (ocn):'
124     make depend > TTT.mkdepend.$$
125     tail -10 TTT.mkdepend.$$
126     echo ' --- make (ocn):'
127     make > TTT.make.$$ 2>&1
128     tail -10 TTT.make.$$
129     echo ' ' ; cd $dir
130    
131     echo '==== compile AGCM:'
132     cd build_atm
133     echo ' --- genmake2 (atm):'
134     ../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt > TTT.genmake.$$
135     tail -5 TTT.genmake.$$
136     echo ' --- make depend (atm):'
137     make depend > TTT.mkdepend.$$
138     tail -10 TTT.mkdepend.$$
139     echo ' --- make (atm):'
140     make > TTT.make.$$ 2>&1
141     tail -10 TTT.make.$$
142     echo ' ' ; cd $dir
143    
144     ls -l build_???/mitgcmuv
145    
146     fi
147    
148     if test $kpr = 2
149     then
150     echo 'rm dir:' rank_? rank_1? rank_2?
151     /bin/rm -r -f rank_? rank_1? rank_2?
152     echo 'Link files from dir:' input_cpl '->' rank_0
153     mkdir rank_0
154     ( cd rank_0 ; ln -s ../input_cpl/* . )
155    
156     n=$rnkO
157     echo 'Link files from dir:' input_ocn '->' rank_$n
158     mkdir rank_$n
159     cd rank_$n
160     ln -s ../input_ocn/* .
161     if test -x prepare_run ; then ./prepare_run ; fi
162     if test "x$MTHo" != x ; then
163     echo " MTH run: mv -f eedata.mth eedata"
164     if test -h eedata ; then rm -f eedata ; fi
165     mv -f eedata.mth eedata
166     fi
167     cd $dir
168     n=`expr $n + 1`
169     while [ $n -le $NpOc ] ; do
170     ln -s rank_$rnkO rank_$n
171     n=`expr $n + 1`
172     done
173    
174     n=$rnkA
175     echo 'Link files from dir:' input_atm '->' rank_$n
176     mkdir rank_$n
177     cd rank_$n
178     ln -s ../input_atm/* .
179     if test -x prepare_run ; then ./prepare_run ; fi
180     if test "x$MTHa" != x ; then
181     echo " MTH run: mv -f eedata.mth eedata"
182     if test -h eedata ; then rm -f eedata ; fi
183     mv -f eedata.mth eedata
184     fi
185     cd $dir
186     n=`expr $n + 1`
187     while [ $n -lt $Npr ] ; do
188     ln -s rank_$rnkA rank_$n
189     n=`expr $n + 1`
190     done
191    
192     fi
193    
194     if test $kpr = 3
195     then
196     ROOTDIR=$dir
197     # rm -f rank_?/pickup*.ckptA.00?.00?.??ta
198     echo $ROOTDIR
199     tmpfil=TTT.$$
200    
201     #--- running on the same node:
202     list='' ; nc=0; xx=`hostname`
203     while [ $nc -lt $Npr ] ; do list="$list $xx" ; nc=`expr $nc + 1` ; done
204     #-- On darwin cluster node (from qrsh session):
205     #JOB_ID=`qstat | sed -n '3,$ p' | grep " $USER " | awk '{print $1}'`
206     #NODEFILE="/tmp/$JOB_ID.1.darwin/machines"
207     #echo " JOB_ID = '$JOB_ID' ; NODEFILE = '$NODEFILE'"
208     #-- On ACES cluster (in PBS batch job):
209     NODEFILE=$PBS_NODEFILE
210     #--- running on different nodes:
211     ls -l $NODEFILE
212     nprc=`cat $NODEFILE | uniq | wc -l`
213     if [ $nprc -ge $Npr ] ; then
214     list=`cat $NODEFILE | uniq | head -$Npr`
215     else
216     list=`cat $NODEFILE | head -$Npr`
217     fi
218    
219     nc=0; nn=0; dd1=cpl ;
220     rm -f pr_group ; touch pr_group
221     for xx in $list
222     do
223     echo $xx $nn $dir/build_$dd1/mitgcmuv >> pr_group
224     nc=`expr $nc + 1`
225     if [ $nc -le $NpOc ] ; then dd1=ocn ; else dd1=atm ; fi
226     nn=1
227     done
228    
229     cd $ROOTDIR
230     if test "x$MTH" != x ; then
231     export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m
232     if test "x$MTHo" != x ; then
233     echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;"
234     fi
235     if test "x$MTHa" != x ; then
236     echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;"
237     fi
238     echo ""
239     fi
240     # /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
241     #- with mpich-1 (on danton, ACES):
242     mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1
243     #- with mpich-mx (on beagle):
244     # mpirun -pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1
245     tail -20 std_outp
246     ls -l rank_$rnkO/pickup*.ckptA.001.001.data
247     ls -l rank_$rnkA/pickup*.ckptA.001.001.data
248    
249     fi
250    
251     if test $kpr = 4
252     then
253    
254     if test -f rank_$rnkO/STDOUT.0000
255     then echo '==> check Ocean output:'
256     /home/jmc/bin/comp_res rank_$rnkO/STDOUT.0000 results/ocnSTDOUT.0000
257     mv -f comp_res.log comp_res.ocn
258     echo ' '
259     else echo "No Ocean output file in rank_$rnkO" ; fi
260    
261     if test -f rank_$rnkA/STDOUT.0000
262     then
263     echo '==> check Atmos output:'
264     /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000
265     mv -f comp_res.log comp_res.atm
266     echo '==> check Land output:'
267     /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 L
268     mv -f comp_res.log comp_res.land
269     echo '==> check thSIce output:'
270     /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 I
271     mv -f comp_res.log comp_res.sice
272     echo ' '
273     else echo "No Atmos output file in rank_$rnkA" ; fi
274    
275     fi
276    
277     exit 0

  ViewVC Help
Powered by ViewVC 1.1.22