Skip to content

Commit 8ab7bed

Browse files
committed
Support custom installed path for get,geekbench
1 parent 83371f8 commit 8ab7bed

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

script/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MLCommons Automation Scripts
22

3-
*Last updated: 2026-03-20 04:08:41*
3+
*Last updated: 2026-03-20 16:46:03*
44

55
This directory contains automation scripts for MLPerf benchmarks, AI/ML workflows, and development operations.
66

script/get-geekbench/customize.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def preprocess(i):
3232
package_name = f"Geekbench-{need_version}-WindowsSetup.exe"
3333
env['MLC_GEEKBENCH_NEED_EXTRACT'] = 'no'
3434
elif os_info['platform'] == 'linux':
35+
if env.get('MLC_GEEKBENCH_INSTALLED_PATH', '') != '':
36+
build_path = os.path.join(env['MLC_GEEKBENCH_INSTALLED_PATH'], f"build.{host_os_machine}")
37+
if os.path.exists(build_path):
38+
env['MLC_GEEKBENCH_INSTALLED_PATH'] = build_path
3539
if host_os_machine in ('aarch64', 'arm64'):
3640
arch_suffix = 'LinuxARMPreview'
3741
else:
@@ -84,13 +88,13 @@ def postprocess(i):
8488
# Windows: run.bat ran the installer and exported paths via tmp-run-env.out
8589
# MLC_GEEKBENCH_BIN_WITH_PATH is set from tmp-run-env.out
8690
geekbench_bin = env.get('MLC_GEEKBENCH_BIN_WITH_PATH', '')
87-
install_dir = env.get('MLC_GEEKBENCH_WINDOWS_INSTALL_DIR', '')
91+
install_dir = env.get('MLC_GEEKBENCH_INSTALLED_PATH', '')
8892

8993
if geekbench_bin == '' or not os.path.isfile(geekbench_bin):
9094
# Fallback: try to find in the install dir
9195
if install_dir and os.path.isdir(install_dir):
9296
for f in os.listdir(install_dir):
93-
if f.lower().startswith('geekbench6') and f.lower().endswith('.exe'):
97+
if f.lower().startswith(f'geekbench{env["MLC_GEEKBENCH_VERSION_MAJOR"]}') and f.lower().endswith('.exe'):
9498
geekbench_bin = os.path.join(install_dir, f)
9599
break
96100

@@ -103,24 +107,23 @@ def postprocess(i):
103107

104108
else:
105109
# Linux / macOS: extracted archive
106-
extracted_path = env.get('MLC_GEEKBENCH_EXTRACTED_PATH', '')
107-
if extracted_path == '':
110+
geekbench_dir = env.get('MLC_GEEKBENCH_INSTALLED_PATH', env.get('MLC_GEEKBENCH_EXTRACTED_PATH', ''))
111+
if geekbench_dir == '' and env.get('MLC_GEEKBENCH_INSTALLED_PATH', '') == '':
108112
return {'return': 1,
109113
'error': 'MLC_GEEKBENCH_EXTRACTED_PATH not set - download-and-extract may have failed'}
110114

111115
# Find the Geekbench directory inside the extracted path
112-
geekbench_dir = extracted_path
113-
if os.path.isdir(extracted_path):
114-
for d in sorted(os.listdir(extracted_path)):
115-
full = os.path.join(extracted_path, d)
116+
if os.path.isdir(geekbench_dir):
117+
for d in sorted(os.listdir(geekbench_dir)):
118+
full = os.path.join(geekbench_dir, d)
116119
if os.path.isdir(full) and d.lower().startswith('geekbench'):
117120
geekbench_dir = full
118121
break
119122

120123
if os_info['platform'] == 'darwin':
121124
# macOS: binary is inside the .app bundle
122125
# e.g. Geekbench 6.app/Contents/MacOS/Geekbench 6
123-
app_pattern = os.path.join(extracted_path, 'Geekbench*.app')
126+
app_pattern = os.path.join(geekbench_dir, 'Geekbench*.app')
124127
app_matches = glob.glob(app_pattern)
125128
if app_matches:
126129
app_dir = app_matches[0]
@@ -147,6 +150,9 @@ def postprocess(i):
147150
if os.path.isfile(geekbench_bin):
148151
os.chmod(geekbench_bin, 0o755)
149152

153+
if not os.path.exists(geekbench_dir):
154+
return {'return': 1, 'error': f'{geekbench_dir} is not existing'}
155+
150156
env['MLC_GEEKBENCH_BIN_WITH_PATH'] = geekbench_bin
151157
env['MLC_GEEKBENCH_INSTALLED_PATH'] = geekbench_dir
152158
env['MLC_GEEKBENCH_VERSION'] = need_version

script/get-geekbench/meta.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ prehook_deps:
2121
- enable_if_env:
2222
MLC_GEEKBENCH_NEED_EXTRACT:
2323
- 'yes'
24+
skip_if_env:
25+
MLC_GEEKBENCH_INSTALLED_PATH:
26+
- on
2427
env:
2528
MLC_DAE_EXTRACT_DOWNLOADED: 'yes'
2629
MLC_DOWNLOAD_FINAL_ENV_NAME: MLC_GEEKBENCH_DOWNLOAD_PATH
@@ -37,6 +40,9 @@ prehook_deps:
3740
- enable_if_env:
3841
MLC_GEEKBENCH_NEED_EXTRACT:
3942
- 'no'
43+
skip_if_env:
44+
MLC_GEEKBENCH_INSTALLED_PATH:
45+
- on
4046
env:
4147
MLC_DOWNLOAD_FINAL_ENV_NAME: MLC_GEEKBENCH_DOWNLOAD_PATH
4248
extra_cache_tags: geekbench
@@ -65,3 +71,8 @@ versions:
6571
6.6.0:
6672
env:
6773
MLC_GEEKBENCH_VERSION_MAJOR: '6'
74+
variations:
75+
path.#:
76+
env:
77+
MLC_GEEKBENCH_INSTALLED_PATH: '#'
78+
default_version: ''

script/get-geekbench/run.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@
44
# Download and extraction is handled by the download-and-extract prehook dependency.
55
# Path setup is handled in postprocess() of customize.py.
66

7-
echo "Geekbench download and extraction completed via download-and-extract dependency."

0 commit comments

Comments
 (0)