--- MITgcm/verification/testreport 2011/08/03 18:34:31 1.165 +++ 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.165 2011/08/03 18:34:31 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/verification/testreport,v 1.173 2012/06/26 22:30:54 jmc Exp $ # $Name: $ # @@ -251,8 +251,9 @@ then echo testoutput_run: testoutput_var $1 cg2d_init_res 1>&2 ; fi testoutput_var $1 "cg2d_init_res" "Press. Solver (cg2d)" $2 $3; yy=$? if [ $debug -gt 0 ] ; then echo testoutput_run: cg2dres=$yy 1>&2 ; fi ;; - 'Cost') testoutput_var $1 "ADM precision_derivative_cost" "ADM Cost" $2 $3; yy=$? ;; - 'Grad') testoutput_var $1 "ADM precision_derivative_grad" "ADM Grad" $2 $3; yy=$? ;; + 'Cost') testoutput_var $1 "ADM ref_cost_function" "ADM CostFct" $2 $3; yy=$? ;; + 'AdGrd') testoutput_var $1 "ADM adjoint_gradient" "ADM Ad Grad" $2 $3; yy=$? ;; + 'FDGrd') testoutput_var $1 "ADM finite-diff_grad" "ADM FD Grad" $2 $3; yy=$? ;; 'Tmn') testoutput_var $1 "dynstat_theta_min" "Theta minimum" $2 $3; yy=$? ;; 'Tmx') testoutput_var $1 "dynstat_theta_max" "Theta maximum" $2 $3; yy=$? ;; 'Tav') testoutput_var $1 "dynstat_theta_mean" "Theta mean" $2 $3; yy=$? ;; @@ -289,6 +290,14 @@ 'hSImx') testoutput_var $1 "seaice_heff_max" "SIce Heff max" $2 $3; yy=$? ;; 'hSIav') testoutput_var $1 "seaice_heff_mean" "SIce Heff mean" $2 $3; yy=$? ;; 'hSIsd') testoutput_var $1 "seaice_heff_sd" "SIce Heff StDv" $2 $3; yy=$? ;; + 'uSImn') testoutput_var $1 "seaice_uice_min" "SIce Uice min" $2 $3; yy=$? ;; + 'uSImx') testoutput_var $1 "seaice_uice_max" "SIce Uice max" $2 $3; yy=$? ;; + 'uSIav') testoutput_var $1 "seaice_uice_mean" "SIce Uice mean" $2 $3; yy=$? ;; + 'uSIsd') testoutput_var $1 "seaice_uice_sd" "SIce Uice StDv" $2 $3; yy=$? ;; + 'vSImn') testoutput_var $1 "seaice_vice_min" "SIce Vice min" $2 $3; yy=$? ;; + 'vSImx') testoutput_var $1 "seaice_vice_max" "SIce Vice max" $2 $3; yy=$? ;; + 'vSIav') testoutput_var $1 "seaice_vice_mean" "SIce Vice mean" $2 $3; yy=$? ;; + 'vSIsd') testoutput_var $1 "seaice_vice_sd" "SIce Vice StDv" $2 $3; yy=$? ;; 'AthSiG') testoutput_var $1 "thSI_Ice_Area_G" "thSIc Area Global" $2 $3; yy=$? ;; 'AthSiS') testoutput_var $1 "thSI_Ice_Area_S" "thSIc Area South" $2 $3; yy=$? ;; 'AthSiN') testoutput_var $1 "thSI_Ice_Area_N" "thSIc Area North" $2 $3; yy=$? ;; @@ -434,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 @@ -483,16 +492,10 @@ cd $1; if test -r Makefile ; then printf 'make ... ' - if test "x$ADM" = xt ; then - $MAKE adall >> make.tr_log 2>&1 - elif test "x$OADM" = xt ; then - $MAKE adAll >> make.tr_log 2>&1 - else - if test "x$JOBS" = x ; then - $MAKE $TARG >> make.tr_log 2>&1 - else - $MAKE -j $JOBS $TARG >> make.tr_log 2>&1 - fi + 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 @@ -523,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 @@ -927,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 @@ -956,6 +978,7 @@ if test "x$MAKE" = x ; then MAKE=make fi +REPLMAKE= if test "x$CC" = x ; then CC=cc fi @@ -1020,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 ;; @@ -1114,16 +1140,19 @@ #- setting for forward or ADM testing if test "x$ADM" = xt ; then + if test "x$TARG" = xobj ; then TARG=adobj ; else TARG=adall ; fi code_dir=code_ad inputdir=input_ad ref_outp="output_adm.txt" EXECUTABLE="mitgcmuv_ad" elif test "x$OADM" = xt ; then + TARG=adAll code_dir=code_oad inputdir=input_oad ref_outp="output_oadm.txt" EXECUTABLE="mitgcmuv_ad" else + if test "x$JOBS" != x ; then TARG="-j $JOBS $TARG" ; fi code_dir=code inputdir=input ref_outp="output.txt" @@ -1202,8 +1231,8 @@ ii=`echo $EMPTY_RESULTS | awk '{print NF}'` EMPTY_RESULTS=$EMPTY_RESULTS`expr $LEN_CHECK_LIST - $ii | awk 'BEGIN{FS=":"}{for(i=1;i<=$1;i++){printf " ."}}'` else - DEF_CHECK_LIST='Grad Cost Grad' - EMPTY_RESULTS='.. ..' + DEF_CHECK_LIST='AdGrd Cost AdGrd FDGrd' + EMPTY_RESULTS='.. .. ..' LEN_CHECK_LIST=`echo $DEF_CHECK_LIST | sed 's/ [a-zA-Z0-9]*+/&mn &mx &av &sd/g' | awk '{print NF-1}'` fi @@ -1289,8 +1318,8 @@ else line_0="default "$MATCH_CRIT ; fi line_0="$line_0 ----T----- ----S----- ----U----- ----V-----" line_1="G D M c m s m s m s m s" - line_2="E p a R g m m e . m m e . m m e . m m e ." - line_3="N n k u 2 i a a d i a a d i a a d i a a d" + line_2="e p a R g m m e . m m e . m m e . m m e ." + line_3="n n k u 2 i a a d i a a d i a a d i a a d" line_4="2 d e n d n x n . n x n . n x n . n x n ." for ii in $PTRACERS_NUM ; do line_0="$line_0 --PTR 0"$ii"--" @@ -1313,10 +1342,10 @@ else line_0="default "$MATCH_CRIT ; fi echo "$line_0" | tee -a $SUMMARY cat << EOF | tee -a $SUMMARY -G D M C G -E p a R o r -N n k u s a -2 d e n t d +G D M C A F +e p a R o d D +n n k u s G G +2 d e n t r r EOF fi @@ -1378,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 @@ -1546,8 +1576,9 @@ if test "x$RETVAL" = x0 ; then echo "from '$gmkLog', extract compiler version:" >> $DRESULTS/genmake_state sed -n '/Get compiler version/,/<-- compiler version/p' $gmkLog \ - | grep -v '^... compiler version ' > tr_1.tmp_log - sed -n '1,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ + | grep -v '^... compiler version ' > tr_1.tmp_log + sed -n '1p' tr_1.tmp_log >> $DRESULTS/genmake_state + sed -n '2,/^$/p' tr_1.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ >> $DRESULTS/genmake_state rm -f tr_1.tmp_log fi