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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3056, Thu Mar 12 21:27:11 2015 UTC revision 3057, Fri Mar 13 02:15:46 2015 UTC
# Line 1  Line 1 
1  #!/bin/ksh  #!/bin/ksh
2  #  #
3  # A script for running a single Diderot benchmark test  # A script for running a single Diderot benchmark test.  The results are output to a
4    # JSON file named <bmark>-report.<date>-<time>.  There is also a log file produced
5    # that contains the build messages.
6  #  #
7  # usage:  # usage:
8  #       scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags]  #       scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags]
# Line 13  Line 15 
15  # @configure_input@  # @configure_input@
16  #  #
17    
 function usage {  
   echo "usage:"  
   echo "  scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags]"  
   exit 1  
 }  
   
18  # this script should be run from the rtest directory  # this script should be run from the rtest directory
19  #  #
20  HERE=$(pwd)  HERE=$(pwd)
# Line 27  Line 23 
23    exit 1    exit 1
24  fi  fi
25    
26    # flags to enable/disable the running of specific benchmarks
27    #
28    if [ x"@TARGET_TEEM@" = x ] ; then
29      ENABLE_TEEM=no
30    else
31      ENABLE_TEEM=yes
32    fi
33    if [ x"@TARGET_SEQ@" = x ] ; then
34      ENABLE_SEQ=no
35    else
36      ENABLE_SEQ=yes
37    fi
38    if [ x"@TARGET_PAR@" = x ] ; then
39      ENABLE_PAR=no
40    else
41      ENABLE_PAR=yes
42    fi
43    if [ x"@TARGET_CL@" = x ] ; then
44      ENABLE_CL=no
45    else
46      ENABLE_CL=yes
47    fi
48    if [ x"@TARGET_CUDA@" = x ] ; then
49      ENABLE_CUDA=no
50    else
51      ENABLE_CUDA=yes
52    fi
53    
54    function usage {
55      echo "usage:"
56      echo "  scripts/run-one.sh bmark nruns nprocs nworkers [diderotc-flags] [-- runtime-flags]"
57      exit 1
58    }
59    
60  # get the name of the benchmark, number of runs, and max number of processors  # get the name of the benchmark, number of runs, and max number of processors
61  #  #
62  if (( $# >= 4 )) ; then  if (( $# >= 4 )) ; then
# Line 65  Line 95 
95  fi  fi
96    
97  HOSTNAME=$( hostname -s )  HOSTNAME=$( hostname -s )
98  DATE=$( date +"%F-%H-%M-%S" )  DATE=$( date +"%F" )
99  LOG=$HERE/$BMARK-log.$DATE  TIME=$( date +"%H-%M-%S" )
100  REPORT=$HERE/$BMARK-report.$DATE  LOG=$HERE/$BMARK-log.$DATE-$TIME
101    REPORT=$HERE/$BMARK-report.$DATE-$TIME
102    DIDEROTC_VERSION=$(@DIDEROTC@ --version)
103    
104  # compile the benchmark  # compile the benchmark
105  #  #
# Line 80  Line 112 
112  # clean out old executables  # clean out old executables
113  make clean 2>> $LOG 1>> $LOG  make clean 2>> $LOG 1>> $LOG
114  # customize build targets  # customize build targets
115  TARGETS="bmark-teem bmark-seq"  TARGETS="@TARGET_TEEM@ @TARGET_SEQ@"
116    if [ $ENABLE_PAR = yes ] ; then
117  if (($MAXNP > 0)) ; then  if (($MAXNP > 0)) ; then
118    TARGETS="$TARGETS bmark-par"    TARGETS="$TARGETS bmark-par"
119  fi  fi
120    fi
121  if (($MAXNW > 0)) ; then  if (($MAXNW > 0)) ; then
122      if [ $ENABLE_CL = yes ] ; then
123    TARGETS="$TARGETS bmark-cl"    TARGETS="$TARGETS bmark-cl"
124  fi  fi
125      if [ $ENABLE_CUDA = yes ] ; then
126        TARGETS="$TARGETS bmark-cuda"
127      fi
128    fi
129    #
130  # rebuild $TARGETS using the given DIDEROTC_FLAGS  # rebuild $TARGETS using the given DIDEROTC_FLAGS
131    #
132  if [ x"$DIDEROTC_FLAGS" != x ] ; then  if [ x"$DIDEROTC_FLAGS" != x ] ; then
133    make DIDEROTC_FLAGS="$DIDEROTC_FLAGS" $TARGETS 2>> $LOG 1>> $LOG    make DIDEROTC_FLAGS="$DIDEROTC_FLAGS" $TARGETS 2>> $LOG 1>> $LOG
134  else  else
135    make $TARGETS 2>> $LOG 1>> $LOG    make $TARGETS 2>> $LOG 1>> $LOG
136  fi  fi
137  if [ "$?" -eq "0" ] ; then  if [ "$?" -eq "0" ] ; then
138    echo "# bmark: $BMARK" > $REPORT  #
139    echo "# host: $HOSTNAME" >> $REPORT  # JSON header
140    echo "# nruns: $NRUNS" >> $REPORT  #
141    echo "# nprocs: $MAXNP" >> $REPORT    cat - > $REPORT <<XXXX
142    echo "# nworkers: $MAXNW" >> $REPORT  {
143    echo "# date: $DATE" >> $REPORT    "bmark" : "$BMARK",
144    if [ x"$DIDEROTC_FLAGS" != x ] ; then    "host" : "$HOSTNAME",
145      echo "# DIDEROTC_FLAGS: $DIDEROTC_FLAGS" >> $REPORT    "version" : "$DIDEROTC_VERSION",
146    fi    "nruns" : $NRUNS,
147    if [ x"$RUNTIME_FLAGS" != x ] ; then    "max-nprocs" : $MAXNP,
148      echo "# RUNTIME_FLAGS: $RUNTIME_FLAGS" >> $REPORT    "max-nworkers" : $MAXNP,
149    fi    "date" : "$DATE",
150    echo "# $BMARK-teem:" >> $REPORT    "time" : "$TIME",
151      "diderotc-flags" : "$DIDEROTC_FLAGS",
152      "runtime-flags" : "$RUNTIME_FLAGS",
153      "results" : [
154    XXXX
155      #
156      # run teem version of benchmark
157      #
158      if [ $ENABLE_TEEM = yes ] ; then
159        echo "      {" >> $REPORT
160        echo "        \"name\" : \"teem\"," >> $REPORT
161        echo "        \"nprocs\" : 1," >> $REPORT
162        echo "        \"times\" : [" >> $REPORT
163    print -n "bmark-teem "    print -n "bmark-teem "
164    for ((i=0; $i < $NRUNS;  i++)) ; do      for ((i=1; $i <= $NRUNS;  i++)) ; do
165      print -n "."      print -n "."
166      ./bmark-teem >> $REPORT        RESULT=$( ./bmark-teem | sed -e s/usr=// )
167          if (($i == $NRUNS)) ; then
168            echo "            $RESULT" >> $REPORT
169          else
170            echo "            $RESULT," >> $REPORT
171          fi
172    done    done
173    echo "# $BMARK-seq:" >> $REPORT      echo "          ]" >> $REPORT
174        if [ $ENABLE_SEQ = yes -o $ENABLE_PAR = yes -o $ENABLE_CL -o $ENABLE_CUDA = yes ] ; then
175          echo "      }," >> $REPORT
176        else
177          echo "      }" >> $REPORT
178        fi
179      fi
180      #
181      # run sequential Diderot version of benchmark
182      #
183      if [ $ENABLE_SEQ = yes ] ; then
184        echo "      {" >> $REPORT
185        echo "        \"name\" : \"seq\"," >> $REPORT
186        echo "        \"nprocs\" : 1," >> $REPORT
187        echo "        \"times\" : [" >> $REPORT
188    print -n "\nbmark-seq "    print -n "\nbmark-seq "
189    for ((i=0; $i < $NRUNS;  i++)) ; do      for ((i=1; $i <= $NRUNS;  i++)) ; do
190      print -n "."      print -n "."
191      ./bmark-seq -timing >> $REPORT        RESULT=$( ./bmark-seq -t | sed -e s/usr=// )
192          if (($i == $NRUNS)) ; then
193            echo "            $RESULT" >> $REPORT
194          else
195            echo "            $RESULT," >> $REPORT
196          fi
197    done    done
198        echo "          ]" >> $REPORT
199        if [ $ENABLE_PAR = yes -o $ENABLE_CL = yes -o $ENABLE_CUDA = yes ] ; then
200          echo "      }," >> $REPORT
201        else
202          echo "      }" >> $REPORT
203        fi
204      fi
205      #
206      # run parallel Diderot version of benchmark
207      #
208      if [ $ENABLE_PAR = yes ] ; then
209    for ((np=1; $np <= $MAXNP;  np++)) ; do    for ((np=1; $np <= $MAXNP;  np++)) ; do
210      print -n "\nbmark-par-$np "      print -n "\nbmark-par-$np "
211      echo "# $BMARK-par-$np:" >> $REPORT        echo "      {" >> $REPORT
212      for ((i=0; $i < $NRUNS;  i++)) ; do        echo "        \"name\" : \"par-$np\"," >> $REPORT
213          echo "        \"nprocs\" : $np," >> $REPORT
214          echo "        \"times\" : [" >> $REPORT
215          for ((i=1; $i <= $NRUNS;  i++)) ; do
216        print -n "."        print -n "."
217        ./bmark-par -timing -np $np >> $REPORT          RESULT=$( ./bmark-par -t -n $np | sed -e s/usr=// )
218            if (($i == $NRUNS)) ; then
219              echo "            $RESULT" >> $REPORT
220            else
221              echo "            $RESULT," >> $REPORT
222            fi
223      done      done
224          echo "          ]" >> $REPORT
225          if (($np < $MAXNP)) ; then
226            echo "      }," >> $REPORT
227          elif [ $ENABLE_CL = yes -o $ENABLE_CUDA = yes ] ; then
228            echo "!      }," >> $REPORT
229          else
230            echo "      }" >> $REPORT
231          fi
232    done    done
233      fi
234      #
235      # run OpenCL Diderot version of benchmark
236      #
237      if [ $ENABLE_CL = yes ] ; then
238    for ((nw=1; $nw <= $MAXNW;  nw++)) ; do    for ((nw=1; $nw <= $MAXNW;  nw++)) ; do
239      print -n "\nbmark-cl-$nw "      print -n "\nbmark-cl-$nw "
240      echo "# $BMARK-cl-$nw:" >> $REPORT        echo "      {" >> $REPORT
241      for ((i=0; $i < $NRUNS;  i++)) ; do        echo "        \"name\" : \"cl-$nw\"," >> $REPORT
242          echo "        \"nprocs\" : $cl," >> $REPORT
243          echo "        \"times\" : [" >> $REPORT
244          for ((i=1; $i <= $NRUNS;  i++)) ; do
245            print -n "."
246            RESULT=$( ./bmark-cl -t -n $np | sed -e s/usr=// )
247            if (($i == $NRUNS)) ; then
248              echo "            $RESULT" >> $REPORT
249            else
250              echo "            $RESULT," >> $REPORT
251            fi
252          done
253          echo "          ]" >> $REPORT
254          if (($np < $MAXNW)) ; then
255            echo "      }," >> $REPORT
256          elif [ $ENABLE_CUDA = yes ] ; then
257            echo "      }," >> $REPORT
258          else
259            echo "      }" >> $REPORT
260          fi
261        done
262      fi
263      #
264      # run CUDA Diderot version of benchmark
265      #
266      if [ $ENABLE_CUDA = yes ] ; then
267        for ((nw=1; $nw <= $MAXNW;  nw++)) ; do
268          print -n "\nbmark-cuda-$nw "
269          echo "      {" >> $REPORT
270          echo "        \"name\" : \"cl-$nw\"," >> $REPORT
271          echo "        \"nprocs\" : $cl," >> $REPORT
272          echo "        \"times\" : [" >> $REPORT
273          for ((i=1; $i <= $NRUNS;  i++)) ; do
274        print -n "."        print -n "."
275        ./bmark-cl -timing -np $nw >> $REPORT          RESULT=$( ./bmark-cuda -t -n $np | sed -e s/usr=// )
276            if (($i == $NRUNS)) ; then
277              echo "            $RESULT" >> $REPORT
278            else
279              echo "            $RESULT," >> $REPORT
280            fi
281      done      done
282          echo "          ]" >> $REPORT
283          if (($np < $MAXNW)) ; then
284            echo "      }," >> $REPORT
285          else
286            echo "      }" >> $REPORT
287          fi
288    done    done
289      fi
290    print ""    print ""
291      COMPLETED_AT=$( date +"%H-%M-%S" )
292      cat - >> $REPORT <<XXXX
293        ],
294      "completed-at" : "$COMPLETED_AT"
295    }
296    XXXX
297  else  else
298    echo "build failed" >> $REPORT    echo "build failed" >> $REPORT
299    echo "build of $BMARK failed"    echo "build of $BMARK failed"

Legend:
Removed from v.3056  
changed lines
  Added in v.3057

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