Skip to content

Commit cf90cb1

Browse files
authored
Merge pull request #2146 from lslusarczyk/bench_no_recompile_ur
Compute-benchmarks use already compiled UR
2 parents a1b9fa7 + bf46d7f commit cf90cb1

File tree

5 files changed

+37
-14
lines changed

5 files changed

+37
-14
lines changed

.github/workflows/benchmarks_compute.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,20 +152,31 @@ jobs:
152152
run: cmake --build ${{github.workspace}}/sycl_build -j
153153

154154
- name: Configure UR
155-
working-directory: ${{github.workspace}}/ur-repo
156155
run: >
157156
cmake -DCMAKE_BUILD_TYPE=Release
158-
-B${{github.workspace}}/ur-repo/build
157+
-S${{github.workspace}}/ur-repo
158+
-B${{github.workspace}}/ur_build
159+
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/ur_install
159160
-DUR_BUILD_TESTS=OFF
160161
-DUR_BUILD_ADAPTER_L0=ON
161162
-DUR_BUILD_ADAPTER_L0_V2=ON
163+
-DUMF_DISABLE_HWLOC=ON
162164
163165
- name: Build UR
164-
run: cmake --build ${{github.workspace}}/ur-repo/build -j $(nproc)
166+
run: cmake --build ${{github.workspace}}/ur_build -j $(nproc)
167+
168+
- name: Install UR
169+
run: cmake --install ${{github.workspace}}/ur_build
165170

166171
- name: Run benchmarks
167172
id: benchmarks
168-
run: numactl -N 0 ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py ~/bench_workdir ${{github.workspace}}/sycl_build ${{github.workspace}}/ur-repo ${{ matrix.adapter.str_name }} ${{ inputs.bench_script_params }}
173+
run: >
174+
numactl -N 0 ${{ github.workspace }}/ur-repo/scripts/benchmarks/main.py
175+
~/bench_workdir
176+
${{github.workspace}}/sycl_build
177+
${{github.workspace}}/ur_install
178+
${{ matrix.adapter.str_name }}
179+
${{ inputs.bench_script_params }}
169180
170181
- name: Add comment to PR
171182
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

scripts/benchmarks/benches/base.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,27 @@
1515
class Benchmark:
1616
def __init__(self, directory):
1717
self.directory = directory
18-
self.adapter_path = os.path.join(options.ur_dir, 'build', 'lib', f"libur_adapter_{options.ur_adapter_name}.so")
18+
19+
@staticmethod
20+
def get_adapter_full_path():
21+
for libs_dir_name in ['lib', 'lib64']:
22+
adapter_path = os.path.join(
23+
options.ur_dir, libs_dir_name, f"libur_adapter_{options.ur_adapter_name}.so")
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)"
1928

2029
def run_bench(self, command, env_vars):
2130
env_vars_with_forced_adapter = env_vars.copy()
22-
env_vars_with_forced_adapter.update({'UR_ADAPTERS_FORCE_LOAD': self.adapter_path})
23-
return run(command=command, env_vars=env_vars_with_forced_adapter, add_sycl=True, cwd=options.benchmark_cwd).stdout.decode()
31+
env_vars_with_forced_adapter.update(
32+
{'UR_ADAPTERS_FORCE_LOAD': Benchmark.get_adapter_full_path()})
33+
return run(
34+
command=command,
35+
env_vars=env_vars_with_forced_adapter,
36+
add_sycl=True,
37+
cwd=options.benchmark_cwd
38+
).stdout.decode()
2439

2540
def create_data_path(self, name):
2641
data_path = os.path.join(self.directory, "data", name)

scripts/benchmarks/benches/compute.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ 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:
2221
return
2322

24-
repo_path = git_clone(self.directory, "compute-benchmarks-repo", "https://github.com/intel/compute-benchmarks.git", "08c41bb8bc1762ad53c6194df6d36bfcceff4aa2")
23+
repo_path = git_clone(self.directory, "compute-benchmarks-repo", "https://github.com/intel/compute-benchmarks.git", "f6882552215736f90295244046fcb6e17fe53e83")
2524
build_path = create_build_path(self.directory, 'compute-benchmarks-build')
2625

2726
configure_command = [
@@ -33,10 +32,7 @@ def setup(self):
3332
f"-DSYCL_COMPILER_ROOT={options.sycl}",
3433
f"-DALLOW_WARNINGS=ON",
3534
f"-DBUILD_UR=ON",
36-
f"-DUR_BUILD_TESTS=OFF",
37-
f"-DUR_BUILD_TESTS=OFF",
38-
f"-DUMF_DISABLE_HWLOC=ON",
39-
f"-DBENCHMARK_UR_SOURCE_DIR={options.ur_dir}",
35+
f"-Dunified-runtime_DIR={options.ur_dir}/lib/cmake/unified-runtime",
4036
]
4137
run(configure_command, add_sycl=True)
4238

scripts/benchmarks/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def validate_and_parse_env_args(env_args):
177177
parser = argparse.ArgumentParser(description='Unified Runtime Benchmark Runner')
178178
parser.add_argument('benchmark_directory', type=str, help='Working directory to setup benchmarks.')
179179
parser.add_argument('sycl', type=str, help='Root directory of the SYCL compiler.')
180-
parser.add_argument('ur_dir', type=str, help='Root directory of the UR.')
180+
parser.add_argument('ur_dir', type=str, help='UR install prefix path')
181181
parser.add_argument('ur_adapter_name', type=str, help='Options to build the Unified Runtime as part of the benchmark')
182182
parser.add_argument("--no-rebuild", help='Rebuild the benchmarks from scratch.', action="store_true")
183183
parser.add_argument("--env", type=str, help='Use env variable for a benchmark run.', action="append", default=[])

scripts/benchmarks/utils/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ def git_clone(dir, name, repo, commit):
4242

4343
if os.path.isdir(repo_path) and os.path.isdir(os.path.join(repo_path, '.git')):
4444
run("git fetch", cwd=repo_path)
45+
run("git reset --hard", cwd=repo_path)
4546
run(f"git checkout {commit}", cwd=repo_path)
4647
elif not os.path.exists(repo_path):
4748
run(f"git clone --recursive {repo} {repo_path}")

0 commit comments

Comments
 (0)