Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions devops/scripts/benchmarks/benches/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from utils.result import BenchmarkMetadata, BenchmarkTag, Result
from options import options
from utils.utils import download, run
from abc import ABC, abstractmethod

benchmark_tags = [
BenchmarkTag("SYCL", "Benchmark uses SYCL runtime"),
Expand All @@ -34,11 +35,27 @@
benchmark_tags_dict = {tag.name: tag for tag in benchmark_tags}


class Benchmark:
class Benchmark(ABC):
def __init__(self, directory, suite):
self.directory = directory
self.suite = suite

@abstractmethod
def name(self) -> str:
pass

@abstractmethod
def setup(self):
pass

@abstractmethod
def teardown(self):
pass

@abstractmethod
def run(self, env_vars) -> list[Result]:
pass

@staticmethod
def get_adapter_full_path():
for libs_dir_name in ["lib", "lib64"]:
Expand Down Expand Up @@ -99,24 +116,12 @@ def download(
def lower_is_better(self):
return True

def setup(self):
raise NotImplementedError()

def run(self, env_vars) -> list[Result]:
raise NotImplementedError()

def teardown(self):
raise NotImplementedError()

def stddev_threshold(self):
return None

def get_suite_name(self) -> str:
return self.suite.name()

def name(self):
raise NotImplementedError()

def description(self):
return ""

Expand Down Expand Up @@ -146,12 +151,14 @@ def get_metadata(self) -> BenchmarkMetadata:
)


class Suite:
class Suite(ABC):
@abstractmethod
def benchmarks(self) -> list[Benchmark]:
raise NotImplementedError()
pass

@abstractmethod
def name(self) -> str:
raise NotImplementedError()
pass

def setup(self):
return
Expand Down