/[MITgcm]/MITgcm/verification/cpl_aim+ocn/run_cpl_test
ViewVC logotype

Diff of /MITgcm/verification/cpl_aim+ocn/run_cpl_test

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

revision 1.7 by jmc, Sun Feb 13 00:25:37 2005 UTC revision 1.17 by jmc, Mon Dec 6 02:52:40 2010 UTC
# Line 3  Line 3 
3  # $Header$  # $Header$
4  # $Name$  # $Name$
5    
6  Np=3  #- default:
7  Opt=' '   Npr=3 ; NpOc=1 ;
8  Opt='-ieee'  #Npr=25; NpOc=12;
9  if [ $# -lt 1 ]  MTH=
10  then  MTHo=
11    echo 'Usage:'`basename $0`' step '  MTHa=
12    echo ' => test coupled set-up on myrinet cluster'  GMKopt='-ieee'
13    echo 'step = 0 : clean all directories'  #GMKopt=
14    echo 'step = 1 : compile the 3 executables (cpl,ocn,atm)'  rnkO=1 ; rnkA=`expr $rnkO + $NpOc`
15    echo 'step = 2 : copy input files and dir(s)'  
16    echo "step = 3 : run on $Np processor"  #- parse options:
17    echo 'step = 4 : check the results'  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 linux box (1.cpu)'
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    exit
34  fi  fi
35  kpr=$1  kpr=$1
36  dir=`pwd`  dir=`pwd`
37    
 #- only works from a 3 nodes PBS bach session ( qsub -I -l nodes=3:p4 )  
 #  on myrinet cluster:  
 xx=`hostname | sed 's/[0-9]/X/g'`  
 if test $xx != 'myrinet-X-XX'  
 then  
   echo ' hostname='`hostname`  
   echo 'for now, works only on myrinet cluster'  
   exit 9  
 fi  
 if test 'dummy'$PBS_NODEFILE = 'dummy'  
 then  
   echo ' $PBS_NODEFILE not defined'  
   echo "for now, works only from a $Np nodes PBS bach session"  
   exit 8  
 else ncpus=`wc -l $PBS_NODEFILE | awk '{print $1}'`  
  if test $ncpus != $Np ; then  
   echo ' Nb of nodes from $PBS_NODEFILE =' $ncpus  
   echo "for now, works only from a $Np nodes PBS bach session"  
   exit 8  
  fi  
 fi  
   
38  #============================================================================  #============================================================================
39    
40  if test $kpr = 0  if test $kpr = 0
41  then  then
42   rm -f genmake_optfile pr_group std_outp   rm -f pr_group std_outp comp_res.{ocn,atm,land,sice}
43   rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.*   rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.*
44   /bin/rm -r -f rank_0 rank_1 rank_2   /bin/rm -r -f rank_? rank_1? rank_2?
45   if test -f build_cpl/Makefile ; then cd build_cpl ; make CLEAN ; cd .. ; fi   if test -f build_cpl/Makefile ; then cd build_cpl ; make Clean ; cd .. ; fi
46   if test -f build_ocn/Makefile ; then cd build_ocn ; make CLEAN ; cd .. ; fi   if test -f build_ocn/Makefile ; then cd build_ocn ; make Clean ; cd .. ; fi
47   if test -f build_atm/Makefile ; then cd build_atm ; make CLEAN ; cd .. ; fi   if test -f build_atm/Makefile ; then cd build_atm ; make Clean ; cd .. ; fi
48    fi
49    if test $kpr = 5
50    then
51     echo 'remove output files in rank_0,1,2 dir.'
52     rm -f pr_group std_outp comp_res.{ocn,atm,land,sice}
53     if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi
54     if test -d rank_$rnkO
55     then cd rank_$rnkO ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi
56     if test -d rank_$rnkA
57     then cd rank_$rnkA ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi
58  fi  fi
59    
60  if test $kpr = 1  if test $kpr = 1
61  then  then
62    
63   cp -p ../../tools/build_options/linux_ia32_ifc+mpi_cg01 genmake_optfile  #- choice of the optfile: take a local one in dir verification with sufix '+mpi'
64     nbOpF=`ls ../linux_* | grep '+mpi' 2> /dev/null | wc -l`
65     if test $nbOpF = 1 ; then
66       OPTFILE=`ls ../linux_* | grep '+mpi'`
67       zz=`grep '^FC=' $OPTFILE`
68       echo " Using optfile: $OPTFILE  (compiler=$zz) $MTH"
69     elif [ $nbOpF -ge 2 ] ; then
70       echo "pick the 1rst of these ( $nbOpF ) optfiles:"
71       ls ../linux_* | grep '+mpi'
72       OPTFILE=`ls ../linux_* | grep '+mpi' | head -1`
73       zz=`grep '^FC=' $OPTFILE`
74       echo " Using optfile: $OPTFILE  (compiler=$zz) $MTH"
75     else
76       echo "Pb in finding optfile: found $nbOpF :"
77       ls ../linux_* | grep '+mpi' ; exit
78     fi
79     zz=`echo $OPTFILE | grep -c '^\/'`
80     if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi
81    #---
82   echo '==== compile coupler:'   echo '==== compile coupler:'
83   cd build_cpl   cd build_cpl
84   echo ' --- genmake2 (cpl):'   echo ' --- genmake2 (cpl):'
85   ../../../tools/genmake2 -of ../genmake_optfile $Opt >  TTT.genmake.$$   ../../../tools/genmake2 -of $OPTFILE -mpi $GMKopt >  TTT.genmake.$$
86   tail -5 TTT.genmake.$$   tail -5 TTT.genmake.$$
87   echo ' --- make depend (cpl):'   echo ' --- make depend (cpl):'
88   make depend > TTT.mkdepend.$$   make depend > TTT.mkdepend.$$
# Line 74  then Line 95  then
95   echo '==== compile OGCM:'   echo '==== compile OGCM:'
96   cd build_ocn   cd build_ocn
97   echo ' --- genmake2 (ocn):'   echo ' --- genmake2 (ocn):'
98   ../../../tools/genmake2 -of ../genmake_optfile $Opt >  TTT.genmake.$$   ../../../tools/genmake2 -of $OPTFILE -mpi $MTHo $GMKopt >  TTT.genmake.$$
99   tail -5 TTT.genmake.$$   tail -5 TTT.genmake.$$
100   echo ' --- make depend (ocn):'   echo ' --- make depend (ocn):'
101   make depend > TTT.mkdepend.$$   make depend > TTT.mkdepend.$$
# Line 87  then Line 108  then
108   echo '==== compile AGCM:'   echo '==== compile AGCM:'
109   cd build_atm   cd build_atm
110   echo ' --- genmake2 (atm):'   echo ' --- genmake2 (atm):'
111   ../../../tools/genmake2 -of ../genmake_optfile $Opt >  TTT.genmake.$$   ../../../tools/genmake2 -of $OPTFILE -mpi $MTHa $GMKopt >  TTT.genmake.$$
112   tail -5 TTT.genmake.$$   tail -5 TTT.genmake.$$
113   echo ' --- make depend (atm):'   echo ' --- make depend (atm):'
114   make depend > TTT.mkdepend.$$   make depend > TTT.mkdepend.$$
# Line 103  fi Line 124  fi
124    
125  if test $kpr = 2  if test $kpr = 2
126  then  then
127    /bin/rm -r -f rank_0 rank_1 rank_2    echo 'rm dir:' rank_? rank_1? rank_2?
128    cp -p -r input_cpl rank_0    /bin/rm -r -f rank_? rank_1? rank_2?
129    cp -p -r input_ocn rank_1    echo 'Link files from dir:' input_cpl '->' rank_0
130    cp -p -r input_atm rank_2    mkdir rank_0
131      ( cd rank_0 ; ln -s ../input_cpl/* . )
132    cd rank_1  
133    ./IMPORT_INPUT_FILES    n=$rnkO
134      echo 'Link files from dir:' input_ocn '->' rank_$n
135      mkdir rank_$n
136      cd rank_$n
137      ln -s ../input_ocn/* .
138      if test -x prepare_run ; then ./prepare_run ; fi
139      if test "x$MTHo" != x ; then
140        echo " MTH run: mv -f eedata.mth eedata"
141        if test -h eedata ; then rm -f eedata ; fi
142        mv -f eedata.mth eedata
143      fi
144    cd $dir    cd $dir
145      n=`expr $n + 1`
146    cd rank_2    while [ $n -le $NpOc ] ; do
147    ./SHARE_OCN_GRID '../rank_1'      ln -s rank_$rnkO rank_$n
148    ./IMPORT_INPUT_FILES      n=`expr $n + 1`
149      done
150    
151      n=$rnkA
152      echo 'Link files from dir:' input_atm '->' rank_$n
153      mkdir rank_$n
154      cd rank_$n
155      ln -s ../input_atm/* .
156      if test -x prepare_run ; then ./prepare_run ; fi
157      if test "x$MTHa" != x ; then
158        echo " MTH run: mv -f eedata.mth eedata"
159        if test -h eedata ; then rm -f eedata ; fi
160        mv -f eedata.mth eedata
161      fi
162    cd $dir    cd $dir
163      n=`expr $n + 1`
164      while [ $n -lt $Npr ] ; do
165        ln -s rank_$rnkA rank_$n
166        n=`expr $n + 1`
167      done
168    
169  fi  fi
170    
171  if test $kpr = 3  if test $kpr = 3
172  then  then
173   ROOTDIR=$dir    ROOTDIR=$dir
174   rm -f rank_?/pickup*.ckptA.00?.00?.??ta  # rm -f rank_?/pickup*.ckptA.00?.00?.??ta
175   echo $ROOTDIR    echo $ROOTDIR
176   tmpfil=TTT.$$    tmpfil=TTT.$$
177    
178   echo $PBS_NODEFILE  #--- running on the same node:
179   list=`cat $PBS_NODEFILE`    list='' ; nc=0; xx=`hostname`
180   rm -f pr_group ; touch pr_group    while [ $nc -lt $Npr ] ; do list="$list $xx" ; nc=`expr $nc + 1` ; done
181   nc=0 ; dd1=cpl ;  #-- On darwin cluster node (from qrsh session):
182   for xx in $list  # JOB_ID=`qstat | sed -n '3,$ p' | grep " $USER " | awk '{print $1}'`
183   do  # NODEFILE="/tmp/$JOB_ID.1.darwin/machines"
184    echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group  # echo " JOB_ID = '$JOB_ID' ; NODEFILE = '$NODEFILE'"
185    if test $nc = 0 ; then dd1=ocn ; else dd1=atm ; fi  #-- On ACES cluster (in PBS batch job):
186    nc=1  # NODEFILE=$PBS_NODEFILE
187   done  #--- running on different nodes:
188    # ls -l $NODEFILE
189   cd $ROOTDIR  # nprc=`cat $NODEFILE | uniq | wc -l`
190   #  -wd $ROOTDIR  # if [ $nprc -ge $Npr ] ; then
191   /usr/local/pkg/mpi/mpi-1.2.4..8a-gm-1.5/pgi/bin/mpirun.ch_gm -pg pr_group --gm-kill 5 -v  ./build_cpl/mitgcmuv > std_outp 2>&1  #   list=`cat $NODEFILE | uniq | head -$Npr`
192   tail -20 std_outp  # else
193   ls -l rank_?/pickup*.ckptA.001.001.data  #   list=`cat $NODEFILE | head -$Npr`
194    # fi
195    
196      nc=0; nn=0; dd1=cpl ;
197      rm -f pr_group ; touch pr_group
198      for xx in $list
199      do
200        echo $xx $nn $dir/build_$dd1/mitgcmuv >> pr_group
201        nc=`expr $nc + 1`
202        if [ $nc -le $NpOc ] ; then dd1=ocn ; else dd1=atm ; fi
203        nn=1
204      done
205    
206      cd $ROOTDIR
207      if test "x$MTH" != x ; then
208        export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m
209        if test "x$MTHo" != x ; then
210          echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;"
211        fi
212        if test "x$MTHa" != x ; then
213          echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;"
214        fi
215        echo ""
216      fi
217    # /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
218    #- with mpich-1 (on danton, ACES):
219      mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1
220    #- with mpich-mx (on beagle):
221    # mpirun -pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1
222      tail -20 std_outp
223      ls -l rank_$rnkO/pickup*.ckptA.001.001.data
224      ls -l rank_$rnkA/pickup*.ckptA.001.001.data
225    
226  fi  fi
227    
228  if test $kpr = 4  if test $kpr = 4
229  then  then
230    
231   if test -f rank_1/STDOUT.0000   if test -f rank_$rnkO/STDOUT.0000
232   then echo '==> check Ocean output:'   then echo '==> check Ocean output:'
233      /home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000      /home/jmc/bin/comp_res rank_$rnkO/STDOUT.0000 results/ocnSTDOUT.0000
234     echo ' '      mv -f comp_res.log comp_res.ocn
235   else echo 'No Ocean output file in rank_1' ; fi      echo ' '
236     else echo "No Ocean output file in rank_$rnkO" ; fi
237    
238   if test -f rank_2/STDOUT.0000   if test -f rank_$rnkA/STDOUT.0000
239   then   then
240      echo '==> check Atmos output:'      echo '==> check Atmos output:'
241      /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000      /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000
242        mv -f comp_res.log comp_res.atm
243      echo '==> check Land output:'      echo '==> check Land output:'
244      /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L      /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 L
245        mv -f comp_res.log comp_res.land
246      echo '==> check thSIce output:'      echo '==> check thSIce output:'
247      /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I      /home/jmc/bin/comp_res rank_$rnkA/STDOUT.0000 results/atmSTDOUT.0000 I
248     echo ' '      mv -f comp_res.log comp_res.sice
249   else echo 'No Atmos output file in rank_1' ; fi      echo ' '
250     else echo "No Atmos output file in rank_$rnkA" ; fi
251    
252  fi  fi
253    

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.22