-
Notifications
You must be signed in to change notification settings - Fork 13
Support configurable ROCm path (ROCM_PATH / --rocm-path) #75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -33,6 +33,7 @@ | |||||||||||||||||||
| import sys | ||||||||||||||||||||
| import os | ||||||||||||||||||||
| import json | ||||||||||||||||||||
| import shlex | ||||||||||||||||||||
| import time | ||||||||||||||||||||
| import re | ||||||||||||||||||||
| import traceback | ||||||||||||||||||||
|
|
@@ -48,6 +49,7 @@ | |||||||||||||||||||
| from madengine.utils.ops import PythonicTee, file_print, substring_found, find_and_replace_pattern | ||||||||||||||||||||
| from madengine.core.constants import MAD_MINIO, MAD_AWS_S3 | ||||||||||||||||||||
| from madengine.core.constants import MODEL_DIR, PUBLIC_GITHUB_ROCM_KEY | ||||||||||||||||||||
| from madengine.core.constants import get_rocm_path | ||||||||||||||||||||
| from madengine.core.timeout import Timeout | ||||||||||||||||||||
| from madengine.tools.update_perf_csv import update_perf_csv | ||||||||||||||||||||
| from madengine.tools.csv_to_html import convert_csv_to_html | ||||||||||||||||||||
|
|
@@ -154,9 +156,11 @@ def __init__(self, args): | |||||||||||||||||||
| self.return_status = True | ||||||||||||||||||||
| self.args = args | ||||||||||||||||||||
| self.console = Console(live_output=True) | ||||||||||||||||||||
| rocm_path = get_rocm_path(getattr(args, 'rocm_path', None)) | ||||||||||||||||||||
| self.context = Context( | ||||||||||||||||||||
| additional_context=args.additional_context, | ||||||||||||||||||||
| additional_context_file=args.additional_context_file, | ||||||||||||||||||||
| rocm_path=rocm_path, | ||||||||||||||||||||
| ) | ||||||||||||||||||||
| # check the data.json file exists | ||||||||||||||||||||
| data_json_file = args.data_config_file_name | ||||||||||||||||||||
|
|
@@ -202,7 +206,10 @@ def clean_up_docker_container(self, is_cleaned: bool = False) -> None: | |||||||||||||||||||
| gpu_vendor = self.context.ctx["docker_env_vars"]["MAD_GPU_VENDOR"] | ||||||||||||||||||||
| # show gpu info | ||||||||||||||||||||
| if gpu_vendor.find("AMD") != -1: | ||||||||||||||||||||
| self.console.sh("/opt/rocm/bin/amd-smi || /opt/rocm/bin/rocm-smi || true") | ||||||||||||||||||||
| ro = self.context.ctx["rocm_path"] | ||||||||||||||||||||
| amd_smi = shlex.quote(os.path.join(ro, "bin", "amd-smi")) | ||||||||||||||||||||
| rocm_smi = shlex.quote(os.path.join(ro, "bin", "rocm-smi")) | ||||||||||||||||||||
| self.console.sh(f"{amd_smi} || {rocm_smi} || true") | ||||||||||||||||||||
| elif gpu_vendor.find("NVIDIA") != -1: | ||||||||||||||||||||
| self.console.sh("nvidia-smi -L || true") | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -789,7 +796,10 @@ def run_model_impl( | |||||||||||||||||||
|
|
||||||||||||||||||||
| # echo gpu smi info | ||||||||||||||||||||
| if gpu_vendor.find("AMD") != -1: | ||||||||||||||||||||
| smi = model_docker.sh("/opt/rocm/bin/amd-smi || /opt/rocm/bin/rocm-smi || true") | ||||||||||||||||||||
| ro = self.context.ctx["rocm_path"] | ||||||||||||||||||||
| amd_smi = shlex.quote(os.path.join(ro, "bin", "amd-smi")) | ||||||||||||||||||||
| rocm_smi = shlex.quote(os.path.join(ro, "bin", "rocm-smi")) | ||||||||||||||||||||
|
Comment on lines
+799
to
+801
|
||||||||||||||||||||
| ro = self.context.ctx["rocm_path"] | |
| amd_smi = shlex.quote(os.path.join(ro, "bin", "amd-smi")) | |
| rocm_smi = shlex.quote(os.path.join(ro, "bin", "rocm-smi")) | |
| def shell_double_quoted(value): | |
| return '"' + value.replace("\\", "\\\\").replace('"', '\\"').replace("$", "\\$").replace("`", "\\`") + '"' | |
| ro = self.context.ctx["rocm_path"] | |
| amd_smi = shell_double_quoted(os.path.join(ro, "bin", "amd-smi")) | |
| rocm_smi = shell_double_quoted(os.path.join(ro, "bin", "rocm-smi")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Console.sh()now merges any providedenvwithos.environ, so buildingvendor_envby copyingos.environhere is redundant. You can pass just{"ROCM_PATH": self._rocm_path}(and/or any overrides) to keep the intent clear and avoid an extra full env copy.