#! /bin/sh # $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/cpl_aim+ocn/run_cpl_test,v 1.10 2007/11/07 01:45:02 jmc Exp $ # $Name: $ Np=3 if [ $# -lt 1 ] then echo 'Usage:'`basename $0`' step ' echo ' => test coupled set-up on linux box (1.cpu)' echo 'step = 0 : clean all directories' echo 'step = 1 : compile the 3 executables (cpl,ocn,atm)' echo 'step = 2 : copy input files and dir(s)' echo "step = 3 : run with $Np mpi processes" echo 'step = 4 : check the results' echo 'step = 5 : remove output files in rank_0,1,2 dir.' exit fi kpr=$1 dir=`pwd` #============================================================================ if test $kpr = 0 then rm -f genmake_optfile pr_group std_outp comp_res.{ocn,atm,land,sice} rm -f build_???/TTT.*make.* build_???/TTT.mkdepend.* /bin/rm -r -f rank_0 rank_1 rank_2 if test -f build_cpl/Makefile ; then cd build_cpl ; make CLEAN ; cd .. ; fi if test -f build_ocn/Makefile ; then cd build_ocn ; make CLEAN ; cd .. ; fi if test -f build_atm/Makefile ; then cd build_atm ; make CLEAN ; cd .. ; fi fi if test $kpr = 5 then echo 'remove output files in rank_0,1,2 dir.' rm -f genmake_optfile pr_group std_outp comp_res.{ocn,atm,land,sice} if test -d rank_0 ; then cd rank_0 ; rm -f Coupler.0000.clog ; cd .. ; fi if test -d rank_1 then cd rank_1 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi if test -d rank_2 then cd rank_2 ; rm -f *.data *.meta STD???.0000 UV-*.0001.clog ; cd .. ; fi fi if test $kpr = 1 then #- choice of the optfile: take a local one in dir verification with sufix '.mpi' nbOpF=`ls ../linux_*.mpi 2> /dev/null | wc -l` if test $nbOpF = 1 then yy=`ls ../linux_*.mpi` ; cp -p $yy genmake_optfile zz=`grep '^FC=' genmake_optfile` echo " Using optfile: $yy (compiler=$zz)" else echo 'Pb in finding optfile' ; exit; fi #--- echo '==== compile coupler:' cd build_cpl echo ' --- genmake2 (cpl):' ../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ tail -5 TTT.genmake.$$ echo ' --- make depend (cpl):' make depend > TTT.mkdepend.$$ tail -5 TTT.mkdepend.$$ echo ' --- make (cpl):' make > TTT.make.$$ 2>&1 tail -10 TTT.make.$$ echo ' ' ; cd $dir echo '==== compile OGCM:' cd build_ocn echo ' --- genmake2 (ocn):' ../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ tail -5 TTT.genmake.$$ echo ' --- make depend (ocn):' make depend > TTT.mkdepend.$$ tail -10 TTT.mkdepend.$$ echo ' --- make (ocn):' make > TTT.make.$$ 2>&1 tail -10 TTT.make.$$ echo ' ' ; cd $dir echo '==== compile AGCM:' cd build_atm echo ' --- genmake2 (atm):' ../../../tools/genmake2 -of ../genmake_optfile -mpi -ieee > TTT.genmake.$$ tail -5 TTT.genmake.$$ echo ' --- make depend (atm):' make depend > TTT.mkdepend.$$ tail -10 TTT.mkdepend.$$ echo ' --- make (atm):' make > TTT.make.$$ 2>&1 tail -10 TTT.make.$$ echo ' ' ; cd $dir ls -l build_???/mitgcmuv fi if test $kpr = 2 then /bin/rm -r -f rank_0 rank_1 rank_2 echo 'CP dir:' input_cpl '->' rank_0 cp -p -r input_cpl rank_0 echo 'CP dir:' input_ocn '->' rank_1 cp -p -r input_ocn rank_1 cd rank_1 ./prepare_run cd $dir echo 'CP dir:' input_atm '->' rank_2 cp -p -r input_atm rank_2 cd rank_2 ./prepare_run cd $dir fi if test $kpr = 3 then ROOTDIR=$dir rm -f rank_?/pickup*.ckptA.00?.00?.??ta echo $ROOTDIR tmpfil=TTT.$$ rm -f pr_group ; touch pr_group nc=0; xx=`hostname` for dd1 in cpl ocn atm do echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group nc=1 done cd $ROOTDIR # /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 mpirun -p4pg pr_group -v ./build_cpl/mitgcmuv > std_outp 2>&1 tail -20 std_outp ls -l rank_?/pickup*.ckptA.001.001.data fi if test $kpr = 4 then if test -f rank_1/STDOUT.0000 then echo '==> check Ocean output:' /home/jmc/bin/comp_res rank_1/STDOUT.0000 results/ocnSTDOUT.0000 mv -f comp_res.log comp_res.ocn echo ' ' else echo 'No Ocean output file in rank_1' ; fi if test -f rank_2/STDOUT.0000 then echo '==> check Atmos output:' /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 mv -f comp_res.log comp_res.atm echo '==> check Land output:' /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L mv -f comp_res.log comp_res.land echo '==> check thSIce output:' /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I mv -f comp_res.log comp_res.sice echo ' ' else echo 'No Atmos output file in rank_1' ; fi fi exit 0