Skip to content

Commit

Permalink
Reduce extra build number
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed May 19, 2023
1 parent d248699 commit 40ee8e7
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions benchmarks/scripts/cub/bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,17 @@ class BenchCache:
def __new__(cls, *args, **kwargs):
if cls._instance is None:
cls._instance = super().__new__(cls, *args, **kwargs)
cls._instance.existing_tables = set()

config = Config()
bench_axes = {}

for algorithm_name in config.benchmarks:
bench = BaseBench(algorithm_name)
return cls._instance


if not bench.build():
raise Exception("Unable to build base benchmark: " + bench)
def create_table_if_not_exists(self, conn, bench):
bench_base = bench.get_base()
if bench_base.algorithm_name() not in self.existing_tables:
create_benches_tables(conn, {bench_base.algorithm_name(): bench_base.axes_names()})
self.existing_tables.add(bench_base.algorithm_name())

bench_axes[algorithm_name] = bench.axes_names()

create_benches_tables(Storage().connection(), bench_axes)
return cls._instance

def push_bench(self, bench, workload_point, elapsed, distribution_samples, distribution_center):
config = Config()
Expand All @@ -192,6 +189,8 @@ def push_bench(self, bench, workload_point, elapsed, distribution_samples, distr
gpu = get_device_name(device_json(bench.algname))
conn = Storage().connection()

self.create_table_if_not_exists(conn, bench)

columns = ""
placeholders = ""
values = []
Expand Down Expand Up @@ -223,6 +222,8 @@ def pull_column(self, column, bench, workload_point):
gpu = get_device_name(device_json(bench.algname))
conn = Storage().connection()

self.create_table_if_not_exists(conn, bench)

with conn:
point_checks = ""
if workload_point:
Expand Down

0 comments on commit 40ee8e7

Please sign in to comment.