#! /bin/sh # $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/cpl_aim+ocn/Attic/run_cpl_test_itrda,v 1.7 2006/07/17 01:34:23 jmc Exp $ # $Name: $ Np=3 if [ $# -lt 1 ] then echo 'Usage:'`basename $0`' step ' echo ' => test coupled set-up on myrinet cluster' 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 on $Np processor" echo 'step = 4 : check the results' echo 'step = 5 : remove output files in rank_0,1,2 dir.' exit fi kpr=$1 dir=`pwd` #- only works from a 3 nodes PBS bach session ( qsub -I -l nodes=3 ) # on ACES cluster (tested on itrda). # need to be on one computer node, # and with the correct module loaded (i.e, one of the 3): # > module load mpich/gnu # > module load mpich/intel # > module load mpich/pgi 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 #============================================================================ if test $kpr = 0 then rm -f genmake_optfile pr_group std_outp 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 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 #- find the optfile that corresponds to the currently loaded mpich module . /etc/profile.d/modules.sh module list -t >& tmp_compiler compiler=`sed -n 's/mpich\///p' tmp_compiler` case $compiler in 'gnu') cp -p ../../tools/build_options/linux_ia32_g77+mpi_itrda genmake_optfile ;; 'intel') cp -p ../../tools/build_options/linux_ia32_ifc+mpi_itrda genmake_optfile ;; 'pgi') cp -p ../../tools/build_options/linux_ia32_pgf77+mpi_itrda genmake_optfile ;; *) echo 'ERROR: cannot use compiler:' $compiler ; echo ""; cat tmp_compiler ; exit 7 ;; esac rm -f tmp_compiler echo " Using" $compiler "compiler:" #--- 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 -j 2 > 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 -j 2 > 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 -j 2 > 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.$$ echo $PBS_NODEFILE list=`cat $PBS_NODEFILE` rm -f pr_group ; touch pr_group nc=0 ; dd1=cpl ; for xx in $list do echo $xx $nc $dir/build_$dd1/mitgcmuv >> pr_group if test $nc = 0 ; then dd1=ocn ; else dd1=atm ; fi 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 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 echo '==> check Land output:' /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 L echo '==> check thSIce output:' /home/jmc/bin/comp_res rank_2/STDOUT.0000 results/atmSTDOUT.0000 I echo ' ' else echo 'No Atmos output file in rank_1' ; fi fi exit 0