#!/bin/ksh # # A script for running a single Diderot benchmark test # # usage: # scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags] # where # bmark name of benchmark # nruns number of runs per benchmark version # nprocs max number of processors for parallel version (0 means no parallel run) # nworkers max number of workers/CU for GPU version (0 means no GPU run) # # @configure_input@ # function usage { echo "usage:" echo " scripts/run-one.sh bmark nruns nprocs nworkers [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 (( $# >= 4 )) ; then BMARK=$1; shift NRUNS=$1; shift MAXNP=$1; shift MAXNW=$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 if [ $# -gt 0 ] ; then RUNTIME_FLAGS="$*" else RUNTIME_FLAGS="" fi HOSTNAME=$( hostname -s ) 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 "# host: $HOSTNAME" >> $REPORT echo "# nruns: $NRUNS" >> $REPORT echo "# nprocs: $MAXNP" >> $REPORT echo "# nworkers: $MAXNW" >> $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 for ((nw=1; $nw <= $MAXNW; nw++)) ; do print -n "\nbmark-cl-$nw " echo "# $BMARK-cl-$nw:" >> $REPORT for ((i=0; $i < $NRUNS; i++)) ; do print -n "." ./bmark-cl -timing -np $nw >> $REPORT done done print "" else echo "build failed" >> $REPORT echo "build of $BMARK failed" fi