SCM Repository
Annotation of /benchmarks/scripts/run-one_sh.in
Parent Directory
|
Revision Log
Revision 3052 - (view) (download)
1 : | jhr | 1538 | #!/bin/ksh |
2 : | # | ||
3 : | # A script for running a single Diderot benchmark test | ||
4 : | # | ||
5 : | # usage: | ||
6 : | jhr | 1656 | # scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags] |
7 : | jhr | 1575 | # where |
8 : | jhr | 1656 | # bmark name of benchmark |
9 : | # nruns number of runs per benchmark version | ||
10 : | # nprocs max number of processors for parallel version (0 means no parallel run) | ||
11 : | # nworkers max number of workers/CU for GPU version (0 means no GPU run) | ||
12 : | jhr | 1538 | # |
13 : | # @configure_input@ | ||
14 : | # | ||
15 : | |||
16 : | function usage { | ||
17 : | echo "usage:" | ||
18 : | jhr | 1656 | echo " scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags]" |
19 : | exit 1 | ||
20 : | jhr | 1538 | } |
21 : | |||
22 : | # this script should be run from the rtest directory | ||
23 : | # | ||
24 : | HERE=$(pwd) | ||
25 : | if [ ! -d $HERE/programs ] ; then | ||
26 : | echo "run script from benchmarks directory" | ||
27 : | exit 1 | ||
28 : | fi | ||
29 : | jhr | 1575 | |
30 : | # get the name of the benchmark, number of runs, and max number of processors | ||
31 : | # | ||
32 : | jhr | 1656 | if (( $# >= 4 )) ; then |
33 : | jhr | 1575 | BMARK=$1; shift |
34 : | NRUNS=$1; shift | ||
35 : | MAXNP=$1; shift | ||
36 : | jhr | 1656 | MAXNW=$1; shift |
37 : | jhr | 1575 | if [ ! -d programs/$BMARK ] ; then |
38 : | echo "$BMARK is not a valid benchmark name" | ||
39 : | exit 1 | ||
40 : | fi | ||
41 : | else | ||
42 : | usage 1 | ||
43 : | fi | ||
44 : | |||
45 : | # process the rest of the command-line arguments | ||
46 : | # | ||
47 : | DIDEROTC_FLAGS="" | ||
48 : | RUNTIME_FLAGS="" | ||
49 : | # get diderotc flags | ||
50 : | while [ $# -ne 0 ] ; do | ||
51 : | case $1 in | ||
52 : | --) shift; break ;; # switch modes | ||
53 : | -*) DIDEROTC_FLAGS="$DIDEROTC_FLAGS $1" ;; | ||
54 : | *) echo "unrecognized argument" | ||
55 : | usage 1 | ||
56 : | ;; | ||
57 : | esac | ||
58 : | shift | ||
59 : | done | ||
60 : | # get runtime flags | ||
61 : | jhr | 1657 | if [ $# -gt 0 ] ; then |
62 : | jhr | 1656 | RUNTIME_FLAGS="$*" |
63 : | else | ||
64 : | RUNTIME_FLAGS="" | ||
65 : | fi | ||
66 : | jhr | 1575 | |
67 : | jhr | 1576 | HOSTNAME=$( hostname -s ) |
68 : | jhr | 1575 | DATE=$( date +"%F-%H-%M-%S" ) |
69 : | LOG=$HERE/$BMARK-log.$DATE | ||
70 : | REPORT=$HERE/$BMARK-report.$DATE | ||
71 : | |||
72 : | # compile the benchmark | ||
73 : | # | ||
74 : | cd programs/$BMARK | ||
75 : | if [ ! -f Makefile ] ; then | ||
76 : | echo "no Makefile for $BMARK; run configure to generate" | ||
77 : | exit 1 | ||
78 : | fi | ||
79 : | echo "********** $BMARK **********" > $LOG | ||
80 : | jhr | 3052 | # clean out old executables |
81 : | jhr | 1575 | make clean 2>> $LOG 1>> $LOG |
82 : | jhr | 1909 | # customize build targets |
83 : | TARGETS="bmark-teem bmark-seq" | ||
84 : | if (($MAXNP > 0)) ; then | ||
85 : | TARGETS="$TARGETS bmark-par" | ||
86 : | fi | ||
87 : | if (($MAXNW > 0)) ; then | ||
88 : | TARGETS="$TARGETS bmark-cl" | ||
89 : | fi | ||
90 : | # rebuild $TARGETS using the given DIDEROTC_FLAGS | ||
91 : | jhr | 1575 | if [ x"$DIDEROTC_FLAGS" != x ] ; then |
92 : | jhr | 1909 | make DIDEROTC_FLAGS="$DIDEROTC_FLAGS" $TARGETS 2>> $LOG 1>> $LOG |
93 : | jhr | 1575 | else |
94 : | jhr | 1909 | make $TARGETS 2>> $LOG 1>> $LOG |
95 : | jhr | 1575 | fi |
96 : | if [ "$?" -eq "0" ] ; then | ||
97 : | echo "# bmark: $BMARK" > $REPORT | ||
98 : | jhr | 1576 | echo "# host: $HOSTNAME" >> $REPORT |
99 : | jhr | 1575 | echo "# nruns: $NRUNS" >> $REPORT |
100 : | echo "# nprocs: $MAXNP" >> $REPORT | ||
101 : | jhr | 1656 | echo "# nworkers: $MAXNW" >> $REPORT |
102 : | jhr | 1575 | echo "# date: $DATE" >> $REPORT |
103 : | if [ x"$DIDEROTC_FLAGS" != x ] ; then | ||
104 : | echo "# DIDEROTC_FLAGS: $DIDEROTC_FLAGS" >> $REPORT | ||
105 : | fi | ||
106 : | if [ x"$RUNTIME_FLAGS" != x ] ; then | ||
107 : | echo "# RUNTIME_FLAGS: $RUNTIME_FLAGS" >> $REPORT | ||
108 : | fi | ||
109 : | echo "# $BMARK-teem:" >> $REPORT | ||
110 : | print -n "bmark-teem " | ||
111 : | for ((i=0; $i < $NRUNS; i++)) ; do | ||
112 : | print -n "." | ||
113 : | ./bmark-teem >> $REPORT | ||
114 : | done | ||
115 : | echo "# $BMARK-seq:" >> $REPORT | ||
116 : | print -n "\nbmark-seq " | ||
117 : | for ((i=0; $i < $NRUNS; i++)) ; do | ||
118 : | print -n "." | ||
119 : | ./bmark-seq -timing >> $REPORT | ||
120 : | done | ||
121 : | for ((np=1; $np <= $MAXNP; np++)) ; do | ||
122 : | print -n "\nbmark-par-$np " | ||
123 : | echo "# $BMARK-par-$np:" >> $REPORT | ||
124 : | for ((i=0; $i < $NRUNS; i++)) ; do | ||
125 : | print -n "." | ||
126 : | ./bmark-par -timing -np $np >> $REPORT | ||
127 : | done | ||
128 : | done | ||
129 : | jhr | 1656 | for ((nw=1; $nw <= $MAXNW; nw++)) ; do |
130 : | print -n "\nbmark-cl-$nw " | ||
131 : | echo "# $BMARK-cl-$nw:" >> $REPORT | ||
132 : | for ((i=0; $i < $NRUNS; i++)) ; do | ||
133 : | print -n "." | ||
134 : | ./bmark-cl -timing -np $nw >> $REPORT | ||
135 : | done | ||
136 : | done | ||
137 : | jhr | 1575 | print "" |
138 : | else | ||
139 : | echo "build failed" >> $REPORT | ||
140 : | echo "build of $BMARK failed" | ||
141 : | fi |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |