Skip to content

Commit

Permalink
Add performance section to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
kylelutz committed Sep 22, 2014
1 parent 0b0cbd3 commit f3f1c39
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# build directory
build/

# python compiled files
*.pyc

# vim temp files
.*.sw*

Expand Down
1 change: 1 addition & 0 deletions doc/compute.qbk
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
[include porting_guide.qbk]
[include platforms_and_compilers.qbk]
[include reference.qbk]
[include performance.qbk]
[include faq.qbk]
46 changes: 46 additions & 0 deletions doc/performance.qbk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
[section:performance Performance]

The following tests were run with an AMD HD 7970 "Tahiti" GPU on a system
with an Intel i7-4771 3.50GHz CPU.

Source code for the benchmarks can be found under the
[@https://github.com/kylelutz/compute/tree/master/perf perf] directory. All
benchmarks were compiled with optimizations enabled (i.e. "gcc -O3").

[h3 Accumulate]
[$images/perf/accumulate_time_plot.png [width 850px] [align center]]

[h3 Count]
[$images/perf/count_time_plot.png [width 850px] [align center]]

[h3 Inner Product]
[$images/perf/inner_product_time_plot.png [width 850px] [align center]]

[h3 Merge]
[$images/perf/merge_time_plot.png [width 850px] [align center]]

[h3 Partial Sum]
[$images/perf/partial_sum_time_plot.png [width 850px] [align center]]

[h3 Partition]
[$images/perf/partition_time_plot.png [width 850px] [align center]]

[h3 Reverse]
[$images/perf/reverse_time_plot.png [width 850px] [align center]]

[h3 Rotate]
[$images/perf/rotate_time_plot.png [width 850px] [align center]]

[h3 Set Difference]
[$images/perf/set_difference_time_plot.png [width 850px] [align center]]

[h3 Sort]
[$images/perf/sort_time_plot.png [width 850px] [align center]]

[h3 Transform]
[$images/perf/saxpy_time_plot.png [width 850px] [align center]]

[h3 Unique]
[$images/perf/unique_time_plot.png [width 850px] [align center]]

[endsect] [/ performance]
4 changes: 2 additions & 2 deletions perf/perf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import os
import sys
import random
import subprocess

try:
Expand Down Expand Up @@ -132,14 +131,15 @@ def run_benchmark(name, sizes, vs=[]):
"is_permutation",
"merge",
"next_permutation",
"nth_element"
"nth_element",
"partial_sum",
"partition",
"partition_point",
"prev_permutation",
"reverse",
"rotate",
"rotate_copy",
"saxpy",
"search",
"search_n",
"set_difference",
Expand Down
62 changes: 62 additions & 0 deletions perf/perfdoc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/python

import os
import sys
import pylab

from perf import run_benchmark

fignum = 0

def plot_to_file(report, filename):
global fignum
fignum += 1
pylab.figure(fignum)

run_to_label = {
"stl" : "C++ STL",
"compute" : "Boost.Compute"
}

for run in report.samples.keys():
x = []
y = []

for sample in report.samples[run]:
x.append(sample[0])
y.append(sample[1])

pylab.plot(x, y, marker='o', label=run_to_label[run])

pylab.xlabel("Size")
pylab.ylabel("Time (ms)")
pylab.legend(loc='upper left')
pylab.savefig(filename)

if __name__ == '__main__':
sizes = [pow(2, x) for x in range(10, 26)]
algorithms = [
"accumulate",
"count",
"inner_product",
"merge",
"partial_sum",
"partition",
"reverse",
"rotate",
"saxpy",
"set_difference",
"sort",
"unique",
]

try:
os.mkdir("perf_plots")
except OSError:
pass

for algorithm in algorithms:
print "running '%s'" % (algorithm)
report = run_benchmark(algorithm, sizes, ["stl"])
plot_to_file(report, "perf_plots/%s_time_plot.png" % algorithm)

0 comments on commit f3f1c39

Please sign in to comment.