#! /bin/sh # $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/cpl_aim+ocn/run_cpl_test,v 1.14 2009/12/26 23:44:03 jmc Exp $ # $Name: $ Np=3 #- parse options: MTH= MTHo= MTHa= if test $1 = '-mth' ; then MTH='-omp' ; shift if test -f input_ocn/eedata.mth ; then MTHo=$MTH ; fi if test -f input_atm/eedata.mth ; then MTHa=$MTH ; fi fi if [ $# -ne 1 ] then echo 'Usage:'`basename $0`' [opt] step' echo ' => test coupled set-up on linux box (1.cpu)' echo 'opt = -mth : compile and run (if eedata.mth) 2-threads for ocn & atm' 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 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 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 OPTFILE=`ls ../linux_*+mpi` zz=`grep '^FC=' $OPTFILE` echo " Using optfile: $OPTFILE (compiler=$zz) $MTH" else echo 'Pb in finding optfile' ; exit; fi zz=`echo $OPTFILE | grep -c '^\/'` if test $zz = 0 ; then OPTFILE="../$OPTFILE" ; fi #--- echo '==== compile coupler:' cd build_cpl echo ' --- genmake2 (cpl):' ../../../tools/genmake2 -of $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 $OPTFILE -mpi $MTHo -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 $OPTFILE -mpi $MTHa -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 if test "x$MTHo" != x ; then echo " MTH run: mv -f eedata.mth eedata" mv -f eedata.mth eedata fi cd $dir echo 'CP dir:' input_atm '->' rank_2 cp -p -r input_atm rank_2 cd rank_2 ./prepare_run if test "x$MTHa" != x ; then echo " MTH run: mv -f eedata.mth eedata" mv -f eedata.mth eedata fi 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 if test "x$MTH" != x ; then export OMP_NUM_THREADS=2 ; export KMP_STACKSIZE=400m if test "x$MTHo" != x ; then echo -n " run OCN ($MTHo) with $OMP_NUM_THREADS threads ;" fi if test "x$MTHa" != x ; then echo -n " run ATM ($MTHa) with $OMP_NUM_THREADS threads ;" fi echo "" fi # /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_2' ; fi fi exit 0