aboutsummaryrefslogtreecommitdiff
path: root/src/falsesharing.py
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2019-02-02 14:56:51 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2019-02-02 17:43:19 +0100
commitddbaf12a94fd43481fc9dd3b98920fc784ebada3 (patch)
treecb21131aee570800275c530a78333f7714b6f12c /src/falsesharing.py
parent8c12b0494aa241bb6ddf3779a99d2f5d6ededf73 (diff)
downloadallocbench-ddbaf12a94fd43481fc9dd3b98920fc784ebada3.tar.gz
allocbench-ddbaf12a94fd43481fc9dd3b98920fc784ebada3.zip
fix some flake8 linting errors
Diffstat (limited to 'src/falsesharing.py')
-rw-r--r--src/falsesharing.py41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/falsesharing.py b/src/falsesharing.py
index 6c4ddc0..79de436 100644
--- a/src/falsesharing.py
+++ b/src/falsesharing.py
@@ -1,26 +1,26 @@
import matplotlib.pyplot as plt
import multiprocessing
import numpy as np
-import os
import re
from src.benchmark import Benchmark
time_re = re.compile("^Time elapsed = (?P<time>\d*\.\d*) seconds.$")
-class Benchmark_Falsesharing( Benchmark ):
+
+class Benchmark_Falsesharing(Benchmark):
def __init__(self):
self.name = "falsesharing"
self.descrition = """This benchmarks makes small allocations and writes
- to them multiple times. If the allocated objects are
- on the same cache line the writes will be expensive because
- of cache thrashing."""
+ to them multiple times. If the allocated objects
+ are on the same cache line the writes will be
+ expensive because of cache thrashing."""
self.cmd = "cache-{bench}{binary_suffix} {threads} 100 8 1000000"
self.args = {
- "bench" : ["thrash", "scratch"],
- "threads" : range(1, multiprocessing.cpu_count() * 2 + 1)
+ "bench": ["thrash", "scratch"],
+ "threads": range(1, multiprocessing.cpu_count() * 2 + 1)
}
self.requirements = ["cache-thrash", "cache-scratch"]
@@ -41,34 +41,35 @@ class Benchmark_Falsesharing( Benchmark ):
single_threaded_perm = self.Perm(bench=bench, threads=1)
single_threaded = np.mean([float(m["time"])
- for m in self.results[target][single_threaded_perm]])
+ for m in self.results[target][single_threaded_perm]])
- for perm in self.iterate_args_fixed({"bench" : bench}, args=args):
+ for perm in self.iterate_args_fixed({"bench": bench}, args=args):
d = [float(m["time"]) for m in self.results[target][perm]]
y_vals.append(single_threaded / np.mean(d))
- plt.plot(nthreads, y_vals, marker='.', linestyle='-', label=target,
- color=targets[target]["color"])
+ plt.plot(nthreads, y_vals, marker='.', linestyle='-',
+ label=target, color=targets[target]["color"])
plt.legend()
plt.xlabel("threads")
plt.ylabel("speedup")
- plt.title(bench + " speedup" )
+ plt.title(bench + " speedup")
plt.savefig(self.name + "." + bench + ".png")
plt.clf()
self.plot_fixed_arg("({L1-dcache-load-misses}/{L1-dcache-loads})*100",
- ylabel="'l1 cache misses in %'",
- title = "'cache misses: ' + arg + ' ' + str(arg_value)",
- filepostfix = "l1-misses",
- fixed=["bench"])
+ ylabel="'l1 cache misses in %'",
+ title="'cache misses: ' + arg + ' ' + str(arg_value)",
+ filepostfix="l1-misses",
+ fixed=["bench"])
self.plot_fixed_arg("({LLC-load-misses}/{LLC-loads})*100",
- ylabel="'l1 cache misses in %'",
- title = "'LLC misses: ' + arg + ' ' + str(arg_value)",
- filepostfix = "llc-misses",
- fixed=["bench"])
+ ylabel="'l1 cache misses in %'",
+ title="'LLC misses: ' + arg + ' ' + str(arg_value)",
+ filepostfix="llc-misses",
+ fixed=["bench"])
+
falsesharing = Benchmark_Falsesharing()