summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks/benchmarks/bench_app.py10
-rw-r--r--benchmarks/benchmarks/bench_indexing.py5
-rw-r--r--benchmarks/benchmarks/bench_linalg.py1
-rw-r--r--benchmarks/benchmarks/common.py19
-rwxr-xr-xruntests.py15
5 files changed, 31 insertions, 19 deletions
diff --git a/benchmarks/benchmarks/bench_app.py b/benchmarks/benchmarks/bench_app.py
index 85aefe9d3..0e2aca64b 100644
--- a/benchmarks/benchmarks/bench_app.py
+++ b/benchmarks/benchmarks/bench_app.py
@@ -18,7 +18,9 @@ class LaplaceInplace(Benchmark):
dy2 = (dy * dy)
def num_update(u, dx2, dy2):
- u[1:(-1), 1:(-1)] = ((((u[2:, 1:(-1)] + u[:(-2), 1:(-1)]) * dy2) + ((u[1:(-1), 2:] + u[1:(-1), :(-2)]) * dx2)) / (2 * (dx2 + dy2)))
+ u[1:(-1), 1:(-1)] = ((((u[2:, 1:(-1)] + u[:(-2), 1:(-1)]) * dy2) +
+ ((u[1:(-1), 2:] + u[1:(-1), :(-2)]) * dx2))
+ / (2 * (dx2 + dy2)))
def num_inplace(u, dx2, dy2):
tmp = u[:(-2), 1:(-1)].copy()
@@ -28,7 +30,8 @@ class LaplaceInplace(Benchmark):
np.add(tmp2, u[1:(-1), :(-2)], out=tmp2)
np.multiply(tmp2, dx2, out=tmp2)
np.add(tmp, tmp2, out=tmp)
- np.multiply(tmp, (1.0 / (2.0 * (dx2 + dy2))), out=u[1:(-1), 1:(-1)])
+ np.multiply(tmp, (1.0 / (2.0 * (dx2 + dy2))),
+ out=u[1:(-1), 1:(-1)])
def laplace(N, Niter=100, func=num_update, args=()):
u = np.zeros([N, N], order='C')
@@ -55,7 +58,8 @@ class MaxesOfDots(Benchmark):
nfeat = 100
ntime = 200
- self.arrays = [np.random.normal(size=(ntime, nfeat)) for i in xrange(nsubj)]
+ self.arrays = [np.random.normal(size=(ntime, nfeat))
+ for i in xrange(nsubj)]
def maxes_of_dots(self, arrays):
"""
diff --git a/benchmarks/benchmarks/bench_indexing.py b/benchmarks/benchmarks/bench_indexing.py
index 98024e991..4f2482ef8 100644
--- a/benchmarks/benchmarks/bench_indexing.py
+++ b/benchmarks/benchmarks/bench_indexing.py
@@ -23,9 +23,10 @@ class Indexing(Benchmark):
'indexes_rand_': indexes_rand_}
if sys.version_info[0] >= 3:
- code = "def run():\n for a in squares_.values(): a[%s]%s" % (sel, op)
+ code = "def run():\n for a in squares_.values(): a[%s]%s"
else:
- code = "def run():\n for a in squares_.itervalues(): a[%s]%s" % (sel, op)
+ code = "def run():\n for a in squares_.itervalues(): a[%s]%s"
+ code = code % (sel, op)
six.exec_(code, ns)
self.func = ns['run']
diff --git a/benchmarks/benchmarks/bench_linalg.py b/benchmarks/benchmarks/bench_linalg.py
index eecea632d..c844cc79e 100644
--- a/benchmarks/benchmarks/bench_linalg.py
+++ b/benchmarks/benchmarks/bench_linalg.py
@@ -4,6 +4,7 @@ from .common import Benchmark, squares_, indexes_rand
import numpy as np
+
class Eindot(Benchmark):
def setup(self):
self.a = np.arange(60000.0).reshape(150, 400)
diff --git a/benchmarks/benchmarks/common.py b/benchmarks/benchmarks/common.py
index 9c5073c6c..c99b0afb8 100644
--- a/benchmarks/benchmarks/common.py
+++ b/benchmarks/benchmarks/common.py
@@ -16,19 +16,20 @@ nxs, nys = 100, 100
# a set of interesting types to test
TYPES1 = [
- 'int16', 'float16',
- 'int32', 'float32',
- 'int64', 'float64', 'complex64',
- 'longfloat', 'complex128',
- 'complex256',
- ]
+ 'int16', 'float16',
+ 'int32', 'float32',
+ 'int64', 'float64', 'complex64',
+ 'longfloat', 'complex128',
+ 'complex256',
+]
# values which will be used to construct our sample data matrices
# replicate 10 times to speed up initial imports of this helper
# and generate some redundancy
values = [random.uniform(0, 100) for x in range(nx*ny/10)]*10
-squares = {t: numpy.array(values, dtype=getattr(numpy, t)).reshape((nx, ny))
+squares = {t: numpy.array(values,
+ dtype=getattr(numpy, t)).reshape((nx, ny))
for t in TYPES1}
# adjust complex ones to have non-degenerated imagery part -- use
@@ -38,9 +39,9 @@ for t, v in squares.iteritems():
v += v.T*1j
# smaller squares
-squares_ = {t: s[:nxs, :nys] for t, s in squares.iteritems()}
+squares_ = {t: s[:nxs, :nys] for t, s in squares.iteritems()}
# vectors
-vectors = {t: s[0] for t, s in squares.iteritems()}
+vectors = {t: s[0] for t, s in squares.iteritems()}
indexes = range(nx)
# so we do not have all items
diff --git a/runtests.py b/runtests.py
index 44468933b..d7ee0c3cd 100755
--- a/runtests.py
+++ b/runtests.py
@@ -127,7 +127,8 @@ def main(argv):
gcov_reset_counters()
if args.debug and args.bench:
- print("*** Benchmarks should not be run against debug version; remove -g flag ***")
+ print("*** Benchmarks should not be run against debug "
+ "version; remove -g flag ***")
if not args.no_build:
site_dir = build_project(args)
@@ -210,19 +211,23 @@ def main(argv):
# Check for uncommitted files
if commit_b == 'HEAD':
- r1 = subprocess.call(['git', 'diff-index', '--quiet', '--cached', 'HEAD'])
+ r1 = subprocess.call(['git', 'diff-index', '--quiet',
+ '--cached', 'HEAD'])
r2 = subprocess.call(['git', 'diff-files', '--quiet'])
if r1 != 0 or r2 != 0:
print("*"*80)
- print("WARNING: you have uncommitted changes --- these will NOT be benchmarked!")
+ print("WARNING: you have uncommitted changes --- "
+ "these will NOT be benchmarked!")
print("*"*80)
# Fix commit ids (HEAD is local to current repo)
- p = subprocess.Popen(['git', 'rev-parse', commit_b], stdout=subprocess.PIPE)
+ p = subprocess.Popen(['git', 'rev-parse', commit_b],
+ stdout=subprocess.PIPE)
out, err = p.communicate()
commit_b = out.strip()
- p = subprocess.Popen(['git', 'rev-parse', commit_a], stdout=subprocess.PIPE)
+ p = subprocess.Popen(['git', 'rev-parse', commit_a],
+ stdout=subprocess.PIPE)
out, err = p.communicate()
commit_a = out.strip()