diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-07-13 11:59:13 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-07-13 11:59:13 +0200 |
| commit | f017841a59b7aca49f8cdc9fe8cb70ab146bd6c5 (patch) | |
| tree | 780081380b69b3caca1782b016c2aabeb88f3560 | |
| parent | 933b54f05d7dd3fb103664fbffc374998b76b2ae (diff) | |
| download | allocbench-f017841a59b7aca49f8cdc9fe8cb70ab146bd6c5.tar.gz allocbench-f017841a59b7aca49f8cdc9fe8cb70ab146bd6c5.zip | |
[bennchmarks] import ploting modules only in summarize function scope
This hopefully speeds up startup time for benchmark runs and does not
require benchmark systems to have summary module like scipy or matplotlib
installed.
| -rw-r--r-- | allocbench/benchmarks/blowup.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/cfrac.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/dj_trace.py | 6 | ||||
| -rw-r--r-- | allocbench/benchmarks/espresso.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/falsesharing.py | 3 | ||||
| -rw-r--r-- | allocbench/benchmarks/fd.py | 3 | ||||
| -rw-r--r-- | allocbench/benchmarks/httpd.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/keydb.py | 3 | ||||
| -rw-r--r-- | allocbench/benchmarks/larson.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/lld.py | 8 | ||||
| -rw-r--r-- | allocbench/benchmarks/loop.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/mysql.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/raxmlng.py | 3 | ||||
| -rw-r--r-- | allocbench/benchmarks/rdtsc.py | 8 | ||||
| -rw-r--r-- | allocbench/benchmarks/realloc.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/redis.py | 4 | ||||
| -rw-r--r-- | allocbench/benchmarks/t_test1.py | 4 |
17 files changed, 51 insertions, 23 deletions
diff --git a/allocbench/benchmarks/blowup.py b/allocbench/benchmarks/blowup.py index 8f61421..474ad6a 100644 --- a/allocbench/benchmarks/blowup.py +++ b/allocbench/benchmarks/blowup.py @@ -17,7 +17,6 @@ """Definition of the blowup micro benchmark""" from allocbench.benchmark import Benchmark -import allocbench.plots as plt class BenchmarkBlowup(Benchmark): @@ -40,6 +39,9 @@ class BenchmarkBlowup(Benchmark): super().__init__(name) def summary(self): + """Create plots showing the needed VmHWM compared to the ideal one""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # hack ideal rss in data set allocators = self.results["allocators"] allocators["Ideal-RSS"] = {"color": "xkcd:gold"} diff --git a/allocbench/benchmarks/cfrac.py b/allocbench/benchmarks/cfrac.py index f1a4408..e6a2caf 100644 --- a/allocbench/benchmarks/cfrac.py +++ b/allocbench/benchmarks/cfrac.py @@ -59,7 +59,6 @@ API function as well as memory placement strategies with good data locality. """ from allocbench.benchmark import Benchmark -import allocbench.plots as plt class BenchmarkCfrac(Benchmark): @@ -75,6 +74,9 @@ class BenchmarkCfrac(Benchmark): super().__init__(name) def summary(self): + """Create plots showing the needed execution times and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # Speed plt.plot(self, "{task-clock}/1000", diff --git a/allocbench/benchmarks/dj_trace.py b/allocbench/benchmarks/dj_trace.py index da822d7..6820ca7 100644 --- a/allocbench/benchmarks/dj_trace.py +++ b/allocbench/benchmarks/dj_trace.py @@ -17,13 +17,11 @@ """Benchmark definition using the traces collected by DJ Delorie""" import re -import matplotlib.pyplot as plt import numpy as np from allocbench.artifact import ArchiveArtifact from allocbench.benchmark import Benchmark import allocbench.plots as abplt -from allocbench.plots import SUMMARY_FILE_EXT COMMA_SEP_NUMBER_RE = "(?:\\d*(?:,\\d*)?)*" RSS_RE = f"(?P<rss>{COMMA_SEP_NUMBER_RE})" @@ -170,6 +168,10 @@ class BenchmarkDJTrace(Benchmark): def summary(self): """Create time, rss usage plots and a plain text summary like the one from DJ Delorie""" + + import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel + from allocbench.plots import SUMMARY_FILE_EXT # pylint: disable=import-outside-toplevel + args = self.results["args"] allocators = self.results["allocators"] diff --git a/allocbench/benchmarks/espresso.py b/allocbench/benchmarks/espresso.py index 8ce4256..4ed87f5 100644 --- a/allocbench/benchmarks/espresso.py +++ b/allocbench/benchmarks/espresso.py @@ -59,7 +59,6 @@ import os from allocbench.benchmark import Benchmark from allocbench.directories import get_allocbench_benchmark_src_dir -import allocbench.plots as plt class BenchmarkEspresso(Benchmark): @@ -75,6 +74,9 @@ class BenchmarkEspresso(Benchmark): super().__init__(name) def summary(self): + """Create plots showing the execution time, VmHWM as well as L1 data cache miss rate""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # Speed plt.plot(self, "{task-clock}/1000", diff --git a/allocbench/benchmarks/falsesharing.py b/allocbench/benchmarks/falsesharing.py index ef15939..309c17d 100644 --- a/allocbench/benchmarks/falsesharing.py +++ b/allocbench/benchmarks/falsesharing.py @@ -19,7 +19,6 @@ import re from allocbench.benchmark import Benchmark -import allocbench.plots as plt TIME_RE = re.compile("^Time elapsed = (?P<time>\\d*\\.\\d*) seconds.$") @@ -49,6 +48,8 @@ class BenchmarkFalsesharing(Benchmark): result["time"] = TIME_RE.match(stdout).group("time") def summary(self): + """Create plots showing the speedup and L1 data cache miss rate""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel args = self.results["args"] allocators = self.results["allocators"] diff --git a/allocbench/benchmarks/fd.py b/allocbench/benchmarks/fd.py index 4d61319..85c520e 100644 --- a/allocbench/benchmarks/fd.py +++ b/allocbench/benchmarks/fd.py @@ -20,7 +20,6 @@ import os from allocbench.artifact import ArchiveArtifact, GitArtifact from allocbench.benchmark import Benchmark -import allocbench.plots as plt LINUX_VERSION = 'v5.3' FD_VERSION = 'v7.4.0' @@ -63,6 +62,8 @@ class BenchmarkFd(Benchmark): os.link(src, dest) def summary(self): + """Create plots showing execution time and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel plt.plot(self, "{task-clock}", plot_type='bar', diff --git a/allocbench/benchmarks/httpd.py b/allocbench/benchmarks/httpd.py index 08b8652..8ce7002 100644 --- a/allocbench/benchmarks/httpd.py +++ b/allocbench/benchmarks/httpd.py @@ -20,7 +20,6 @@ import re from allocbench.benchmark import Benchmark import allocbench.facter as facter -import allocbench.plots as plt class BenchmarkHTTPD(Benchmark): @@ -60,6 +59,9 @@ class BenchmarkHTTPD(Benchmark): "Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1) def summary(self): + """Create plots shwoing requests and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + plt.plot(self, "{requests}", fig_options={ diff --git a/allocbench/benchmarks/keydb.py b/allocbench/benchmarks/keydb.py index 7fde805..4aa9914 100644 --- a/allocbench/benchmarks/keydb.py +++ b/allocbench/benchmarks/keydb.py @@ -24,7 +24,6 @@ import os from allocbench.artifact import GitArtifact from allocbench.benchmark import Benchmark -import allocbench.plots as plt from allocbench.util import run_cmd KEYDB_VERSION = "v5.3.1" @@ -113,6 +112,8 @@ class BenchmarkKeyDB(Benchmark): os.remove("dump.rdb") def summary(self): + """Create plots shwowing operation count and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel plt.plot(self, "{totals_ops}", fig_options={ diff --git a/allocbench/benchmarks/larson.py b/allocbench/benchmarks/larson.py index 0d25126..2b7bfc8 100644 --- a/allocbench/benchmarks/larson.py +++ b/allocbench/benchmarks/larson.py @@ -48,7 +48,6 @@ false sharing because it uses multiple threads, which pass memory around. import re from allocbench.benchmark import Benchmark -import allocbench.plots as plt THROUGHPUT_RE = re.compile( "^Throughput =\\s*(?P<throughput>\\d+) operations per second.$") @@ -80,6 +79,9 @@ class BenchmarkLarson(Benchmark): return def summary(self): + """Create plots showing throughput and L1 data chache miss rate""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # Plot threads->throughput and maxsize->throughput plt.plot(self, "{throughput}/1000000", diff --git a/allocbench/benchmarks/lld.py b/allocbench/benchmarks/lld.py index 93cd36e..d71e911 100644 --- a/allocbench/benchmarks/lld.py +++ b/allocbench/benchmarks/lld.py @@ -201,13 +201,9 @@ So data locality and scalability should be the most important factor for those w import os -import matplotlib.pyplot as plt - from allocbench.artifact import ArchiveArtifact from allocbench.benchmark import Benchmark import allocbench.facter as facter -import allocbench.plots -from allocbench.plots import SUMMARY_FILE_EXT class BenchmarkLld(Benchmark): @@ -259,6 +255,10 @@ class BenchmarkLld(Benchmark): def summary(self): """Create time and memory usage plots""" + import allocbench.plots # pylint: disable=import-outside-toplevel + import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel + from allocbench.plots import SUMMARY_FILE_EXT # pylint: disable=import-outside-toplevel + args = self.results["args"] allocators = self.results["allocators"] diff --git a/allocbench/benchmarks/loop.py b/allocbench/benchmarks/loop.py index ae7d36b..bbfbb52 100644 --- a/allocbench/benchmarks/loop.py +++ b/allocbench/benchmarks/loop.py @@ -35,7 +35,6 @@ Interpretation: """ from allocbench.benchmark import Benchmark -import allocbench.plots as plt class BenchmarkLoop(Benchmark): @@ -61,6 +60,9 @@ class BenchmarkLoop(Benchmark): result["mops"] = perm.threads / float(result["task-clock"]) def summary(self): + """Create plots showing MOPS and l1 data cache misses""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # Speed plt.plot(self, "{mops}", diff --git a/allocbench/benchmarks/mysql.py b/allocbench/benchmarks/mysql.py index 72b1c8d..bf6d100 100644 --- a/allocbench/benchmarks/mysql.py +++ b/allocbench/benchmarks/mysql.py @@ -82,7 +82,6 @@ import numpy as np from allocbench.benchmark import Benchmark import allocbench.facter as facter -import allocbench.plots as plt from allocbench.util import print_status, print_debug, print_info2, print_warn, run_cmd MYSQL_USER = "root" @@ -197,6 +196,9 @@ class BenchmarkMYSQL(Benchmark): result["max"] = re.search("max:\\s*(\\d*.\\d*)", stdout).group(1) def summary(self): + """Create plots shwoing transactions and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + allocators = self.results["allocators"] args = self.results["args"] diff --git a/allocbench/benchmarks/raxmlng.py b/allocbench/benchmarks/raxmlng.py index 645d903..1935cf0 100644 --- a/allocbench/benchmarks/raxmlng.py +++ b/allocbench/benchmarks/raxmlng.py @@ -21,7 +21,6 @@ import re from allocbench.artifact import GitArtifact from allocbench.benchmark import Benchmark -import allocbench.plots as plt from allocbench.util import run_cmd RUNTIME_RE = re.compile("Elapsed time: (?P<runtime>(\\d*.\\d*)) seconds") @@ -83,6 +82,8 @@ class BenchmarkRaxmlng(Benchmark): result["runtime"] = RUNTIME_RE.search(stdout).group("runtime") def summary(self): + """Create plots showing runtime and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel plt.plot(self, "{runtime}", plot_type='bar', diff --git a/allocbench/benchmarks/rdtsc.py b/allocbench/benchmarks/rdtsc.py index 7a870c7..5a85bde 100644 --- a/allocbench/benchmarks/rdtsc.py +++ b/allocbench/benchmarks/rdtsc.py @@ -23,11 +23,8 @@ https://developers.redhat.com/blog/2016/03/11/practical-micro-benchmarking-with- """ import numpy as np -import matplotlib.pyplot as plt from allocbench.benchmark import Benchmark -import allocbench.plots -from allocbench.plots import SUMMARY_FILE_EXT class BenchmarkRdtsc(Benchmark): @@ -55,6 +52,11 @@ class BenchmarkRdtsc(Benchmark): result["cycles"] = np.mean(all_cycles) def summary(self): + """Create plots showing needed cycles""" + import matplotlib.pyplot as plt # pylint: disable=import-outside-toplevel + import allocbench.plots # pylint: disable=import-outside-toplevel + from allocbench.plots import SUMMARY_FILE_EXT # pylint: disable=import-outside-toplevel + for perm in self.iterate_args(args=self.results['args']): label = f'rdtsc_{perm}_cycles' fig = plt.figure(label) diff --git a/allocbench/benchmarks/realloc.py b/allocbench/benchmarks/realloc.py index b1f699e..6e04533 100644 --- a/allocbench/benchmarks/realloc.py +++ b/allocbench/benchmarks/realloc.py @@ -16,7 +16,6 @@ # along with allocbench. If not, see <http://www.gnu.org/licenses/>. """Definition of the realloc micro benchmark""" -import allocbench.plots as plt from allocbench.benchmark import Benchmark @@ -34,6 +33,9 @@ class BenchmarkRealloc(Benchmark): super().__init__(name) def summary(self): + """Create plot showing the needed runtime""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + plt.plot(self, "{task-clock}", plot_type='bar', diff --git a/allocbench/benchmarks/redis.py b/allocbench/benchmarks/redis.py index 09248a5..a6c6530 100644 --- a/allocbench/benchmarks/redis.py +++ b/allocbench/benchmarks/redis.py @@ -26,7 +26,6 @@ import re from allocbench.artifact import ArchiveArtifact from allocbench.benchmark import Benchmark -import allocbench.plots as plt from allocbench.util import run_cmd REQUESTS_RE = re.compile("(?P<requests>(\\d*.\\d*)) requests per second") @@ -81,6 +80,9 @@ class BenchmarkRedis(Benchmark): os.remove("dump.rdb") def summary(self): + """Create plots showing handled requests and VmHWM""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + plt.plot(self, "{requests}", plot_type='bar', diff --git a/allocbench/benchmarks/t_test1.py b/allocbench/benchmarks/t_test1.py index b6b7cf4..d25fbde 100644 --- a/allocbench/benchmarks/t_test1.py +++ b/allocbench/benchmarks/t_test1.py @@ -17,7 +17,6 @@ """Definition of the commonly used t-test1 allocator test""" from allocbench.benchmark import Benchmark -import allocbench.plots as plt class BenchmarkTTest1(Benchmark): @@ -39,6 +38,9 @@ class BenchmarkTTest1(Benchmark): super().__init__(name) def summary(self): + """Create plots showing runtime and L1 data cache miss rate""" + import allocbench.plots as plt # pylint: disable=import-outside-toplevel + # mops / per second yval = "perm.nthreads / ({task-clock}/1000)" # Speed |
