Skip to content

Commit

Permalink
Pre-build to avoid variant re-builds
Browse files Browse the repository at this point in the history
  • Loading branch information
gevtushenko committed May 2, 2023
1 parent 9d78e49 commit b1dae29
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
12 changes: 2 additions & 10 deletions benchmarks/scripts/cub/bench/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ def axis_values(self, axis_name):
return []

def build(self):
if not self.is_base():
self.get_base().build()
build = CMake().build(self)
return build.code == 0

Expand Down Expand Up @@ -436,9 +438,6 @@ def rt_workload_space(self, sub_space):
return list(itertools.product(*self.axes_values(sub_space, False)))

def elapsed(self, workload_point, estimator):
if not self.build():
return float('inf')

self.run(workload_point, estimator)

cache = BenchCache()
Expand All @@ -449,13 +448,9 @@ def elapsed(self, workload_point, estimator):

return float('inf')


def run(self, workload_point, estimator):
logger = Logger()

if not self.build():
return float('inf')

cache = BenchCache()
cached_center = cache.pull_center(self, workload_point)

Expand Down Expand Up @@ -487,9 +482,6 @@ def speedup(self, workload_point, base_estimator, variant_estimator):
return base_center / self_center

def score(self, ct_workload, rt_workload_space, base_estimator, variant_estimator):
if not self.build():
return float('-inf')

if self.is_base():
return 1.0

Expand Down
11 changes: 6 additions & 5 deletions benchmarks/scripts/cub/bench/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ def __call__(self, algname, ct_workload_space, rt_workload_space):
for ct_workload in ct_workload_space:
for variant in variants:
bench = Bench(algname, variant, list(ct_workload))
score = bench.score(ct_workload,
rt_workload_space,
self.base_center_estimator,
self.variant_center_estimator)
if bench.build():
score = bench.score(ct_workload,
rt_workload_space,
self.base_center_estimator,
self.variant_center_estimator)

print(bench.label(), score)
print(bench.label(), score)

0 comments on commit b1dae29

Please sign in to comment.