Skip to content

Commit 7488aa7

Browse files
committed
add get_adapter_full_path
1 parent 40f52fc commit 7488aa7

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

scripts/benchmarks/benches/base.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import os
77
import shutil
88
from pathlib import Path
9-
import subprocess # nosec B404
109
from .result import Result
1110
from .options import options
1211
from utils.utils import run
@@ -16,18 +15,21 @@
1615
class Benchmark:
1716
def __init__(self, directory):
1817
self.directory = directory
18+
19+
@staticmethod
20+
def get_adapter_full_path():
1921
for libs_dir_name in ['lib', 'lib64']:
20-
self.adapter_path = os.path.join(
22+
adapter_path = os.path.join(
2123
options.ur_dir, libs_dir_name, f"libur_adapter_{options.ur_adapter_name}.so")
22-
if os.path.isfile(self.adapter_path):
23-
print(f"using adapter {self.adapter_path}")
24-
return
25-
assert os.path.isfile(self.adapter_path), \
26-
f"could not find adapter file {self.adapter_path} (and in similar lib paths)"
24+
if os.path.isfile(adapter_path):
25+
return adapter_path
26+
assert False, \
27+
f"could not find adapter file {adapter_path} (and in similar lib paths)"
2728

2829
def run_bench(self, command, env_vars):
2930
env_vars_with_forced_adapter = env_vars.copy()
30-
env_vars_with_forced_adapter.update({'UR_ADAPTERS_FORCE_LOAD': self.adapter_path})
31+
env_vars_with_forced_adapter.update(
32+
{'UR_ADAPTERS_FORCE_LOAD': Benchmark.get_adapter_full_path()})
3133
return run(
3234
command=command,
3335
env_vars=env_vars_with_forced_adapter,

scripts/benchmarks/benches/compute.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ class ComputeBench:
1515
def __init__(self, directory):
1616
self.directory = directory
1717
self.built = False
18-
return
1918

2019
def setup(self):
2120
if self.built:

0 commit comments

Comments
 (0)