2020-01-29 11:03:20 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
2020-03-05 11:40:21 -05:00
|
|
|
# This file is Copyright (c) 2020 Antmicro <www.antmicro.com>
|
2020-01-29 11:03:20 -05:00
|
|
|
# License: BSD
|
|
|
|
|
2020-02-07 06:20:43 -05:00
|
|
|
# Limitations/TODO
|
|
|
|
# - add configurable sdram_clk_freq - using hardcoded value now
|
|
|
|
# - sdram_controller_data_width - try to expose the value from litex_sim to avoid duplicated code
|
|
|
|
|
2020-01-30 08:11:52 -05:00
|
|
|
import os
|
2020-01-29 11:03:20 -05:00
|
|
|
import re
|
2020-01-31 09:16:37 -05:00
|
|
|
import sys
|
2020-02-03 06:13:16 -05:00
|
|
|
import json
|
2020-01-30 09:04:47 -05:00
|
|
|
import argparse
|
2020-02-13 10:10:59 -05:00
|
|
|
import datetime
|
2020-01-29 11:03:20 -05:00
|
|
|
import subprocess
|
2020-01-31 06:57:22 -05:00
|
|
|
from collections import defaultdict, namedtuple
|
|
|
|
|
|
|
|
import yaml
|
2020-02-05 07:41:47 -05:00
|
|
|
try:
|
|
|
|
import numpy as np
|
|
|
|
import pandas as pd
|
|
|
|
import matplotlib
|
|
|
|
from matplotlib.ticker import FuncFormatter, PercentFormatter, ScalarFormatter
|
|
|
|
_summary = True
|
|
|
|
except ImportError as e:
|
|
|
|
_summary = False
|
2020-04-13 12:27:16 -04:00
|
|
|
print("[WARNING] Results summary not available:", e, file=sys.stderr)
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-02-06 08:21:35 -05:00
|
|
|
from litex.tools.litex_sim import get_sdram_phy_settings, sdram_module_nphases
|
|
|
|
from litedram import modules as litedram_modules
|
2020-02-05 06:38:05 -05:00
|
|
|
from litedram.common import Settings as _Settings
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-03-26 05:17:02 -04:00
|
|
|
from test import benchmark
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-01-30 09:04:47 -05:00
|
|
|
# Benchmark configuration --------------------------------------------------------------------------
|
2020-01-30 04:02:49 -05:00
|
|
|
|
2020-02-05 06:38:05 -05:00
|
|
|
class Settings(_Settings):
|
|
|
|
def as_dict(self):
|
|
|
|
d = dict()
|
|
|
|
for attr, value in vars(self).items():
|
2020-04-13 12:27:16 -04:00
|
|
|
if attr == "self" or attr.startswith("_"):
|
2020-02-05 06:38:05 -05:00
|
|
|
continue
|
|
|
|
if isinstance(value, Settings):
|
|
|
|
value = value.as_dict()
|
|
|
|
d[attr] = value
|
|
|
|
return d
|
|
|
|
|
|
|
|
|
|
|
|
class GeneratedAccess(Settings):
|
|
|
|
def __init__(self, bist_length, bist_random):
|
|
|
|
self.set_attributes(locals())
|
|
|
|
|
|
|
|
@property
|
|
|
|
def length(self):
|
|
|
|
return self.bist_length
|
|
|
|
|
|
|
|
def as_args(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
args = ["--bist-length=%d" % self.bist_length]
|
2020-02-05 06:38:05 -05:00
|
|
|
if self.bist_random:
|
2020-04-13 12:27:16 -04:00
|
|
|
args.append("--bist-random")
|
2020-02-05 06:38:05 -05:00
|
|
|
return args
|
|
|
|
|
|
|
|
|
|
|
|
class CustomAccess(Settings):
|
|
|
|
def __init__(self, pattern_file):
|
|
|
|
self.set_attributes(locals())
|
|
|
|
|
|
|
|
@property
|
2020-02-05 07:41:47 -05:00
|
|
|
def pattern(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
# We have to load the file to know pattern length, cache it when requested
|
|
|
|
if not hasattr(self, "_pattern"):
|
2020-02-05 06:38:05 -05:00
|
|
|
path = self.pattern_file
|
|
|
|
if not os.path.isabs(path):
|
|
|
|
benchmark_dir = os.path.dirname(benchmark.__file__)
|
|
|
|
path = os.path.join(benchmark_dir, path)
|
2020-03-26 05:17:02 -04:00
|
|
|
self._pattern = benchmark.load_access_pattern(path)
|
2020-02-05 07:41:47 -05:00
|
|
|
return self._pattern
|
|
|
|
|
|
|
|
@property
|
|
|
|
def length(self):
|
|
|
|
return len(self.pattern)
|
2020-02-05 06:38:05 -05:00
|
|
|
|
|
|
|
def as_args(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
return ["--access-pattern=%s" % self.pattern_file]
|
2020-02-05 06:38:05 -05:00
|
|
|
|
|
|
|
|
2020-01-29 11:03:20 -05:00
|
|
|
class BenchmarkConfiguration(Settings):
|
2020-02-12 08:20:21 -05:00
|
|
|
def __init__(self, name, sdram_module, sdram_data_width, bist_alternating,
|
|
|
|
num_generators, num_checkers, access_pattern):
|
2020-01-29 11:03:20 -05:00
|
|
|
self.set_attributes(locals())
|
|
|
|
|
|
|
|
def as_args(self):
|
2020-02-05 06:38:05 -05:00
|
|
|
args = [
|
2020-04-13 12:27:16 -04:00
|
|
|
"--sdram-module=%s" % self.sdram_module,
|
|
|
|
"--sdram-data-width=%d" % self.sdram_data_width,
|
|
|
|
"--num-generators=%d" % self.num_generators,
|
|
|
|
"--num-checkers=%d" % self.num_checkers,
|
2020-02-05 06:38:05 -05:00
|
|
|
]
|
2020-02-11 06:14:12 -05:00
|
|
|
if self.bist_alternating:
|
2020-04-13 12:27:16 -04:00
|
|
|
args.append("--bist-alternating")
|
2020-02-05 06:38:05 -05:00
|
|
|
args += self.access_pattern.as_args()
|
2020-01-29 11:03:20 -05:00
|
|
|
return args
|
|
|
|
|
2020-01-31 08:16:39 -05:00
|
|
|
def __eq__(self, other):
|
|
|
|
if not isinstance(other, BenchmarkConfiguration):
|
|
|
|
return NotImplemented
|
2020-02-05 06:38:05 -05:00
|
|
|
return self.as_dict() == other.as_dict()
|
|
|
|
|
|
|
|
@property
|
|
|
|
def length(self):
|
|
|
|
return self.access_pattern.length
|
2020-01-31 08:16:39 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
@classmethod
|
|
|
|
def from_dict(cls, d):
|
2020-04-13 12:27:16 -04:00
|
|
|
access_cls = CustomAccess if "pattern_file" in d["access_pattern"] else GeneratedAccess
|
|
|
|
d["access_pattern"] = access_cls(**d["access_pattern"])
|
2020-02-05 07:41:47 -05:00
|
|
|
return cls(**d)
|
|
|
|
|
2020-01-30 09:04:47 -05:00
|
|
|
@classmethod
|
|
|
|
def load_yaml(cls, yaml_file):
|
|
|
|
with open(yaml_file) as f:
|
|
|
|
description = yaml.safe_load(f)
|
2020-02-05 06:38:05 -05:00
|
|
|
configs = []
|
|
|
|
for name, desc in description.items():
|
2020-04-13 12:27:16 -04:00
|
|
|
desc["name"] = name
|
2020-02-05 07:41:47 -05:00
|
|
|
configs.append(cls.from_dict(desc))
|
2020-02-05 06:38:05 -05:00
|
|
|
return configs
|
|
|
|
|
|
|
|
def __repr__(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
return "BenchmarkConfiguration(%s)" % self.as_dict()
|
2020-01-30 09:04:47 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
@property
|
2020-02-06 08:21:35 -05:00
|
|
|
def sdram_clk_freq(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
return 100e6 # FIXME: Value of 100MHz is hardcoded in litex_sim
|
2020-02-06 08:21:35 -05:00
|
|
|
|
|
|
|
@property
|
2020-02-20 07:32:49 -05:00
|
|
|
def sdram_memtype(self):
|
2020-04-13 12:27:16 -04:00
|
|
|
# Use values from module class (no need to instantiate it)
|
2020-02-06 08:21:35 -05:00
|
|
|
sdram_module_cls = getattr(litedram_modules, self.sdram_module)
|
2020-02-20 07:32:49 -05:00
|
|
|
return sdram_module_cls.memtype
|
|
|
|
|
|
|
|
@property
|
|
|
|
def sdram_controller_data_width(self):
|
|
|
|
nphases = sdram_module_nphases[self.sdram_memtype]
|
2020-04-13 12:27:16 -04:00
|
|
|
dfi_databits = self.sdram_data_width * (1 if self.sdram_memtype == "SDR" else 2)
|
2020-02-06 08:21:35 -05:00
|
|
|
return dfi_databits * nphases
|
2020-01-30 04:02:49 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
# Benchmark results --------------------------------------------------------------------------------
|
2020-01-30 04:02:49 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Constructs python regex named group
|
2020-02-05 07:41:47 -05:00
|
|
|
def ng(name, regex):
|
2020-04-13 12:27:16 -04:00
|
|
|
return r"(?P<{}>{})".format(name, regex)
|
2020-01-30 04:02:49 -05:00
|
|
|
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def _compiled_pattern(stage, var):
|
2020-04-13 12:27:16 -04:00
|
|
|
pattern_fmt = r"{stage}\s+{var}:\s+{value}"
|
2020-02-05 07:41:47 -05:00
|
|
|
pattern = pattern_fmt.format(
|
2020-04-13 12:27:16 -04:00
|
|
|
stage = stage,
|
|
|
|
var = var,
|
|
|
|
value = ng("value", "[0-9]+"),
|
2020-02-05 07:41:47 -05:00
|
|
|
)
|
|
|
|
return re.compile(pattern)
|
|
|
|
result = re.search(pattern, benchmark_output)
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-02-03 03:21:18 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
class BenchmarkResult:
|
2020-04-13 12:27:16 -04:00
|
|
|
# Pre-compiled patterns for all benchmarks
|
2020-02-05 07:41:47 -05:00
|
|
|
patterns = {
|
2020-04-13 12:27:16 -04:00
|
|
|
"generator_ticks": _compiled_pattern("BIST-GENERATOR", "ticks"),
|
|
|
|
"checker_errors": _compiled_pattern("BIST-CHECKER", "errors"),
|
|
|
|
"checker_ticks": _compiled_pattern("BIST-CHECKER", "ticks"),
|
2020-02-05 07:41:47 -05:00
|
|
|
}
|
2020-02-03 03:21:18 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
@staticmethod
|
|
|
|
def find(pattern, output):
|
|
|
|
result = pattern.search(output)
|
|
|
|
assert result is not None, \
|
2020-04-13 13:57:49 -04:00
|
|
|
"Could not find pattern {} in output".format(pattern)
|
2020-04-13 12:27:16 -04:00
|
|
|
return int(result.group("value"))
|
2020-02-03 06:13:16 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def __init__(self, output):
|
|
|
|
self._output = output
|
|
|
|
for attr, pattern in self.patterns.items():
|
|
|
|
setattr(self, attr, self.find(pattern, output))
|
2020-02-03 06:13:16 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def __repr__(self):
|
|
|
|
d = {attr: getattr(self, attr) for attr in self.patterns.keys()}
|
2020-04-13 12:27:16 -04:00
|
|
|
return "BenchmarkResult(%s)" % d
|
2020-02-03 06:13:16 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
# Results summary ----------------------------------------------------------------------------------
|
2020-02-03 06:13:16 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def human_readable(value):
|
2020-04-13 12:27:16 -04:00
|
|
|
binary_prefixes = ["", "k", "M", "G", "T"]
|
2020-02-05 07:41:47 -05:00
|
|
|
mult = 1.0
|
|
|
|
for prefix in binary_prefixes:
|
|
|
|
if value * mult < 1024:
|
|
|
|
break
|
|
|
|
mult /= 1024
|
|
|
|
return mult, prefix
|
2020-02-03 06:13:16 -05:00
|
|
|
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def clocks_fmt(clocks):
|
2020-04-13 12:27:16 -04:00
|
|
|
return "{:d} clk".format(int(clocks))
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def bandwidth_fmt(bw):
|
|
|
|
mult, prefix = human_readable(bw)
|
2020-04-13 12:27:16 -04:00
|
|
|
return "{:.1f} {}bps".format(bw * mult, prefix)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def efficiency_fmt(eff):
|
2020-04-13 12:27:16 -04:00
|
|
|
return "{:.1f} %".format(eff * 100)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
|
|
|
|
2020-02-13 10:10:59 -05:00
|
|
|
def get_git_file_path(filename):
|
2020-04-13 12:27:16 -04:00
|
|
|
cmd = ["git", "ls-files", "--full-name", filename]
|
2020-02-13 10:10:59 -05:00
|
|
|
proc = subprocess.run(cmd, stdout=subprocess.PIPE, cwd=os.path.dirname(__file__))
|
2020-04-13 12:27:16 -04:00
|
|
|
return proc.stdout.decode().strip() if proc.returncode == 0 else ""
|
2020-02-13 10:10:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
def get_git_revision_hash(short=False):
|
2020-04-13 12:27:16 -04:00
|
|
|
short = ["--short"] if short else []
|
|
|
|
cmd = ["git", "rev-parse", *short, "HEAD"]
|
|
|
|
proc = subprocess.run(cmd, stdout=subprocess.PIPE, cwd=os.path.dirname(__file__))
|
|
|
|
return proc.stdout.decode().strip() if proc.returncode == 0 else ""
|
2020-02-13 10:10:59 -05:00
|
|
|
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
class ResultsSummary:
|
2020-04-13 12:27:16 -04:00
|
|
|
def __init__(self, run_data, plots_dir="plots"):
|
2020-02-05 07:41:47 -05:00
|
|
|
self.plots_dir = plots_dir
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Because .sdram_controller_data_width may fail for unimplemented modules
|
2020-02-14 11:17:22 -05:00
|
|
|
def except_none(func):
|
|
|
|
try:
|
|
|
|
return func()
|
|
|
|
except:
|
|
|
|
return None
|
2020-02-06 04:39:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Gather results into tabular data
|
2020-02-05 07:41:47 -05:00
|
|
|
column_mappings = {
|
2020-04-13 12:27:16 -04:00
|
|
|
"name": lambda d: d.config.name,
|
|
|
|
"sdram_module": lambda d: d.config.sdram_module,
|
|
|
|
"sdram_data_width": lambda d: d.config.sdram_data_width,
|
|
|
|
"bist_alternating": lambda d: d.config.bist_alternating,
|
|
|
|
"num_generators": lambda d: d.config.num_generators,
|
|
|
|
"num_checkers": lambda d: d.config.num_checkers,
|
|
|
|
"bist_length": lambda d: getattr(d.config.access_pattern, "bist_length", None),
|
|
|
|
"bist_random": lambda d: getattr(d.config.access_pattern, "bist_random", None),
|
|
|
|
"pattern_file": lambda d: getattr(d.config.access_pattern, "pattern_file", None),
|
|
|
|
"length": lambda d: d.config.length,
|
|
|
|
"generator_ticks": lambda d: getattr(d.result, "generator_ticks", None), # None means benchmark failure
|
|
|
|
"checker_errors": lambda d: getattr(d.result, "checker_errors", None),
|
|
|
|
"checker_ticks": lambda d: getattr(d.result, "checker_ticks", None),
|
|
|
|
"ctrl_data_width": lambda d: except_none(lambda: d.config.sdram_controller_data_width),
|
|
|
|
"sdram_memtype": lambda d: except_none(lambda: d.config.sdram_memtype),
|
|
|
|
"clk_freq": lambda d: d.config.sdram_clk_freq,
|
2020-02-05 07:41:47 -05:00
|
|
|
}
|
|
|
|
columns = {name: [mapping(data) for data in run_data] for name, mapping, in column_mappings.items()}
|
2020-02-14 11:17:22 -05:00
|
|
|
self._df = df = pd.DataFrame(columns)
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Replace None with NaN
|
2020-02-05 07:41:47 -05:00
|
|
|
df.fillna(value=np.nan, inplace=True)
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Compute other metrics based on ticks and configuration parameters
|
|
|
|
df["clk_period"] = 1 / df["clk_freq"]
|
|
|
|
# Bandwidth is the number of bits per time
|
2020-02-12 08:20:21 -05:00
|
|
|
# in case with N generators/checkers we actually process N times more data
|
2020-04-13 12:27:16 -04:00
|
|
|
df["write_bandwidth"] = (8 * df["length"] * df["num_generators"]) / (df["generator_ticks"] * df["clk_period"])
|
|
|
|
df["read_bandwidth"] = (8 * df["length"] * df["num_checkers"]) / (df["checker_ticks"] * df["clk_period"])
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Efficiency calculated as number of write/read commands to number of cycles spent on writing/reading (ticks)
|
2020-02-12 08:20:21 -05:00
|
|
|
# for multiple generators/checkers multiply by their number
|
2020-04-13 12:27:16 -04:00
|
|
|
df["cmd_count"] = df["length"] / (df["ctrl_data_width"] / 8)
|
|
|
|
df["write_efficiency"] = df["cmd_count"] * df["num_generators"] / df["generator_ticks"]
|
|
|
|
df["read_efficiency"] = df["cmd_count"] * df["num_checkers"] / df["checker_ticks"]
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
df["write_latency"] = df[df["bist_length"] == 1]["generator_ticks"]
|
|
|
|
df["read_latency"] = df[df["bist_length"] == 1]["checker_ticks"]
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Boolean distinction between latency benchmarks and sequence benchmarks,
|
2020-02-05 07:41:47 -05:00
|
|
|
# as thier results differ significanly
|
2020-04-13 12:27:16 -04:00
|
|
|
df["is_latency"] = ~pd.isna(df["write_latency"])
|
|
|
|
assert (df["is_latency"] == ~pd.isna(df["read_latency"])).all(), \
|
|
|
|
"write_latency and read_latency should both have a value or both be NaN"
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Data formatting for text summary
|
2020-02-05 07:41:47 -05:00
|
|
|
self.text_formatters = {
|
2020-04-13 12:27:16 -04:00
|
|
|
"write_bandwidth": bandwidth_fmt,
|
|
|
|
"read_bandwidth": bandwidth_fmt,
|
|
|
|
"write_efficiency": efficiency_fmt,
|
|
|
|
"read_efficiency": efficiency_fmt,
|
|
|
|
"write_latency": clocks_fmt,
|
|
|
|
"read_latency": clocks_fmt,
|
2020-02-05 07:41:47 -05:00
|
|
|
}
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Data formatting for plot summary
|
2020-02-05 07:41:47 -05:00
|
|
|
self.plot_xticks_formatters = {
|
2020-04-13 12:27:16 -04:00
|
|
|
"write_bandwidth": FuncFormatter(lambda value, pos: bandwidth_fmt(value)),
|
|
|
|
"read_bandwidth": FuncFormatter(lambda value, pos: bandwidth_fmt(value)),
|
|
|
|
"write_efficiency": PercentFormatter(1.0),
|
|
|
|
"read_efficiency": PercentFormatter(1.0),
|
|
|
|
"write_latency": ScalarFormatter(),
|
|
|
|
"read_latency": ScalarFormatter(),
|
2020-01-31 06:57:22 -05:00
|
|
|
}
|
|
|
|
|
2020-02-14 11:17:22 -05:00
|
|
|
def df(self, ok=True, failures=False):
|
2020-04-13 12:27:16 -04:00
|
|
|
is_failure = lambda df: pd.isna(df["generator_ticks"]) | pd.isna(df["checker_ticks"]) | pd.isna(df["checker_errors"])
|
2020-02-14 11:17:22 -05:00
|
|
|
df = self._df
|
|
|
|
if not ok: # remove ok
|
|
|
|
is_ok = ~is_failure(df)
|
|
|
|
df = df[~is_ok]
|
|
|
|
if not failures: # remove failures
|
|
|
|
df = df[~is_failure(df)]
|
|
|
|
return df
|
|
|
|
|
2020-02-06 04:39:47 -05:00
|
|
|
def header(self, text):
|
2020-04-13 12:27:16 -04:00
|
|
|
return "===> {}".format(text)
|
2020-02-06 04:39:47 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
def print_df(self, title, df):
|
2020-04-13 12:27:16 -04:00
|
|
|
# Make sure all data will be shown
|
|
|
|
with pd.option_context("display.max_rows", None, "display.max_columns", None, "display.width", None):
|
|
|
|
print(self.header(title + ":"))
|
2020-02-05 07:41:47 -05:00
|
|
|
print(df)
|
|
|
|
|
2020-02-14 11:17:22 -05:00
|
|
|
def get_summary(self, df, mask=None, columns=None, column_formatting=None, sort_kwargs=None):
|
2020-04-13 12:27:16 -04:00
|
|
|
# Work on a copy
|
2020-02-14 11:17:22 -05:00
|
|
|
df = df.copy()
|
2020-02-05 07:41:47 -05:00
|
|
|
|
|
|
|
if sort_kwargs is not None:
|
|
|
|
df = df.sort_values(**sort_kwargs)
|
|
|
|
|
|
|
|
if column_formatting is not None:
|
|
|
|
for column, mapping in column_formatting.items():
|
2020-04-13 12:27:16 -04:00
|
|
|
old = "_{}".format(column)
|
|
|
|
df[old] = df[column].copy()
|
2020-02-05 07:41:47 -05:00
|
|
|
df[column] = df[column].map(lambda value: mapping(value) if not pd.isna(value) else value)
|
|
|
|
|
|
|
|
df = df[mask] if mask is not None else df
|
|
|
|
df = df[columns] if columns is not None else df
|
|
|
|
|
|
|
|
return df
|
|
|
|
|
|
|
|
def text_summary(self):
|
|
|
|
for title, df in self.groupped_results():
|
|
|
|
self.print_df(title, df)
|
|
|
|
print()
|
|
|
|
|
2020-02-13 10:10:59 -05:00
|
|
|
def html_summary(self, output_dir):
|
|
|
|
import jinja2
|
|
|
|
|
|
|
|
tables = {}
|
2020-04-13 12:27:16 -04:00
|
|
|
names = {}
|
2020-02-13 10:10:59 -05:00
|
|
|
for title, df in self.groupped_results():
|
2020-04-13 12:27:16 -04:00
|
|
|
table_id = title.lower().replace(" ", "_")
|
2020-02-13 10:10:59 -05:00
|
|
|
|
|
|
|
tables[table_id] = df.to_html(table_id=table_id, border=0)
|
2020-04-13 12:27:16 -04:00
|
|
|
names[table_id] = title
|
2020-02-13 10:10:59 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
template_dir = os.path.join(os.path.dirname(__file__), "summary")
|
|
|
|
env = jinja2.Environment(loader=jinja2.FileSystemLoader(template_dir))
|
|
|
|
template = env.get_template("summary.html.jinja2")
|
2020-02-13 10:10:59 -05:00
|
|
|
|
|
|
|
os.makedirs(output_dir, exist_ok=True)
|
2020-04-13 12:27:16 -04:00
|
|
|
with open(os.path.join(output_dir, "summary.html"), "w") as f:
|
2020-02-13 10:10:59 -05:00
|
|
|
f.write(template.render(
|
2020-04-13 12:27:16 -04:00
|
|
|
title = "LiteDRAM benchmarks summary",
|
|
|
|
tables = tables,
|
|
|
|
names = names,
|
|
|
|
script_path = get_git_file_path(__file__),
|
|
|
|
revision = get_git_revision_hash(),
|
|
|
|
revision_short = get_git_revision_hash(short=True),
|
|
|
|
generation_date = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
2020-02-13 10:10:59 -05:00
|
|
|
))
|
|
|
|
|
|
|
|
def groupped_results(self, formatters=None):
|
2020-02-14 11:17:22 -05:00
|
|
|
df = self.df()
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-02-13 10:10:59 -05:00
|
|
|
if formatters is None:
|
|
|
|
formatters = self.text_formatters
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-02-20 07:32:49 -05:00
|
|
|
common_columns = [
|
2020-04-13 12:27:16 -04:00
|
|
|
"name", "sdram_module", "sdram_memtype", "sdram_data_width",
|
|
|
|
"bist_alternating", "num_generators", "num_checkers"
|
2020-02-20 07:32:49 -05:00
|
|
|
]
|
2020-04-13 12:27:16 -04:00
|
|
|
latency_columns = ["write_latency", "read_latency"]
|
2020-02-20 07:32:49 -05:00
|
|
|
performance_columns = [
|
2020-04-13 12:27:16 -04:00
|
|
|
"write_bandwidth", "read_bandwidth", "write_efficiency", "read_efficiency"
|
2020-02-20 07:32:49 -05:00
|
|
|
]
|
|
|
|
failure_columns = [
|
2020-04-13 12:27:16 -04:00
|
|
|
"bist_length", "bist_random", "pattern_file", "length",
|
|
|
|
"generator_ticks", "checker_errors", "checker_ticks"
|
2020-02-20 07:32:49 -05:00
|
|
|
]
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
yield "Latency", self.get_summary(df,
|
|
|
|
mask = df["is_latency"] == True,
|
|
|
|
columns = common_columns + latency_columns,
|
|
|
|
column_formatting = formatters,
|
2020-02-05 07:41:47 -05:00
|
|
|
)
|
2020-04-13 12:27:16 -04:00
|
|
|
yield "Custom access pattern", self.get_summary(df,
|
|
|
|
mask = (df["is_latency"] == False) & (~pd.isna(df["pattern_file"])),
|
|
|
|
columns = common_columns + ["length", "pattern_file"] + performance_columns,
|
|
|
|
column_formatting = formatters,
|
2020-02-05 07:41:47 -05:00
|
|
|
),
|
2020-04-13 12:27:16 -04:00
|
|
|
yield "Sequential access pattern", self.get_summary(df,
|
|
|
|
mask = (df["is_latency"] == False) & (pd.isna(df["pattern_file"])) & (df["bist_random"] == False),
|
|
|
|
columns = common_columns + ["bist_length"] + performance_columns, # could be length
|
|
|
|
column_formatting = formatters,
|
2020-02-05 07:41:47 -05:00
|
|
|
),
|
2020-04-13 12:27:16 -04:00
|
|
|
yield "Random access pattern", self.get_summary(df,
|
|
|
|
mask = (df["is_latency"] == False) & (pd.isna(df["pattern_file"])) & (df["bist_random"] == True),
|
|
|
|
columns = common_columns + ["bist_length"] + performance_columns,
|
|
|
|
column_formatting = formatters,
|
2020-02-05 07:41:47 -05:00
|
|
|
),
|
2020-04-13 12:27:16 -04:00
|
|
|
yield "Failures", self.get_summary(self.df(ok=False, failures=True),
|
|
|
|
columns = common_columns + failure_columns,
|
|
|
|
column_formatting = None,
|
2020-02-14 11:17:22 -05:00
|
|
|
),
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
def plot_summary(self, plots_dir="plots", backend="Agg", theme="default", save_format="png", **savefig_kw):
|
2020-02-05 07:41:47 -05:00
|
|
|
matplotlib.use(backend)
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
plt.style.use(theme)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-02-13 10:10:59 -05:00
|
|
|
for title, df in self.groupped_results(formatters={}):
|
2020-02-05 07:41:47 -05:00
|
|
|
for column in self.plot_xticks_formatters.keys():
|
|
|
|
if column not in df.columns or df[column].empty:
|
|
|
|
continue
|
|
|
|
axis = self.plot_df(title, df, column)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
# construct path
|
|
|
|
def path_name(name):
|
2020-04-13 12:27:16 -04:00
|
|
|
return name.lower().replace(" ", "_")
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
filename = "{}.{}".format(path_name(column), save_format)
|
|
|
|
path = os.path.join(plots_dir, path_name(title), filename)
|
2020-02-05 07:41:47 -05:00
|
|
|
os.makedirs(os.path.dirname(path), exist_ok=True)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
# save figure
|
|
|
|
axis.get_figure().savefig(path, **savefig_kw)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
if backend != "Agg":
|
2020-01-31 06:57:22 -05:00
|
|
|
plt.show()
|
2020-01-30 04:49:52 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
def plot_df(self, title, df, column, fig_width=6.4, fig_min_height=2.2, save_format="png", save_filename=None):
|
2020-02-05 07:41:47 -05:00
|
|
|
if save_filename is None:
|
2020-04-13 12:27:16 -04:00
|
|
|
save_filename = os.path.join(self.plots_dir, title.lower().replace(" ", "_"))
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
axis = df.plot(kind="barh", x="name", y=column, title=title, grid=True, legend=False)
|
2020-02-07 03:45:43 -05:00
|
|
|
fig = axis.get_figure()
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
if column in self.plot_xticks_formatters:
|
|
|
|
axis.xaxis.set_major_formatter(self.plot_xticks_formatters[column])
|
|
|
|
axis.xaxis.set_tick_params(rotation=15)
|
2020-04-13 12:27:16 -04:00
|
|
|
axis.spines["top"].set_visible(False)
|
|
|
|
axis.spines["right"].set_visible(False)
|
2020-02-05 07:41:47 -05:00
|
|
|
axis.set_axisbelow(True)
|
2020-04-13 12:27:16 -04:00
|
|
|
axis.set_ylabel("") # No need for label as we have only one series
|
2020-02-07 03:45:43 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# For large number of rows, the bar labels start overlapping
|
2020-02-07 03:45:43 -05:00
|
|
|
# use fixed ratio between number of rows and height of figure
|
|
|
|
n_ok = 16
|
|
|
|
new_height = (fig_width / n_ok) * len(df)
|
|
|
|
fig.set_size_inches(fig_width, max(fig_min_height, new_height))
|
2020-02-05 07:41:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Remove empty spaces
|
2020-02-07 03:45:43 -05:00
|
|
|
fig.tight_layout()
|
2020-02-05 07:41:47 -05:00
|
|
|
|
|
|
|
return axis
|
|
|
|
|
2020-01-30 09:04:47 -05:00
|
|
|
# Run ----------------------------------------------------------------------------------------------
|
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
class RunCache(list):
|
2020-04-13 12:27:16 -04:00
|
|
|
RunData = namedtuple("RunData", ["config", "result"])
|
2020-02-05 07:41:47 -05:00
|
|
|
|
|
|
|
def dump_json(self, filename):
|
2020-04-13 12:27:16 -04:00
|
|
|
json_data = [{"config": data.config.as_dict(), "output": getattr(data.result, "_output", None) } for data in self]
|
|
|
|
with open(filename, "w") as f:
|
2020-02-05 07:41:47 -05:00
|
|
|
json.dump(json_data, f)
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def load_json(cls, filename):
|
2020-04-13 12:27:16 -04:00
|
|
|
with open(filename, "r") as f:
|
2020-02-05 07:41:47 -05:00
|
|
|
json_data = json.load(f)
|
|
|
|
loaded = []
|
|
|
|
for data in json_data:
|
2020-04-13 12:27:16 -04:00
|
|
|
config = BenchmarkConfiguration.from_dict(data["config"])
|
|
|
|
result = BenchmarkResult(data["output"]) if data["output"] is not None else None
|
2020-02-05 07:41:47 -05:00
|
|
|
loaded.append(cls.RunData(config=config, result=result))
|
|
|
|
return loaded
|
|
|
|
|
|
|
|
|
2020-02-19 07:34:32 -05:00
|
|
|
def run_python(script, args, **kwargs):
|
2020-04-13 12:27:16 -04:00
|
|
|
command = ["python3", script, *args]
|
2020-02-19 07:34:32 -05:00
|
|
|
proc = subprocess.run(command, stdout=subprocess.PIPE, cwd=os.path.dirname(script), **kwargs)
|
2020-02-03 04:37:10 -05:00
|
|
|
return str(proc.stdout)
|
2020-01-30 09:04:47 -05:00
|
|
|
|
2020-01-30 04:49:52 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
BenchmarkArgs = namedtuple("BenchmarkArgs", ["config", "output_dir", "ignore_failures", "timeout"])
|
2020-02-19 07:34:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
def run_single_benchmark(fargs):
|
2020-04-13 12:27:16 -04:00
|
|
|
# Run as separate process, because else we cannot capture all output from verilator
|
|
|
|
print(" {}: {}".format(fargs.config.name, " ".join(fargs.config.as_args())))
|
2020-02-06 04:39:47 -05:00
|
|
|
try:
|
2020-04-13 12:27:16 -04:00
|
|
|
args = fargs.config.as_args() + ["--output-dir", fargs.output_dir, "--log-level", "warning"]
|
2020-02-19 07:34:32 -05:00
|
|
|
output = run_python(benchmark.__file__, args, timeout=fargs.timeout)
|
2020-02-06 04:39:47 -05:00
|
|
|
result = BenchmarkResult(output)
|
2020-04-13 12:27:16 -04:00
|
|
|
# Exit if checker had any read error
|
2020-02-06 04:39:47 -05:00
|
|
|
if result.checker_errors != 0:
|
2020-04-13 12:27:16 -04:00
|
|
|
raise RuntimeError("Error during benchmark: checker_errors = {}, args = {}".format(
|
2020-02-19 07:34:32 -05:00
|
|
|
result.checker_errors, fargs.config.as_args()
|
2020-02-06 04:39:47 -05:00
|
|
|
))
|
|
|
|
except Exception as e:
|
2020-02-19 07:34:32 -05:00
|
|
|
if fargs.ignore_failures:
|
2020-04-13 12:27:16 -04:00
|
|
|
print(" {}: ERROR: {}".format(fargs.config.name, e))
|
2020-02-06 04:39:47 -05:00
|
|
|
return None
|
|
|
|
else:
|
|
|
|
raise
|
2020-04-13 12:27:16 -04:00
|
|
|
print(" {}: ok".format(fargs.config.name))
|
2020-02-05 07:41:47 -05:00
|
|
|
return result
|
2020-01-31 08:16:39 -05:00
|
|
|
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
InQueueItem = namedtuple("InQueueItem", ["index", "config"])
|
|
|
|
OutQueueItem = namedtuple("OutQueueItem", ["index", "result"])
|
2020-02-13 04:23:32 -05:00
|
|
|
|
|
|
|
|
2020-02-19 07:34:32 -05:00
|
|
|
def run_parallel(configurations, output_base_dir, njobs, ignore_failures, timeout):
|
2020-02-13 04:23:32 -05:00
|
|
|
from multiprocessing import Process, Queue
|
|
|
|
import queue
|
|
|
|
|
|
|
|
def worker(in_queue, out_queue, out_dir):
|
|
|
|
while True:
|
|
|
|
in_item = in_queue.get()
|
|
|
|
if in_item is None:
|
|
|
|
return
|
2020-04-13 12:27:16 -04:00
|
|
|
fargs = BenchmarkArgs(in_item.config, out_dir, ignore_failures, timeout)
|
2020-02-19 07:34:32 -05:00
|
|
|
result = run_single_benchmark(fargs)
|
2020-02-13 04:23:32 -05:00
|
|
|
out_queue.put(OutQueueItem(in_item.index, result))
|
|
|
|
|
|
|
|
if njobs == 0:
|
|
|
|
njobs = os.cpu_count()
|
2020-04-13 12:27:16 -04:00
|
|
|
print("Using {:d} parallel jobs".format(njobs))
|
2020-02-13 04:23:32 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Use one directory per worker, as running each benchmark in separate directory
|
2020-02-13 04:23:32 -05:00
|
|
|
# takes too much disk space (~2GB per 100 benchmarks)
|
2020-04-13 12:27:16 -04:00
|
|
|
dir_pool = [os.path.join(output_base_dir, "worker_%02d" % i) for i in range(njobs)]
|
2020-02-13 04:23:32 -05:00
|
|
|
|
|
|
|
in_queue, out_queue = Queue(), Queue()
|
|
|
|
workers = [Process(target=worker, args=(in_queue, out_queue, dir)) for dir in dir_pool]
|
|
|
|
for w in workers:
|
|
|
|
w.start()
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Put all benchmark configurations with index to retrieve them in order
|
2020-02-13 04:23:32 -05:00
|
|
|
for i, config in enumerate(configurations):
|
|
|
|
in_queue.put(InQueueItem(i, config))
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Send "finish signal" for each worker
|
2020-02-13 04:23:32 -05:00
|
|
|
for _ in workers:
|
|
|
|
in_queue.put(None)
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Retrieve results in proper order
|
2020-02-13 04:23:32 -05:00
|
|
|
out_items = [out_queue.get() for _ in configurations]
|
2020-04-13 12:27:16 -04:00
|
|
|
results = [out.result for out in sorted(out_items, key=lambda o: o.index)]
|
2020-02-13 04:23:32 -05:00
|
|
|
|
|
|
|
for p in workers:
|
|
|
|
p.join()
|
|
|
|
|
|
|
|
return results
|
|
|
|
|
|
|
|
|
2020-02-19 07:34:32 -05:00
|
|
|
def run_benchmarks(configurations, output_base_dir, njobs, ignore_failures, timeout):
|
2020-04-13 12:27:16 -04:00
|
|
|
print("Running {:d} benchmarks ...".format(len(configurations)))
|
2020-02-06 04:39:47 -05:00
|
|
|
if njobs == 1:
|
2020-02-19 07:34:32 -05:00
|
|
|
results = [run_single_benchmark(BenchmarkArgs(config, output_base_dir, ignore_failures, timeout))
|
|
|
|
for config in configurations]
|
2020-02-06 04:39:47 -05:00
|
|
|
else:
|
2020-02-19 07:34:32 -05:00
|
|
|
results = run_parallel(configurations, output_base_dir, njobs, ignore_failures, timeout)
|
2020-02-06 04:39:47 -05:00
|
|
|
run_data = [RunCache.RunData(config, result) for config, result in zip(configurations, results)]
|
|
|
|
return run_data
|
|
|
|
|
|
|
|
|
2020-01-31 06:57:22 -05:00
|
|
|
def main(argv=None):
|
2020-04-13 12:27:16 -04:00
|
|
|
parser = argparse.ArgumentParser(description="Run LiteDRAM benchmarks and collect the results.")
|
2020-02-03 04:38:10 -05:00
|
|
|
parser.add_argument("config", help="YAML config file")
|
2020-04-13 12:27:16 -04:00
|
|
|
parser.add_argument("--names", nargs="*", help="Limit benchmarks to given names")
|
|
|
|
parser.add_argument("--regex", help="Limit benchmarks to names matching the regex")
|
|
|
|
parser.add_argument("--not-regex", help="Limit benchmarks to names not matching the regex")
|
|
|
|
parser.add_argument("--html", action="store_true", help="Generate HTML summary")
|
|
|
|
parser.add_argument("--html-output-dir", default="html", help="Output directory for generated HTML")
|
|
|
|
parser.add_argument("--plot", action="store_true", help="Generate plots with results summary")
|
|
|
|
parser.add_argument("--plot-format", default="png", help="Specify plots file format (default=png)")
|
|
|
|
parser.add_argument("--plot-backend", default="Agg", help="Optionally specify matplotlib GUI backend")
|
|
|
|
parser.add_argument("--plot-transparent", action="store_true", help="Use transparent background when saving plots")
|
|
|
|
parser.add_argument("--plot-output-dir", default="plots", help="Specify where to save the plots")
|
|
|
|
parser.add_argument("--plot-theme", default="default", help="Use different matplotlib theme")
|
|
|
|
parser.add_argument("--fail-fast", action="store_true", help="Exit on any benchmark error, do not continue")
|
|
|
|
parser.add_argument("--output-dir", default="build", help="Directory to store benchmark build output")
|
|
|
|
parser.add_argument("--njobs", default=0, type=int, help="Use N parallel jobs to run benchmarks (default=0, which uses CPU count)")
|
|
|
|
parser.add_argument("--heartbeat", default=0, type=int, help="Print heartbeat message with given interval (default=0 => never)")
|
|
|
|
parser.add_argument("--timeout", default=None, help="Set timeout for a single benchmark")
|
|
|
|
parser.add_argument("--results-cache", help="""Use given JSON file as results cache. If the file exists,
|
2020-02-03 06:13:16 -05:00
|
|
|
it will be loaded instead of running actual benchmarks,
|
|
|
|
else benchmarks will be run normally, and then saved
|
|
|
|
to the given file. This allows to easily rerun the script
|
|
|
|
to generate different summary without having to rerun benchmarks.""")
|
2020-01-31 06:57:22 -05:00
|
|
|
args = parser.parse_args(argv)
|
2020-01-30 09:04:47 -05:00
|
|
|
|
2020-02-05 07:41:47 -05:00
|
|
|
if not args.results_cache and not _summary:
|
2020-04-13 12:27:16 -04:00
|
|
|
print("Summary not available and not running with --results-cache - run would not produce any results! Aborting.",
|
2020-02-05 07:41:47 -05:00
|
|
|
file=sys.stderr)
|
|
|
|
sys.exit(1)
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Load and filter configurations
|
2020-02-03 04:38:10 -05:00
|
|
|
configurations = BenchmarkConfiguration.load_yaml(args.config)
|
2020-02-05 06:38:05 -05:00
|
|
|
filters = {
|
2020-04-13 12:27:16 -04:00
|
|
|
"regex": lambda config: re.search(args.regex, config.name),
|
|
|
|
"not_regex": lambda config: not re.search(args.not_regex, config.name),
|
|
|
|
"names": lambda config: config.name in args.names,
|
2020-02-05 06:38:05 -05:00
|
|
|
}
|
|
|
|
for arg, f in filters.items():
|
|
|
|
if getattr(args, arg):
|
|
|
|
configurations = filter(f, configurations)
|
|
|
|
configurations = list(configurations)
|
2020-01-30 09:04:47 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Load outputs from cache if it exsits
|
2020-02-05 07:41:47 -05:00
|
|
|
cache_exists = args.results_cache and os.path.isfile(args.results_cache)
|
2020-02-03 06:13:16 -05:00
|
|
|
if args.results_cache and cache_exists:
|
2020-02-05 07:41:47 -05:00
|
|
|
cache = RunCache.load_json(args.results_cache)
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Take only those that match configurations
|
2020-02-05 07:41:47 -05:00
|
|
|
names_to_load = [c.name for c in configurations]
|
|
|
|
run_data = [data for data in cache if data.config.name in names_to_load]
|
2020-04-13 12:27:16 -04:00
|
|
|
else: # Run all the benchmarks normally
|
2020-02-19 04:35:46 -05:00
|
|
|
if args.heartbeat:
|
2020-04-13 12:27:16 -04:00
|
|
|
heartbeat_cmd = ["/bin/sh", "-c", "while true; do sleep %d; echo Heartbeat...; done" % args.heartbeat]
|
2020-02-19 04:35:46 -05:00
|
|
|
heartbeat = subprocess.Popen(heartbeat_cmd)
|
2020-02-19 07:34:32 -05:00
|
|
|
if args.timeout is not None:
|
|
|
|
args.timeout = int(args.timeout)
|
|
|
|
run_data = run_benchmarks(configurations, args.output_dir, args.njobs, not args.fail_fast, args.timeout)
|
2020-02-19 04:35:46 -05:00
|
|
|
if args.heartbeat:
|
|
|
|
heartbeat.kill()
|
2020-01-31 08:16:39 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Store outputs in cache
|
2020-02-03 06:13:16 -05:00
|
|
|
if args.results_cache and not cache_exists:
|
2020-02-05 07:41:47 -05:00
|
|
|
cache = RunCache(run_data)
|
|
|
|
cache.dump_json(args.results_cache)
|
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Display summary
|
2020-02-05 07:41:47 -05:00
|
|
|
if _summary:
|
|
|
|
summary = ResultsSummary(run_data)
|
|
|
|
summary.text_summary()
|
2020-02-13 10:10:59 -05:00
|
|
|
if args.html:
|
|
|
|
summary.html_summary(args.html_output_dir)
|
2020-02-05 07:41:47 -05:00
|
|
|
if args.plot:
|
|
|
|
summary.plot_summary(
|
|
|
|
plots_dir=args.plot_output_dir,
|
|
|
|
backend=args.plot_backend,
|
|
|
|
theme=args.plot_theme,
|
|
|
|
save_format=args.plot_format,
|
|
|
|
transparent=args.plot_transparent,
|
|
|
|
)
|
2020-01-31 06:57:22 -05:00
|
|
|
|
2020-04-13 12:27:16 -04:00
|
|
|
# Exit with error when there is no single benchmark that succeeded
|
2020-03-12 08:47:23 -04:00
|
|
|
succeeded = sum(1 if d.result is not None else 0 for d in run_data)
|
|
|
|
if succeeded == 0:
|
|
|
|
sys.exit(1)
|
2020-01-29 11:03:20 -05:00
|
|
|
|
2020-01-30 04:02:49 -05:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|