3 |
# A script for running a single Diderot benchmark test |
# A script for running a single Diderot benchmark test |
4 |
# |
# |
5 |
# usage: |
# usage: |
6 |
# scripts/run-one.sh test [diderotc] [diderotc-flags] [-- runtime-flags] |
# scripts/run-one.sh bmark nruns nprocs [diderotc-flags] [-- runtime-flags] |
7 |
|
# where |
8 |
|
# bmark name of benchmark |
9 |
|
# nruns number of runs per benchmark version |
10 |
|
# nprocs number of processors for parallel version (0 means no parallel run) |
11 |
# |
# |
12 |
# @configure_input@ |
# @configure_input@ |
13 |
# |
# |
14 |
|
|
15 |
function usage { |
function usage { |
16 |
echo "usage:" |
echo "usage:" |
17 |
echo " scripts/run-one.sh test [diderotc] [diderotc-flags] [-- runtime-flags]" |
echo " scripts/run-one.sh bmark nruns nprocs [diderotc-flags] [-- runtime-flags]" |
18 |
exit $1 |
exit $1 |
19 |
} |
} |
20 |
|
|
25 |
echo "run script from benchmarks directory" |
echo "run script from benchmarks directory" |
26 |
exit 1 |
exit 1 |
27 |
fi |
fi |
28 |
|
|
29 |
|
# get the name of the benchmark, number of runs, and max number of processors |
30 |
|
# |
31 |
|
if (( $# >= 3 )) ; then |
32 |
|
BMARK=$1; shift |
33 |
|
NRUNS=$1; shift |
34 |
|
MAXNP=$1; shift |
35 |
|
if [ ! -d programs/$BMARK ] ; then |
36 |
|
echo "$BMARK is not a valid benchmark name" |
37 |
|
exit 1 |
38 |
|
fi |
39 |
|
else |
40 |
|
usage 1 |
41 |
|
fi |
42 |
|
|
43 |
|
# process the rest of the command-line arguments |
44 |
|
# |
45 |
|
DIDEROTC_FLAGS="" |
46 |
|
RUNTIME_FLAGS="" |
47 |
|
# get diderotc flags |
48 |
|
while [ $# -ne 0 ] ; do |
49 |
|
case $1 in |
50 |
|
--) shift; break ;; # switch modes |
51 |
|
-*) DIDEROTC_FLAGS="$DIDEROTC_FLAGS $1" ;; |
52 |
|
*) echo "unrecognized argument" |
53 |
|
usage 1 |
54 |
|
;; |
55 |
|
esac |
56 |
|
shift |
57 |
|
done |
58 |
|
# get runtime flags |
59 |
|
while [ $# -ne 0 ] ; do |
60 |
|
case $1 in |
61 |
|
-*) RUNTIME_FLAGS="$RUNTIME_FLAGS $1" ;; |
62 |
|
*) echo "unrecognized argument" |
63 |
|
usage 1 |
64 |
|
;; |
65 |
|
esac |
66 |
|
shift |
67 |
|
done |
68 |
|
|
69 |
|
DATE=$( date +"%F-%H-%M-%S" ) |
70 |
|
LOG=$HERE/$BMARK-log.$DATE |
71 |
|
REPORT=$HERE/$BMARK-report.$DATE |
72 |
|
|
73 |
|
# compile the benchmark |
74 |
|
# |
75 |
|
cd programs/$BMARK |
76 |
|
if [ ! -f Makefile ] ; then |
77 |
|
echo "no Makefile for $BMARK; run configure to generate" |
78 |
|
exit 1 |
79 |
|
fi |
80 |
|
echo "********** $BMARK **********" > $LOG |
81 |
|
# clean an old executables |
82 |
|
make clean 2>> $LOG 1>> $LOG |
83 |
|
# rebuild using the given DIDEROTC_FLAGS |
84 |
|
if [ x"$DIDEROTC_FLAGS" != x ] ; then |
85 |
|
make DIDEROTC_FLAGS="\""$DIDEROTC_FLAGS"\"" 2>> $LOG 1>> $LOG |
86 |
|
else |
87 |
|
make 2>> $LOG 1>> $LOG |
88 |
|
fi |
89 |
|
if [ "$?" -eq "0" ] ; then |
90 |
|
echo "# bmark: $BMARK" > $REPORT |
91 |
|
echo "# nruns: $NRUNS" >> $REPORT |
92 |
|
echo "# nprocs: $MAXNP" >> $REPORT |
93 |
|
echo "# date: $DATE" >> $REPORT |
94 |
|
if [ x"$DIDEROTC_FLAGS" != x ] ; then |
95 |
|
echo "# DIDEROTC_FLAGS: $DIDEROTC_FLAGS" >> $REPORT |
96 |
|
fi |
97 |
|
if [ x"$RUNTIME_FLAGS" != x ] ; then |
98 |
|
echo "# RUNTIME_FLAGS: $RUNTIME_FLAGS" >> $REPORT |
99 |
|
fi |
100 |
|
echo "# $BMARK-teem:" >> $REPORT |
101 |
|
print -n "bmark-teem " |
102 |
|
for ((i=0; $i < $NRUNS; i++)) ; do |
103 |
|
print -n "." |
104 |
|
./bmark-teem >> $REPORT |
105 |
|
done |
106 |
|
echo "# $BMARK-seq:" >> $REPORT |
107 |
|
print -n "\nbmark-seq " |
108 |
|
for ((i=0; $i < $NRUNS; i++)) ; do |
109 |
|
print -n "." |
110 |
|
./bmark-seq -timing >> $REPORT |
111 |
|
done |
112 |
|
for ((np=1; $np <= $MAXNP; np++)) ; do |
113 |
|
print -n "\nbmark-par-$np " |
114 |
|
echo "# $BMARK-par-$np:" >> $REPORT |
115 |
|
for ((i=0; $i < $NRUNS; i++)) ; do |
116 |
|
print -n "." |
117 |
|
./bmark-par -timing -np $np >> $REPORT |
118 |
|
done |
119 |
|
done |
120 |
|
print "" |
121 |
|
else |
122 |
|
echo "build failed" >> $REPORT |
123 |
|
echo "build of $BMARK failed" |
124 |
|
fi |