--- MITgcm/verification/testreport 2011/12/22 12:55:05 1.170 +++ MITgcm/verification/testreport 2012/06/26 22:30:54 1.173 @@ -1,6 +1,6 @@ #! /usr/bin/env bash # -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.170 2011/12/22 12:55:05 mlosch Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.173 2012/06/26 22:30:54 jmc Exp $ # $Name: $ # @@ -443,7 +443,7 @@ find . -name "fort.*" -exec rm {} \; find . -type l -exec rm {} \; #- should remove executable only if sym-link (alredy done above) - rm -f $RUNLOG *.txt STD* *diagnostics.log datetime + rm -f $RUNLOG *.txt STD* w2_tile_topology.????.log *diagnostics.log datetime rm -rf mnc_test_* rm -f *_MIT_CE_000.opt0000 costfunction*0000 echo successful @@ -492,7 +492,11 @@ cd $1; if test -r Makefile ; then printf 'make ... ' - $MAKE $TARG >> make.tr_log 2>&1 + if test "x$REPLMAKE" = x ; then + $MAKE $TARG >> make.tr_log 2>&1 + else + $REPLMAKE $TARG >> make.tr_log 2>&1 + fi RETVAL=$? if test "x$RETVAL" != x0 ; then tail make.tr_log @@ -522,31 +526,54 @@ mk_mpi_size() { - # mk_mpi_size input_file output_file proc_Nb prefer_to_split_X + # mk_mpi_size input_file output_file proc_Nb threads_Nb_X threads_Nb_Y # - # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file) + # make new SIZE.h (=output_file) from SIZE.h_mpi (=input_file) # for an MPI build with no more than proc_Nb processors ; - # return the effective number of processors. + # ensure that enough tiles per proc (nSx,nSy) remain for the given + # number of threads (nTx,nTy) ; + # return the effective number of processors. inp=$1 out=$2 np=$3 - dirX=$4 + tx=$4 + ty=$5 tmp=TTT.$$ + # dirX : select with direction to favor in MPI process repartition + # dirX=1 : prefer to put more proc in X direction + # dirX=0 : prefer to put more proc in Y direction + dirX=0 + px=`grep "^ & *nPx *=" $inp | sed "s/^ & *nPx *= *//" | sed 's/, *$//'` py=`grep "^ & *nPy *=" $inp | sed "s/^ & *nPy *= *//" | sed 's/, *$//'` sx=`grep "^ & *nSx *=" $inp | sed "s/^ & *nSx *= *//" | sed 's/, *$//'` sy=`grep "^ & *nSy *=" $inp | sed "s/^ & *nSy *= *//" | sed 's/, *$//'` + #- for each direction, assume # of threads is a multiple of total number of tiles + nx=$px + if [ `expr $sx % $tx` -ne 0 -a `expr $sx \* $px % $tx` -eq 0 ] ; then + nx=`expr $sx \* $px / $tx` + if [ $verbose -gt 1 ]; then + echo " change px from $px to $nx to accommodate $tx threads" + fi + fi + ny=$py + if [ `expr $sy % $ty` -ne 0 -a `expr $sy \* $py % $ty` -eq 0 ] ; then + ny=`expr $sy \* $py / $ty` + if [ $verbose -gt 1 ]; then + echo " change py from $py to $ny to accommodate $ty threads" + fi + fi #- find the largest divisor of input_file proc Nb, but not larger than $np pp=0 i=1 - while [ $i -le $px ] ; do - if [ `expr $px % $i` -eq 0 ] ; then + while [ $i -le $nx ] ; do + if [ `expr $nx % $i` -eq 0 ] ; then j=1 - while [ $j -le $py ] ; do - if [ `expr $py % $j` -eq 0 ] ; then + while [ $j -le $ny ] ; do + if [ `expr $ny % $j` -eq 0 ] ; then ij=`expr $i \* $j` if [ $ij -gt $pp ] ; then flag=1 @@ -926,10 +953,6 @@ verbose=1 NBLINES_MKLOG=16000 -IEEE=true -if test "x$MITGCM_IEEE" != x ; then - IEEE=$MITGCM_IEEE -fi OptLev=1 GSL=f @@ -955,6 +978,7 @@ if test "x$MAKE" = x ; then MAKE=make fi +REPLMAKE= if test "x$CC" = x ; then CC=cc fi @@ -1019,6 +1043,9 @@ -make | --make | -m | --m) ac_prev=MAKE ;; -make=* | --make=* | -m=* | --m=*) MAKE=$ac_optarg ;; + -repl_mk | --repl_mk ) ac_prev=REPLMAKE ;; + -repl_mk=* | --repl_mk=*) REPLMAKE=$ac_optarg ;; + -odir | --odir) ac_prev=OUTDIR ;; -odir=* | --odir=*) OUTDIR=$ac_optarg ;; @@ -1380,13 +1407,14 @@ fi if test "x$MPI" != "x0" ; then - prefer_X=0 + ntx=1 ; nty=1 if test "x$MULTI_THREAD" = "xt" ; then - retv=`check_eedata $dir"/input/eedata.mth"` - if test $retv = 1 ; then prefer_X=1 ; fi + ff=$dir"/input/eedata.mth" + ntx=`grep "^ *nTx *=" $ff | tail -1 | sed 's/^ *nTx *= *//' | sed "s/, *$//"` + nty=`grep "^ *nTy *=" $ff | tail -1 | sed 's/^ *nTy *= *//' | sed "s/, *$//"` fi #- create new SIZE.h with no more than '$MPI' Procs - mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $prefer_X + mk_mpi_size $CODE_DIR"/SIZE.h_mpi" $BUILD_DIR"/tr_size.mpi" $MPI $ntx $nty LOC_NPROC=$? ( cd $BUILD_DIR if test -r SIZE.h.mpi ; then