From f017841a59b7aca49f8cdc9fe8cb70ab146bd6c5 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 13 Jul 2020 11:59:13 +0200 Subject: [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. --- allocbench/benchmarks/blowup.py | 4 +++- allocbench/benchmarks/cfrac.py | 4 +++- allocbench/benchmarks/dj_trace.py | 6 ++++-- allocbench/benchmarks/espresso.py | 4 +++- allocbench/benchmarks/falsesharing.py | 3 ++- allocbench/benchmarks/fd.py | 3 ++- allocbench/benchmarks/httpd.py | 4 +++- allocbench/benchmarks/keydb.py | 3 ++- allocbench/benchmarks/larson.py | 4 +++- allocbench/benchmarks/lld.py | 8 ++++---- allocbench/benchmarks/loop.py | 4 +++- allocbench/benchmarks/mysql.py | 4 +++- allocbench/benchmarks/raxmlng.py | 3 ++- allocbench/benchmarks/rdtsc.py | 8 +++++--- allocbench/benchmarks/realloc.py | 4 +++- allocbench/benchmarks/redis.py | 4 +++- 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{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