--- MITgcm/tools/do_tst_2+2 2009/02/27 22:58:57 1.3 +++ MITgcm/tools/do_tst_2+2 2011/01/15 19:16:32 1.8 @@ -1,6 +1,6 @@ #! /usr/bin/env bash -# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/do_tst_2+2,v 1.3 2009/02/27 22:58:57 jmc Exp $ +# $Header: /home/ubuntu/mnt/e9_copy/MITgcm/tools/do_tst_2+2,v 1.8 2011/01/15 19:16:32 jmc Exp $ # $Name: $ usage() @@ -27,9 +27,10 @@ TESTDIRS= SKIPDIRS= SCRIPT='../tools/tst_2+2' +scrArg='All' COMMAND= mpi=0 -OUTDIR=`hostname` +OUTDIR=`hostname | sed 's/\..*$//'` SAVELOG=0 ADDRESS= MPACK="../tools/mpack-1.6/mpack" @@ -144,6 +145,19 @@ for xx in $LIST do echo ============================================================================== + if [ $mpi -ge 1 ] ; then + NP_MPI=2 + mpi_size=$xx/build/SIZE.h.mpi + if test -f $mpi_size ; then + px=`grep '^ & *nPx *=' $mpi_size | sed 's/^ & *nPx *= *//' | sed 's/, *$//'` + py=`grep '^ & *nPy *=' $mpi_size | sed 's/^ & *nPy *= *//' | sed 's/, *$//'` + pp=`expr $px \* $py` > /dev/null 2>&1 ; out=$? + if test "x$out" = x0 ; then NP_MPI=$pp ; fi + fi + rCommand=`echo $COMMAND | sed "s/-np * XX /-np $NP_MPI /"` + else + rCommand=$COMMAND + fi listD='run '`(cd $xx/results ; ls output.*.txt 2> /dev/null | sed 's/^output\./tr_run./g' | sed 's/\.txt$//g' )` for yy in $listD do @@ -151,8 +165,20 @@ if test "x$OPTFILE" = x -a -f $xx/build/Makefile ; then comm=`grep '^# OPTFILE=' $xx/build/Makefile 2>/dev/null | head -1 | sed 's/^# //'` echo "from '$xx/build/Makefile', extract:" > $DRESULTS/genmake_state - echo $comm >> $DRESULTS/genmake_state + sed -n '/^# executed by:/,+1 p' $xx/build/Makefile >> $DRESULTS/genmake_state + echo " $comm" >> $DRESULTS/genmake_state eval $comm + gmkLog=$xx/build/genmake.log + grep '^Get compiler version using:' $gmkLog > /dev/null 2>&1 + out=$? + if test "x$out" = 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_vers.tmp_log + sed -n '1,/^$/p' tr_vers.tmp_log | sed '/^$/d' | sed 's/^./ &/' \ + >> $DRESULTS/genmake_state + rm -f tr_vers.tmp_log + fi fi if test $yy = 'run' ; then nam=$xx else nam=$xx`echo $yy | sed 's/tr_run//'` ; fi @@ -160,13 +186,13 @@ cd $xx/$yy pwd > outp.tst_2+2.log if test "x$COMMAND" = x ; then - echo $SCRIPT All >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log - $SCRIPT All >> outp.tst_2+2.log 2>&1 + echo $SCRIPT $scrArg >> outp.tst_2+2.log ; echo ' ' >> outp.tst_2+2.log + $SCRIPT $scrArg >> outp.tst_2+2.log 2>&1 out=$? else - echo "$SCRIPT All -command \"$COMMAND\"" >> outp.tst_2+2.log + echo "$SCRIPT $scrArg -command \"$rCommand\"" >> outp.tst_2+2.log echo ' ' >> outp.tst_2+2.log - $SCRIPT All -command "$COMMAND" >> outp.tst_2+2.log 2>&1 + $SCRIPT $scrArg -command "$rCommand" >> outp.tst_2+2.log 2>&1 out=$? fi case $out in