diff options
| author | Florian Fischer <florian.fl.fischer@fau.de> | 2020-02-20 12:19:44 +0100 |
|---|---|---|
| committer | Florian Fischer <florian.fl.fischer@fau.de> | 2020-02-20 12:19:44 +0100 |
| commit | 9c9dd922379312fe744307a71ad1b8715098e18b (patch) | |
| tree | 22feb63adec67c93bbe1e3283dee8510a627896f /src/benchmarks | |
| parent | 42f029418a28e98788c95098837dfb45ea2bfffc (diff) | |
| parent | 40860ce5b8134618dad6457049d533aa211b0139 (diff) | |
| download | allocbench-9c9dd922379312fe744307a71ad1b8715098e18b.tar.gz allocbench-9c9dd922379312fe744307a71ad1b8715098e18b.zip | |
Merge branch 'pgfplots'
Diffstat (limited to 'src/benchmarks')
| -rw-r--r-- | src/benchmarks/blowup.py | 12 | ||||
| -rw-r--r-- | src/benchmarks/cfrac.py | 30 | ||||
| -rw-r--r-- | src/benchmarks/dj_trace.py | 317 | ||||
| -rw-r--r-- | src/benchmarks/espresso.py | 34 | ||||
| -rw-r--r-- | src/benchmarks/falsesharing.py | 43 | ||||
| -rw-r--r-- | src/benchmarks/fd.py | 23 | ||||
| -rw-r--r-- | src/benchmarks/httpd.py | 46 | ||||
| -rw-r--r-- | src/benchmarks/larson.py | 19 | ||||
| -rw-r--r-- | src/benchmarks/lld.py | 9 | ||||
| -rw-r--r-- | src/benchmarks/loop.py | 49 | ||||
| -rw-r--r-- | src/benchmarks/raxmlng.py | 29 |
11 files changed, 369 insertions, 242 deletions
diff --git a/src/benchmarks/blowup.py b/src/benchmarks/blowup.py index aca9293..d3700e3 100644 --- a/src/benchmarks/blowup.py +++ b/src/benchmarks/blowup.py @@ -17,6 +17,7 @@ """Definition of the blowup micro benchmark""" from src.benchmark import Benchmark +import src.plots as plt class BenchmarkBlowup(Benchmark): @@ -53,15 +54,16 @@ class BenchmarkBlowup(Benchmark): } } - self.barplot_single_arg("{VmHWM}/1000", - ylabel='"VmHWM in MB"', - title='"blowup test"', - filepostfix="vmhwm") + plt.barplot_single_arg(self, + "{VmHWM}/1000", + ylabel="VmHWM in MB", + title="blowup test", + filepostfix="vmhwm") del allocators["Ideal-RSS"] del self.results["stats"]["Ideal-RSS"] - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") blowup = BenchmarkBlowup() diff --git a/src/benchmarks/cfrac.py b/src/benchmarks/cfrac.py index dfd87d6..59c8858 100644 --- a/src/benchmarks/cfrac.py +++ b/src/benchmarks/cfrac.py @@ -59,6 +59,7 @@ API function as well as memory placement strategies with good data locality. """ from src.benchmark import Benchmark +import src.plots as plt class BenchmarkCfrac(Benchmark): @@ -75,24 +76,27 @@ class BenchmarkCfrac(Benchmark): def summary(self): # Speed - self.barplot_single_arg("{task-clock}/1000", - ylabel='"cpu-second"', - title='"Cfrac: runtime"', - filepostfix="time") + plt.barplot_single_arg(self, + "{task-clock}/1000", + ylabel='"cpu-second"', + title='"Cfrac: runtime"', + filepostfix="time") # L1 cache misses - self.barplot_single_arg( + plt.barplot_single_arg( + self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", - ylabel='"L1 misses in %"', - title='"Cfrac l1 cache misses"', + ylabel="L1 misses in %", + title="Cfrac l1 cache misses", filepostfix="l1misses", yerr=False) # Memusage - self.barplot_single_arg("{VmHWM}", - ylabel='"VmHWM in KB"', - title='"Cfrac VmHWM"', - filepostfix="vmhwm") + plt.barplot_single_arg(self, + "{VmHWM}", + ylabel="VmHWM in KB", + title="Cfrac VmHWM", + filepostfix="vmhwm") self.write_tex_table([{ "label": "Runtime [ms]", @@ -105,9 +109,9 @@ class BenchmarkCfrac(Benchmark): }], filepostfix="table") - self.export_stats_to_dataref("task-clock") + plt.export_stats_to_dataref(self, "task-clock") - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") cfrac = BenchmarkCfrac() diff --git a/src/benchmarks/dj_trace.py b/src/benchmarks/dj_trace.py index 3d109aa..4730db3 100644 --- a/src/benchmarks/dj_trace.py +++ b/src/benchmarks/dj_trace.py @@ -14,7 +14,6 @@ # # You should have received a copy of the GNU General Public License # along with allocbench. If not, see <http://www.gnu.org/licenses/>. - """Benchmark definition using the traces collected by DJ Delorie""" import os @@ -25,13 +24,12 @@ from urllib.request import urlretrieve import matplotlib.pyplot as plt import numpy as np -from src.globalvars import summary_file_ext - from src.artifact import ArchiveArtifact from src.benchmark import Benchmark +from src.globalvars import summary_file_ext +import src.plots as abplt from src.util import print_status - COMMA_SEP_NUMBER_RE = "(?:\\d*(?:,\\d*)?)*" RSS_RE = f"(?P<rss>{COMMA_SEP_NUMBER_RE})" TIME_RE = f"(?P<time>{COMMA_SEP_NUMBER_RE})" @@ -56,52 +54,84 @@ class BenchmarkDJTrace(Benchmark): workloads are generated from traces of real aplications and are also used by delorie to measure improvements in the glibc allocator. """ - def __init__(self): name = "dj_trace" self.cmd = "trace_run{binary_suffix} {workload_dir}/dj_workloads/{workload}.wl" self.measure_cmd = "" - self.args = {"workload": ["389-ds-2", - "dj", - "dj2", - "mt_test_one_alloc", - "oocalc", - "qemu-virtio", - "qemu-win7", - "proprietary-1", - "proprietary-2"]} - - self.results = {"389-ds-2": { - "malloc": 170500018, "calloc": 161787184, - "realloc": 404134, "free": 314856324, - "threads": 41}, - "dj": { - "malloc": 2000000, "calloc": 200, "realloc": 0, - "free": 2003140, "threads": 201}, - "dj2": { - "malloc": 29263321, "calloc": 3798404, - "realloc": 122956, "free": 32709054, - "threads": 36}, - "mt_test_one_alloc": { - "malloc": 524290, "calloc": 1, "realloc": 0, - "free": 594788, "threads": 2}, - "oocalc": { - "malloc": 6731734, "calloc": 38421, - "realloc": 14108, "free": 6826686, "threads": 88}, - "qemu-virtio": { - "malloc": 1772163, "calloc": 146634, - "realloc": 59813, "free": 1954732, "threads": 3}, - "qemu-win7": { - "malloc": 980904, "calloc": 225420, - "realloc": 89880, "free": 1347825, "threads": 6}, - "proprietary-1": { - "malloc": 316032131, "calloc": 5642, "realloc": 84, - "free": 319919727, "threads": 20}, - "proprietary-2": { - "malloc": 9753948, "calloc": 4693, - "realloc": 117, "free": 10099261, "threads": 19}} + self.args = { + "workload": [ + "389-ds-2", "dj", "dj2", "mt_test_one_alloc", "oocalc", + "qemu-virtio", "qemu-win7", "proprietary-1", "proprietary-2" + ] + } + + self.results = { + "389-ds-2": { + "malloc": 170500018, + "calloc": 161787184, + "realloc": 404134, + "free": 314856324, + "threads": 41 + }, + "dj": { + "malloc": 2000000, + "calloc": 200, + "realloc": 0, + "free": 2003140, + "threads": 201 + }, + "dj2": { + "malloc": 29263321, + "calloc": 3798404, + "realloc": 122956, + "free": 32709054, + "threads": 36 + }, + "mt_test_one_alloc": { + "malloc": 524290, + "calloc": 1, + "realloc": 0, + "free": 594788, + "threads": 2 + }, + "oocalc": { + "malloc": 6731734, + "calloc": 38421, + "realloc": 14108, + "free": 6826686, + "threads": 88 + }, + "qemu-virtio": { + "malloc": 1772163, + "calloc": 146634, + "realloc": 59813, + "free": 1954732, + "threads": 3 + }, + "qemu-win7": { + "malloc": 980904, + "calloc": 225420, + "realloc": 89880, + "free": 1347825, + "threads": 6 + }, + "proprietary-1": { + "malloc": 316032131, + "calloc": 5642, + "realloc": 84, + "free": 319919727, + "threads": 20 + }, + "proprietary-2": { + "malloc": 9753948, + "calloc": 4693, + "realloc": 117, + "free": 10099261, + "threads": 19 + } + } self.requirements = ["trace_run"] super().__init__(name) @@ -109,10 +139,10 @@ class BenchmarkDJTrace(Benchmark): def prepare(self): super().prepare() - workloads = ArchiveArtifact("dj_workloads", - "https://www4.cs.fau.de/~flow/allocbench/dj_workloads.tar.xz", - "tar", - "c9bc499eeba8023bca28a755fffbaf9200a335ad") + workloads = ArchiveArtifact( + "dj_workloads", + "https://www4.cs.fau.de/~flow/allocbench/dj_workloads.tar.xz", + "tar", "c9bc499eeba8023bca28a755fffbaf9200a335ad") self.workload_dir = workloads.provide() @@ -121,18 +151,19 @@ class BenchmarkDJTrace(Benchmark): def to_int(string): return int(string.replace(',', "")) - regexs = {7: MALLOC_RE, 8: CALLOC_RE, 9: REALLOC_RE, 10: FREE_RE} functions = {7: "malloc", 8: "calloc", 9: "realloc", 10: "free"} for i, line in enumerate(stdout.splitlines()): if i == 0: result["cycles"] = to_int(CYCLES_RE.match(line).group("time")) elif i == 2: - result["cputime"] = to_int(CPU_TIME_RE.match(line).group("time")) + result["cputime"] = to_int( + CPU_TIME_RE.match(line).group("time")) elif i == 3: result["Max_RSS"] = to_int(MAX_RSS_RE.match(line).group("rss")) elif i == 4: - result["Ideal_RSS"] = to_int(IDEAL_RSS_RE.match(line).group("rss")) + result["Ideal_RSS"] = to_int( + IDEAL_RSS_RE.match(line).group("rss")) elif i in [7, 8, 9, 10]: res = regexs[i].match(line) fname = functions[i] @@ -148,52 +179,67 @@ class BenchmarkDJTrace(Benchmark): for i, allocator in enumerate(allocators): data = [x["cputime"] for x in self.results[allocator][perm]] # data is in milliseconds - cpu_time_means[allocator][perm] = np.mean(data)/1000 + cpu_time_means[allocator][perm] = np.mean(data) / 1000 data = [x["cycles"] for x in self.results[allocator][perm]] cycles_means[allocator][perm] = np.mean(data) - plt.bar([i], cpu_time_means[allocator][perm], label=allocator, + plt.bar([i], + cpu_time_means[allocator][perm], + label=allocator, color=allocators[allocator]["color"]) plt.legend(loc="best") plt.ylabel("time in ms") plt.title(f"Runtime {perm.workload}") - plt.savefig(".".join([self.name, perm.workload, "runtime", summary_file_ext])) + plt.savefig(".".join( + [self.name, perm.workload, "runtime", summary_file_ext])) plt.clf() - self.barplot_single_arg("{cputime}/1000", - ylabel='"time in ms"', - title='"total runtime"', - filepostfix="runtime") + abplt.barplot_single_arg(self, + "{cputime}/1000", + ylabel="time in ms", + title="total runtime", + filepostfix="runtime") # Function Times func_times_means = {allocator: {} for allocator in allocators} xa = np.arange(0, 6, 1.5) for perm in self.iterate_args(args=args): for i, allocator in enumerate(allocators): - x_vals = [x+i/len(allocators) for x in xa] + x_vals = [x + i / len(allocators) for x in xa] func_times_means[allocator][perm] = [0, 0, 0, 0] - func_times_means[allocator][perm][0] = np.mean([x["avg_malloc"] for x in self.results[allocator][perm]]) - func_times_means[allocator][perm][1] = np.mean([x["avg_calloc"] for x in self.results[allocator][perm]]) - func_times_means[allocator][perm][2] = np.mean([x["avg_realloc"] for x in self.results[allocator][perm]]) - func_times_means[allocator][perm][3] = np.mean([x["avg_free"] for x in self.results[allocator][perm]]) - - plt.bar(x_vals, func_times_means[allocator][perm], width=0.25, - align="center", label=allocator, + func_times_means[allocator][perm][0] = np.mean( + [x["avg_malloc"] for x in self.results[allocator][perm]]) + func_times_means[allocator][perm][1] = np.mean( + [x["avg_calloc"] for x in self.results[allocator][perm]]) + func_times_means[allocator][perm][2] = np.mean( + [x["avg_realloc"] for x in self.results[allocator][perm]]) + func_times_means[allocator][perm][3] = np.mean( + [x["avg_free"] for x in self.results[allocator][perm]]) + + plt.bar(x_vals, + func_times_means[allocator][perm], + width=0.25, + align="center", + label=allocator, color=allocators[allocator]["color"]) plt.legend(loc="best") - plt.xticks(xa + 1/len(allocators)*2, - ["malloc\n" + str(self.results[perm.workload]["malloc"]) + "\ncalls", - "calloc\n" + str(self.results[perm.workload]["calloc"]) + "\ncalls", - "realloc\n" + str(self.results[perm.workload]["realloc"]) + "\ncalls", - "free\n" + str(self.results[perm.workload]["free"]) + "\ncalls"]) + plt.xticks(xa + 1 / len(allocators) * 2, [ + "malloc\n" + str(self.results[perm.workload]["malloc"]) + + "\ncalls", "calloc\n" + + str(self.results[perm.workload]["calloc"]) + "\ncalls", + "realloc\n" + str(self.results[perm.workload]["realloc"]) + + "\ncalls", + "free\n" + str(self.results[perm.workload]["free"]) + "\ncalls" + ]) plt.ylabel("cycles") plt.title(f"Avg. runtime of API functions {perm.workload}") - plt.savefig(".".join([self.name, perm.workload, "apitimes", summary_file_ext])) + plt.savefig(".".join( + [self.name, perm.workload, "apitimes", summary_file_ext])) plt.clf() # Memusage @@ -201,19 +247,27 @@ class BenchmarkDJTrace(Benchmark): allocators["Ideal_RSS"] = {"color": "xkcd:gold"} self.results["stats"]["Ideal_RSS"] = {} for perm in self.iterate_args(args=args): - ideal_rss = self.results[list(allocators.keys())[0]][perm][0]["Ideal_RSS"]/1000 - self.results["stats"]["Ideal_RSS"][perm] = {"mean": {"Max_RSS": ideal_rss}, - "std": {"Max_RSS": 0}} - - self.barplot_single_arg("{Max_RSS}/1000", - ylabel='"Max RSS in MB"', - title='"Max RSS (VmHWM)"', - filepostfix="newrss") + ideal_rss = self.results[list( + allocators.keys())[0]][perm][0]["Ideal_RSS"] / 1000 + self.results["stats"]["Ideal_RSS"][perm] = { + "mean": { + "Max_RSS": ideal_rss + }, + "std": { + "Max_RSS": 0 + } + } + + abplt.barplot_single_arg(self, + "{Max_RSS}/1000", + ylabel="Max RSS in MB", + title="Max RSS (VmHWM)", + filepostfix="newrss") # self.barplot_fixed_arg("{Max_RSS}/1000", - # ylabel='"Max RSS in MB"', - # title='"Highwatermark of Vm (VmHWM)"', - # filepostfix="newrss") + # ylabel='"Max RSS in MB"', + # title='"Highwatermark of Vm (VmHWM)"', + # filepostfix="newrss") del allocators["Ideal_RSS"] del self.results["stats"]["Ideal_RSS"] @@ -223,49 +277,66 @@ class BenchmarkDJTrace(Benchmark): for i, allocator in enumerate(allocators): d = [x["Max_RSS"] for x in self.results[allocator][perm]] # data is in kB - rss_means[allocator][perm] = np.mean(d)/1000 + rss_means[allocator][perm] = np.mean(d) / 1000 - plt.bar([i], rss_means[allocator][perm], label=allocator, + plt.bar([i], + rss_means[allocator][perm], + label=allocator, color=allocators[allocator]["color"]) # add ideal rss - y_val = self.results[list(allocators.keys())[0]][perm][0]["Ideal_RSS"]/1000 + y_val = self.results[list( + allocators.keys())[0]][perm][0]["Ideal_RSS"] / 1000 plt.bar([len(allocators)], y_val, label="Ideal RSS") plt.legend(loc="best") plt.ylabel("Max RSS in MB") plt.title(f"Maximal RSS (VmHWM) {perm.workload}") - plt.savefig(".".join([self.name, perm.workload, "rss", summary_file_ext])) + plt.savefig(".".join( + [self.name, perm.workload, "rss", summary_file_ext])) plt.clf() - self.export_stats_to_csv("Max_RSS") - self.export_stats_to_csv("cputime") + abplt.export_stats_to_csv(self, "Max_RSS") + abplt.export_stats_to_csv(self, "cputime") - self.export_stats_to_dataref("Max_RSS") - self.export_stats_to_dataref("cputime") + abplt.export_stats_to_dataref(self, "Max_RSS") + abplt.export_stats_to_dataref(self, "cputime") # Big table - self.write_tex_table([{"label": "Runtime [ms]", - "expression": "{cputime}/1000", - "sort": "<"}, - {"label": "Max RSS [MB]", - "expression": "{Max_RSS}/1000", - "sort":"<"}], - filepostfix="table") + abplt.write_tex_table(self, [{ + "label": "Runtime [ms]", + "expression": "{cputime}/1000", + "sort": "<" + }, { + "label": "Max RSS [MB]", + "expression": "{Max_RSS}/1000", + "sort": "<" + }], + filepostfix="table") # Tables for perm in self.iterate_args(args=args): # collect data d = {allocator: {} for allocator in allocators} for i, allocator in enumerate(allocators): - d[allocator]["time"] = [x["cputime"] for x in self.results[allocator][perm]] - d[allocator]["rss"] = [x["Max_RSS"] for x in self.results[allocator][perm]] - - times = {allocator: np.mean(d[allocator]["time"]) for allocator in allocators} + d[allocator]["time"] = [ + x["cputime"] for x in self.results[allocator][perm] + ] + d[allocator]["rss"] = [ + x["Max_RSS"] for x in self.results[allocator][perm] + ] + + times = { + allocator: np.mean(d[allocator]["time"]) + for allocator in allocators + } tmin = min(times.values()) tmax = max(times.values()) - rss = {allocator: np.mean(d[allocator]["rss"]) for allocator in allocators} + rss = { + allocator: np.mean(d[allocator]["rss"]) + for allocator in allocators + } rssmin = min(rss.values()) rssmax = max(rss.values()) @@ -275,7 +346,9 @@ class BenchmarkDJTrace(Benchmark): print("\\usepackage{xcolor}", file=f) print("\\begin{document}", file=f) print("\\begin{tabular}{| l | l | l |}", file=f) - print("& Zeit (ms) / $\\sigma$ (\\%) & VmHWM (KB) / $\\sigma$ (\\%) \\\\", file=f) + print( + "& Zeit (ms) / $\\sigma$ (\\%) & VmHWM (KB) / $\\sigma$ (\\%) \\\\", + file=f) print("\\hline", file=f) for allocator in allocators: @@ -291,7 +364,7 @@ class BenchmarkDJTrace(Benchmark): color = "red" else: color = "black" - print(s.format(color, m, np.std(t)/m), end=" & ", file=f) + print(s.format(color, m, np.std(t) / m), end=" & ", file=f) t = d[allocator]["rss"] m = rss[allocator] @@ -301,7 +374,10 @@ class BenchmarkDJTrace(Benchmark): color = "red" else: color = "black" - print(s.format(color, m, np.std(t)/m if m else 0), "\\\\", file=f) + print(s.format(color, m, + np.std(t) / m if m else 0), + "\\\\", + file=f) print("\\end{tabular}", file=f) print("\\end{document}", file=f) @@ -314,23 +390,27 @@ class BenchmarkDJTrace(Benchmark): for i, allocator in enumerate(allocators): print("{0} {1} {0}".format("-" * 10, allocator), file=f) print(fmt.format("Workload", "Total", "malloc", "calloc", - "realloc", "free", "RSS"), file=f) + "realloc", "free", "RSS"), + file=f) for perm in self.iterate_args(args=args): cycles = cycles_means[allocator][perm] times = [t for t in func_times_means[allocator][perm]] rss = rss_means[allocator][perm] print(fmt.format(perm.workload, cycles, times[0], times[1], - times[2], times[3], rss), file=f) + times[2], times[3], rss), + file=f) print(file=f) # Changes. First allocator in allocators is the reference fmt_changes = "{:<20} {:>14.0f}% {:>6.0f}% {:>6.0f}% {:>6.0f}% {:>6.0f}% {:>6.0f}%" for allocator in list(allocators)[1:]: - print("{0} Changes {1} {0}".format("-" * 10, allocator), file=f) + print("{0} Changes {1} {0}".format("-" * 10, allocator), + file=f) print(fmt.format("Workload", "Total", "malloc", "calloc", - "realloc", "free", "RSS"), file=f) + "realloc", "free", "RSS"), + file=f) ref_alloc = list(allocators)[0] cycles_change_means = [] @@ -340,7 +420,8 @@ class BenchmarkDJTrace(Benchmark): normal_cycles = cycles_means[ref_alloc][perm] if normal_cycles: - cycles = np.round(cycles_means[allocator][perm] / normal_cycles * 100) + cycles = np.round(cycles_means[allocator][perm] / + normal_cycles * 100) else: cycles = 0 cycles_change_means.append(cycles) @@ -351,27 +432,31 @@ class BenchmarkDJTrace(Benchmark): t = func_times_means[allocator][perm][i] nt = normal_times[i] if nt != 0: - times[i] = np.round(t/nt * 100) + times[i] = np.round(t / nt * 100) times_change_means.append(times) normal_rss = rss_means[ref_alloc][perm] if normal_rss: - rss = np.round(rss_means[allocator][perm] / normal_rss * 100) + rss = np.round(rss_means[allocator][perm] / + normal_rss * 100) else: rss = 0 rss_change_means.append(rss) print(fmt_changes.format(perm.workload, cycles, times[0], - times[1], times[2], times[3], rss), + times[1], times[2], times[3], + rss), file=f) print(file=f) tmeans = [0, 0, 0, 0] for i in range(0, len(times)): - tmeans[i] = np.mean([times[i] for times in times_change_means]) + tmeans[i] = np.mean( + [times[i] for times in times_change_means]) print(fmt_changes.format("Mean:", np.mean(cycles_change_means), tmeans[0], tmeans[1], tmeans[2], tmeans[3], np.mean(rss_change_means)), - '\n', file=f) + '\n', + file=f) dj_trace = BenchmarkDJTrace() diff --git a/src/benchmarks/espresso.py b/src/benchmarks/espresso.py index 2f8b8bf..5149dcb 100644 --- a/src/benchmarks/espresso.py +++ b/src/benchmarks/espresso.py @@ -59,6 +59,7 @@ import os from src.benchmark import Benchmark import src.globalvars +import src.plots as plt class BenchmarkEspresso(Benchmark): @@ -79,26 +80,29 @@ class BenchmarkEspresso(Benchmark): def summary(self): # Speed - self.barplot_single_arg("{task-clock}/1000", - ylabel='"cpu-second"', - title='"Espresso: runtime"', - filepostfix="time") + plt.barplot_single_arg(self, + "{task-clock}/1000", + ylabel="cpu-second", + title="Espresso: runtime", + filepostfix="time") # L1 cache misses - self.barplot_single_arg( + plt.barplot_single_arg( + self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", - ylabel='"L1 misses in %"', - title='"Espresso l1 cache misses"', + ylabel="L1 misses in %", + title="Espresso l1 cache misses", filepostfix="l1misses", yerr=False) # Memusage - self.barplot_single_arg("{VmHWM}", - ylabel='"VmHWM in KB"', - title='"Espresso VmHWM"', - filepostfix="vmhwm") + plt.barplot_single_arg(self, + "{VmHWM}", + ylabel="VmHWM in KB", + title="Espresso VmHWM", + filepostfix="vmhwm") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "Runtime [ms]", "expression": "{task-clock}", "sort": "<" @@ -107,11 +111,11 @@ class BenchmarkEspresso(Benchmark): "expression": "{VmHWM}", "sort": "<" }], - filepostfix="table") + filepostfix="table") - self.export_stats_to_dataref("task-clock") + plt.export_stats_to_dataref(self, "task-clock") - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") espresso = BenchmarkEspresso() diff --git a/src/benchmarks/falsesharing.py b/src/benchmarks/falsesharing.py index 530ca99..fb4627d 100644 --- a/src/benchmarks/falsesharing.py +++ b/src/benchmarks/falsesharing.py @@ -23,6 +23,7 @@ import numpy as np from src.benchmark import Benchmark from src.globalvars import summary_file_ext +import src.plots as plt TIME_RE = re.compile("^Time elapsed = (?P<time>\\d*\\.\\d*) seconds.$") @@ -78,38 +79,40 @@ class BenchmarkFalsesharing(Benchmark): del self.results["stats"] self.calc_desc_statistics() - self.plot_fixed_arg("{speedup}", - ylabel="'Speedup'", - title="'Speedup: ' + arg + ' ' + str(arg_value)", - filepostfix="speedup", - autoticks=False, - fixed=["bench"]) + plt.plot_fixed_arg(self, + "{speedup}", + ylabel="Speedup", + title="Speedup: {arg} {arg_value}", + filepostfix="speedup", + autoticks=False, + fixed=["bench"]) - self.plot_fixed_arg( + plt.plot_fixed_arg( + self, "{l1chache_misses}", - ylabel="'l1 cache misses in %'", - title="'cache misses: ' + arg + ' ' + str(arg_value)", + ylabel="l1 cache misses in %", + title="cache misses: {arg} {arg_value}", filepostfix="l1-misses", autoticks=False, fixed=["bench"]) - self.plot_fixed_arg( - "({LLC-load-misses}/{LLC-loads})*100", - ylabel="'llc cache misses in %'", - title="'LLC misses: ' + arg + ' ' + str(arg_value)", - filepostfix="llc-misses", - autoticks=False, - fixed=["bench"]) + plt.plot_fixed_arg(self, + "({LLC-load-misses}/{LLC-loads})*100", + ylabel="llc cache misses in %", + title="LLC misses: {arg} {arg_value}", + filepostfix="llc-misses", + autoticks=False, + fixed=["bench"]) - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "Speedup", "expression": "{speedup}", "sort": ">" }], - filepostfix="speedup.table") + filepostfix="speedup.table") - self.export_stats_to_csv("speedup", "time") - self.export_stats_to_csv("l1chache_misses", "l1-misses") + plt.export_stats_to_csv(self, "speedup", "time") + plt.export_stats_to_csv(self, "l1chache_misses", "l1-misses") falsesharing = BenchmarkFalsesharing() diff --git a/src/benchmarks/fd.py b/src/benchmarks/fd.py index 4fab958..0d5657d 100644 --- a/src/benchmarks/fd.py +++ b/src/benchmarks/fd.py @@ -22,6 +22,7 @@ from urllib.request import urlretrieve from src.artifact import ArchiveArtifact, GitArtifact from src.benchmark import Benchmark +import src.plots as plt from src.util import print_info @@ -66,19 +67,21 @@ class BenchmarkFd(Benchmark): os.link(src, dest) def summary(self): - self.barplot_single_arg("{task-clock}", - ylabel='"runtime in ms"', - title='"fd runtime"', - filepostfix="runtime") + plt.barplot_single_arg(self, + "{task-clock}", + ylabel="runtime in ms", + title="fd runtime", + filepostfix="runtime") - self.export_stats_to_dataref("task-clock") + plt.export_stats_to_dataref(self, "task-clock") - self.barplot_single_arg("{VmHWM}", - ylabel='"VmHWM in KB"', - title='"fd memusage"', - filepostfix="memusage") + plt.barplot_single_arg(self, + "{VmHWM}", + ylabel="VmHWM in KB", + title="fd memusage", + filepostfix="memusage") - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") fd = BenchmarkFd() diff --git a/src/benchmarks/httpd.py b/src/benchmarks/httpd.py index 64f8e11..2138834 100644 --- a/src/benchmarks/httpd.py +++ b/src/benchmarks/httpd.py @@ -20,6 +20,7 @@ import re from src.benchmark import Benchmark import src.facter +import src.plots as plt class BenchmarkHTTPD(Benchmark): @@ -59,28 +60,29 @@ class BenchmarkHTTPD(Benchmark): "Requests per second:\\s*(\\d*\\.\\d*) .*", stdout).group(1) def summary(self): - allocators = self.results["allocators"] - - self.plot_fixed_arg("{requests}", - xlabel='"threads"', - ylabel='"requests/s"', - autoticks=False, - filepostfix="requests", - title='perm.site + ": requests/s"') - - self.plot_fixed_arg("{nginx_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": nginx memory usage"', - filepostfix="httpd_vmhwm", - autoticks=False) - - self.plot_fixed_arg("{php-fpm_vmhwm}", - xlabel='"threads"', - ylabel='"VmHWM in KB"', - title='perm.site + ": php-fpm memory usage"', - filepostfix="php-fpm_vmhwm", - autoticks=False) + plt.plot_fixed_arg(self, + "{requests}", + xlabel="threads", + ylabel="requests/s", + autoticks=False, + filepostfix="requests", + title="{perm.site}: requests/s") + + plt.plot_fixed_arg(self, + "{nginx_vmhwm}", + xlabel="threads", + ylabel="VmHWM in KB", + title="{perm.site}: nginx memory usage", + filepostfix="httpd_vmhwm", + autoticks=False) + + plt.plot_fixed_arg(self, + "{php-fpm_vmhwm}", + xlabel="threads", + ylabel="VmHWM in KB", + title="{perm.site}: php-fpm memory usage", + filepostfix="php-fpm_vmhwm", + autoticks=False) httpd = BenchmarkHTTPD() diff --git a/src/benchmarks/larson.py b/src/benchmarks/larson.py index 6e55fbe..5f153ea 100644 --- a/src/benchmarks/larson.py +++ b/src/benchmarks/larson.py @@ -48,6 +48,7 @@ false sharing because it uses multiple threads, which pass memory around. import re from src.benchmark import Benchmark +import src.plots as plt THROUGHPUT_RE = re.compile( "^Throughput =\\s*(?P<throughput>\\d+) operations per second.$") @@ -80,15 +81,17 @@ class BenchmarkLarson(Benchmark): def summary(self): # Plot threads->throughput and maxsize->throughput - self.plot_fixed_arg("{throughput}/1000000", - ylabel="'MOPS/s'", - title="'Larson: ' + arg + ' ' + str(arg_value)", - filepostfix="throughput") - - self.plot_fixed_arg( + plt.plot_fixed_arg(self, + "{throughput}/1000000", + ylabel="MOPS/s", + title="Larson: {arg} {arg_value}", + filepostfix="throughput") + + plt.plot_fixed_arg( + self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", - ylabel="'l1 cache misses in %'", - title="'Larson cache misses: ' + arg + ' ' + str(arg_value)", + ylabel="l1 cache misses in %", + title="Larson cache misses: {arg} {arg_value}", filepostfix="cachemisses") diff --git a/src/benchmarks/lld.py b/src/benchmarks/lld.py index 3657896..b2da35b 100644 --- a/src/benchmarks/lld.py +++ b/src/benchmarks/lld.py @@ -204,6 +204,7 @@ import matplotlib.pyplot as plt from src.artifact import ArchiveArtifact from src.benchmark import Benchmark import src.facter +import src.plots from src.globalvars import summary_file_ext @@ -283,17 +284,17 @@ class BenchmarkLld(Benchmark): plt.clf() # self.export_stats_to_csv("VmHWM") - self.export_stats_to_csv("task-clock") + src.plots.export_stats_to_csv("task-clock") # self.export_stats_to_dataref("VmHWM") - self.export_stats_to_dataref("task-clock") + src.plots.export_stats_to_dataref("task-clock") - self.write_tex_table([{ + src.plots.write_tex_table([{ "label": "Runtime [ms]", "expression": "{task-clock}", "sort": "<" }], - filepostfix="table") + filepostfix="table") lld = BenchmarkLld() diff --git a/src/benchmarks/loop.py b/src/benchmarks/loop.py index 4ab7d46..ec520a4 100644 --- a/src/benchmarks/loop.py +++ b/src/benchmarks/loop.py @@ -35,6 +35,7 @@ Interpretation: """ from src.benchmark import Benchmark +import src.plots as plt class BenchmarkLoop(Benchmark): @@ -57,33 +58,51 @@ class BenchmarkLoop(Benchmark): def summary(self): # Speed - self.plot_fixed_arg("perm.nthreads / ({task-clock}/1000)", - ylabel='"MOPS/cpu-second"', - title='"Loop: " + arg + " " + str(arg_value)', - filepostfix="time", - autoticks=False) + plt.plot_fixed_arg(self, + "perm.nthreads / ({task-clock}/1000)", + ylabel="MOPS/cpu-second", + title="Loop: {arg} {arg_value}", + filepostfix="time", + autoticks=False) # L1 cache misses - self.plot_fixed_arg( + plt.plot_fixed_arg( + self, "({L1-dcache-load-misses}/{L1-dcache-loads})*100", - ylabel='"L1 misses in %"', - title='"Loop l1 cache misses: " + arg + " " + str(arg_value)', + ylabel="L1 misses in %", + title="Loop l1 cache misses: {arg} {arg_value}", filepostfix="l1misses", autoticks=False) # Speed Matrix - self.write_best_doublearg_tex_table( - "perm.nthreads / ({task-clock}/1000)", filepostfix="time.matrix") + plt.write_best_doublearg_tex_table( + self, + "perm.nthreads / ({task-clock}/1000)", + filepostfix="time.matrix") - self.write_tex_table([{ + plt.write_tex_table(self, [{ "label": "MOPS/s", "expression": "perm.nthreads / ({task-clock}/1000)", "sort": ">" }], - filepostfix="mops.table") - - self.export_stats_to_csv("task-clock") - self.export_stats_to_dataref("task-clock") + filepostfix="mops.table") + + plt.export_stats_to_csv(self, "task-clock") + plt.export_stats_to_dataref(self, "task-clock") + + # pgfplot test + plt.pgfplot_linear(self, + self.iterate_args_fixed({"maxsize": 1024}, + args=self.results["args"]), + "int(perm.nthreads)", + "perm.nthreads / ({task-clock}/1000)", + xlabel="Threads", + ylabel="MOPS/cpu-second", + title="Loop: 1024B", + postfix='mops_1024B') + + # create pgfplot legend + plt.pgfplot_legend(self) loop = BenchmarkLoop() diff --git a/src/benchmarks/raxmlng.py b/src/benchmarks/raxmlng.py index 05a6ca7..228c220 100644 --- a/src/benchmarks/raxmlng.py +++ b/src/benchmarks/raxmlng.py @@ -18,11 +18,10 @@ import os import re -import sys -from urllib.request import urlretrieve from src.artifact import GitArtifact from src.benchmark import Benchmark +import src.plots as plt from src.util import print_info, run_cmd RUNTIME_RE = re.compile("Elapsed time: (?P<runtime>(\\d*.\\d*)) seconds") @@ -58,8 +57,8 @@ class BenchmarkRaxmlng(Benchmark): os.makedirs(raxmlng_builddir, exist_ok=True) # building raxml-ng - run_cmd( ["cmake", ".."], cwd=raxmlng_builddir) - run_cmd( ["make"], cwd=raxmlng_builddir) + run_cmd(["cmake", ".."], cwd=raxmlng_builddir) + run_cmd(["make"], cwd=raxmlng_builddir) # create symlinks for exe in ["raxml-ng"]: @@ -83,19 +82,21 @@ class BenchmarkRaxmlng(Benchmark): result["runtime"] = RUNTIME_RE.search(stdout).group("runtime") def summary(self): - self.barplot_single_arg("{runtime}", - ylabel='"runtime in s"', - title='"raxml-ng tree inference benchmark"', - filepostfix="runtime") + plt.barplot_single_arg(self, + "{runtime}", + ylabel='"runtime in s"', + title='"raxml-ng tree inference benchmark"', + filepostfix="runtime") - self.export_stats_to_dataref("runtime") + plt.export_stats_to_dataref(self, "runtime") - self.barplot_single_arg("{VmHWM}", - ylabel='"VmHWM in KB"', - title='"raxml-ng memusage"', - filepostfix="memusage") + plt.barplot_single_arg(self, + "{VmHWM}", + ylabel='"VmHWM in KB"', + title='"raxml-ng memusage"', + filepostfix="memusage") - self.export_stats_to_dataref("VmHWM") + plt.export_stats_to_dataref(self, "VmHWM") raxmlng = BenchmarkRaxmlng() |
