Skip to content

Commit

Permalink
[Automated Commit] Format Codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
mlcommons-bot committed Nov 24, 2024
1 parent 1ad4bca commit 8ea6129
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 15 deletions.
6 changes: 4 additions & 2 deletions automation/script/module_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,12 +1251,14 @@ def regenerate_script_cmd(i):
# Cleanup from env everything that has a host path value
if i_run_cmd.get('env'):
for key in list(i_run_cmd.get('env')):
if isinstance(i_run_cmd['env'][key], str) and ((os.path.join("local", "cache", "") in i_run_cmd['env'][key]) or (os.path.join("CM", "repos", "") in i_run_cmd['env'][key])):
if isinstance(i_run_cmd['env'][key], str) and ((os.path.join("local", "cache", "") in i_run_cmd['env'][key]) or (
os.path.join("CM", "repos", "") in i_run_cmd['env'][key])):
del (i_run_cmd['env'][key])
elif isinstance(i_run_cmd['env'][key], list):
values_to_remove = []
for val in i_run_cmd['env'][key]:
if isinstance(val, str) and ((os.path.join("local", "cache", "") in val) or (os.path.join("CM", "repos", "") in val)):
if isinstance(val, str) and ((os.path.join("local", "cache", "") in val) or (
os.path.join("CM", "repos", "") in val)):
values_to_remove.append(val)
if values_to_remove == i_run_cmd['env'][key]:
del (i_run_cmd['env'][key])
Expand Down
18 changes: 10 additions & 8 deletions script/get-generic-sys-util/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def preprocess(i):
if util == "libffi":
if env.get("CM_HOST_OS_FLAVOR", "") == "ubuntu":
if env.get("CM_HOST_OS_VERSION", "") in [
"20.04", "20.10", "21.04", "21.10"]:
"20.04", "20.10", "21.04", "21.10"]:
package_name = "libffi7"
else:
package_name = "libffi8"
Expand All @@ -87,10 +87,11 @@ def preprocess(i):
for tmp_value in tmp_values:
if tmp_value not in env:
return {'return': 1,
'error': 'variable {} is not in env'.format(tmp_value)}
'error': 'variable {} is not in env'.format(tmp_value)}
if tmp_value in env:
if isinstance(package_name, str):
package_name = package_name.replace("<<<" + tmp_value + ">>>", str(env[tmp_value]))
package_name = package_name.replace(
"<<<" + tmp_value + ">>>", str(env[tmp_value]))

install_cmd = env.get('CM_HOST_OS_PACKAGE_MANAGER_INSTALL_CMD')
if not install_cmd:
Expand All @@ -111,7 +112,7 @@ def preprocess(i):
env['+PATH'] = ["/opt/rh/gcc-toolset-12/root/usr/bin"]

if env['CM_SYS_UTIL_NAME'] == "numactl" and env['CM_HOST_OS_VERSION'] in [
"9.1", "9.2", "9.3"]:
"9.1", "9.2", "9.3"]:
env['CM_SYS_UTIL_INSTALL_CMD'] = ''

if env.get('CM_SYS_UTIL_CHECK_CMD',
Expand Down Expand Up @@ -156,9 +157,10 @@ def postprocess(i):
'CM_TMP_GENERIC_SYS_UTIL_PACKAGE_INSTALL_IGNORED', '')).lower() not in ["yes", "1", "true"] and env.get('CM_GET_GENERIC_SYS_UTIL_INSTALL_FAILED', '') != 'yes':
automation = i['automation']

r = automation.run_native_script({'run_script_input': i['run_script_input'], 'env': env, 'script_name': 'detect'})
r = automation.run_native_script(
{'run_script_input': i['run_script_input'], 'env': env, 'script_name': 'detect'})
if r['return'] > 0 and str(env.get(
'CM_GENERIC_SYS_UTIL_IGNORE_VERSION_DETECTION_FAILURE', '')).lower() not in ["1", "yes", "true"]:
'CM_GENERIC_SYS_UTIL_IGNORE_VERSION_DETECTION_FAILURE', '')).lower() not in ["1", "yes", "true"]:
return {'return': 1, 'error': 'Version detection failed after installation. Please check the provided version command or use env.CM_GENERIC_SYS_UTIL_IGNORE_VERSION_DETECTION_FAILURE=yes to ignore the error.'}

elif r['return'] == 0:
Expand All @@ -172,8 +174,8 @@ def postprocess(i):
env[version_env_key] = version

# Not used now
env['CM_GENERIC_SYS_UTIL_' + env['CM_SYS_UTIL_NAME'].upper() + \
'_CACHE_TAGS'] = 'version-' + version
env['CM_GENERIC_SYS_UTIL_' + env['CM_SYS_UTIL_NAME'].upper() +
'_CACHE_TAGS'] = 'version-' + version

if env.get(version_env_key, '') == '':
env[version_env_key] = "undetected"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
os.path.join(
Path(__file__).parent.parent.resolve(),
"script"))
import check as checks # noqa
import check as checks # noqa

r = cm.access({'action': 'run', 'automation': 'script', 'tags': 'app,mlperf,inference,generic,_cpp,_retinanet,_onnxruntime,_cpu', 'adr':
{'python': {'version_min': '3.8'}, 'compiler': {'tags': "gcc"}, 'openimages-preprocessed': {'tags': '_50'}}, 'scenario': 'Offline',
Expand Down
2 changes: 1 addition & 1 deletion script/test-cm-core/src/tutorials/test_tutorial_tvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
os.path.join(
Path(__file__).parent.parent.resolve(),
"script"))
import check as checks # noqa
import check as checks # noqa

r = cm.access({'action': 'run', 'automation': 'script', 'tags': 'run,mlperf,inference,generate-run-cmds', 'adr':
{'python': {'name': 'mlperf', 'version_min': '3.8'}}, 'submitter': 'Community',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
os.path.join(
Path(__file__).parent.parent.resolve(),
"script"))
import check as checks # noqa
import check as checks # noqa

r = cm.access({'action': 'run', 'automation': 'script', 'tags': 'run,mlperf,inference,generate-run-cmds', 'adr':
{'python': {'name': 'mlperf', 'version_min': '3.8'}, 'tvm': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
os.path.join(
Path(__file__).parent.parent.resolve(),
"script"))
import check as checks # noqa
import check as checks # noqa

r = cm.access({'action': 'run', 'automation': 'script', 'tags': 'run,mlperf,inference,generate-run-cmds', 'adr':
{'python': {'name': 'mlperf', 'version_min': '3.8'}, 'tvm': {'tags': '_pip-install'}}, 'submitter': 'Community',
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,11 @@ def command_exists(self, command):
def custom_function(self):
commit_hash = get_commit_hash()
import cmind
r = cmind.access({'action':'rm', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'force': True, 'all': True})
r = cmind.access({'action': 'rm',
'automation': 'repo',
'artifact': 'mlcommons@cm4mlops',
'force': True,
'all': True})
r = cmind.access({'action': 'pull',
'automation': 'repo',
'artifact': 'mlcommons@cm4mlops',
Expand Down

0 comments on commit 8ea6129

Please sign in to comment.