Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /benchmarks/scripts/run-one_sh.in
ViewVC logotype

View of /benchmarks/scripts/run-one_sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1575 - (download) (annotate)
Sat Oct 29 16:50:18 2011 UTC (7 years, 8 months ago) by jhr
File size: 2918 byte(s)
  Adding scripting support to run benchmarks
#!/bin/ksh
#
# A script for running a single Diderot benchmark test
#
# usage:
#	scripts/run-one.sh bmark nruns nprocs [diderotc-flags] [-- runtime-flags]
# where
#       bmark   name of benchmark
#       nruns   number of runs per benchmark version
#       nprocs  number of processors for parallel version (0 means no parallel run)
#
# @configure_input@
#

function usage {
  echo "usage:"
  echo "  scripts/run-one.sh bmark nruns nprocs [diderotc-flags] [-- runtime-flags]"
  exit $1
}

# this script should be run from the rtest directory
#
HERE=$(pwd)
if [ ! -d $HERE/programs ] ; then
  echo "run script from benchmarks directory"
  exit 1
fi

# get the name of the benchmark, number of runs, and max number of processors
#
if (( $# >= 3 )) ; then
  BMARK=$1; shift
  NRUNS=$1; shift
  MAXNP=$1; shift
  if [ ! -d programs/$BMARK ] ; then
    echo "$BMARK is not a valid benchmark name"
    exit 1
  fi
else
  usage 1
fi

# process the rest of the command-line arguments
#
DIDEROTC_FLAGS=""
RUNTIME_FLAGS=""
# get diderotc flags
while [ $# -ne 0 ] ; do
  case $1 in
    --) shift; break ;; # switch modes
    -*) DIDEROTC_FLAGS="$DIDEROTC_FLAGS $1" ;;
    *) echo "unrecognized argument"
      usage 1
    ;;
  esac
  shift
done
# get runtime flags
while [ $# -ne 0 ] ; do
  case $1 in
    -*) RUNTIME_FLAGS="$RUNTIME_FLAGS $1" ;;
    *) echo "unrecognized argument"
      usage 1
    ;;
  esac
  shift
done

DATE=$( date +"%F-%H-%M-%S" )
LOG=$HERE/$BMARK-log.$DATE
REPORT=$HERE/$BMARK-report.$DATE

# compile the benchmark
#
cd programs/$BMARK
if [ ! -f Makefile ] ; then
  echo "no Makefile for $BMARK; run configure to generate"
  exit 1
fi
echo "********** $BMARK **********" > $LOG
# clean an old executables
make clean 2>> $LOG 1>> $LOG
# rebuild using the given DIDEROTC_FLAGS
if [ x"$DIDEROTC_FLAGS" != x ] ; then
  make DIDEROTC_FLAGS="\""$DIDEROTC_FLAGS"\"" 2>> $LOG 1>> $LOG
else
  make 2>> $LOG 1>> $LOG
fi
if [ "$?" -eq "0" ] ; then
  echo "# bmark: $BMARK" > $REPORT
  echo "# nruns: $NRUNS" >> $REPORT
  echo "# nprocs: $MAXNP" >> $REPORT
  echo "# date: $DATE" >> $REPORT
  if [ x"$DIDEROTC_FLAGS" != x ] ; then
    echo "# DIDEROTC_FLAGS: $DIDEROTC_FLAGS" >> $REPORT
  fi
  if [ x"$RUNTIME_FLAGS" != x ] ; then
    echo "# RUNTIME_FLAGS: $RUNTIME_FLAGS" >> $REPORT
  fi
  echo "# $BMARK-teem:" >> $REPORT
  print -n "bmark-teem "
  for ((i=0; $i < $NRUNS;  i++)) ; do
    print -n "."
    ./bmark-teem >> $REPORT
  done
  echo "# $BMARK-seq:" >> $REPORT
  print -n "\nbmark-seq "
  for ((i=0; $i < $NRUNS;  i++)) ; do
    print -n "."
    ./bmark-seq -timing >> $REPORT
  done
  for ((np=1; $np <= $MAXNP;  np++)) ; do
    print -n "\nbmark-par-$np "
    echo "# $BMARK-par-$np:" >> $REPORT
    for ((i=0; $i < $NRUNS;  i++)) ; do
      print -n "."
      ./bmark-par -timing -np $np >> $REPORT
    done
  done
  print ""
else
  echo "build failed" >> $REPORT
  echo "build of $BMARK failed"
fi

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0