From b1dae295f2bc756684d34b05b44f55e759be23a2 Mon Sep 17 00:00:00 2001 From: Georgy Evtushenko Date: Tue, 2 May 2023 22:11:10 +0400 Subject: [PATCH] Pre-build to avoid variant re-builds --- benchmarks/scripts/cub/bench/bench.py | 12 ++---------- benchmarks/scripts/cub/bench/search.py | 11 ++++++----- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/benchmarks/scripts/cub/bench/bench.py b/benchmarks/scripts/cub/bench/bench.py index ab4da16a8..25c82c8a4 100644 --- a/benchmarks/scripts/cub/bench/bench.py +++ b/benchmarks/scripts/cub/bench/bench.py @@ -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 @@ -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() @@ -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) @@ -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 diff --git a/benchmarks/scripts/cub/bench/search.py b/benchmarks/scripts/cub/bench/search.py index 8cecb11a5..57b04cefc 100644 --- a/benchmarks/scripts/cub/bench/search.py +++ b/benchmarks/scripts/cub/bench/search.py @@ -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)