diff --git a/install.sh b/install.sh index f6c6c59ad0..bd3029b2e6 100755 --- a/install.sh +++ b/install.sh @@ -998,10 +998,10 @@ get_torch_index_url() { # First confirm an actual AMD GPU is present (not just ROCm tools installed) _has_rocm_gpu=false if command -v rocminfo >/dev/null 2>&1 && \ - rocminfo 2>/dev/null | awk '/Name:[[:space:]]*gfx[0-9]/{found=1} END{exit !found}'; then + rocminfo 2>/dev/null | awk '/Name:[[:space:]]*gfx[1-9]/{found=1} END{exit !found}'; then _has_rocm_gpu=true elif command -v amd-smi >/dev/null 2>&1 && \ - amd-smi list 2>/dev/null | awk 'NR>1 && NF{found=1} END{exit !found}'; then + amd-smi list 2>/dev/null | awk '/^GPU[[:space:]]*[:\[]/{ found=1 } END{ exit !found }'; then _has_rocm_gpu=true fi if [ "$_has_rocm_gpu" != true ]; then @@ -1158,10 +1158,10 @@ case "$TORCH_INDEX_URL" in _amd_gpu_here=false _amd_gpu_radeon=false if command -v rocminfo >/dev/null 2>&1 && \ - rocminfo 2>/dev/null | awk '/Name:[[:space:]]*gfx[0-9]/{found=1} END{exit !found}'; then + rocminfo 2>/dev/null | awk '/Name:[[:space:]]*gfx[1-9]/{found=1} END{exit !found}'; then _amd_gpu_here=true elif command -v amd-smi >/dev/null 2>&1 && \ - amd-smi list 2>/dev/null | awk 'NR>1 && NF{found=1} END{exit !found}'; then + amd-smi list 2>/dev/null | awk '/^GPU[[:space:]]*[:\[]/{ found=1 } END{ exit !found }'; then _amd_gpu_here=true fi if [ "$_amd_gpu_here" = true ] && command -v rocminfo >/dev/null 2>&1 && \ diff --git a/studio/install_llama_prebuilt.py b/studio/install_llama_prebuilt.py index 9b76548c23..6b0bb150d6 100755 --- a/studio/install_llama_prebuilt.py +++ b/studio/install_llama_prebuilt.py @@ -2558,7 +2558,8 @@ def detect_host() -> HostInfo: has_rocm = False if is_linux: for _cmd, _check in ( - (["rocminfo"], lambda out: "gfx" in out.lower()), + # rocminfo: look for "gfxNNNN" with nonzero first digit (gfx000 is CPU agent) + (["rocminfo"], lambda out: bool(_re.search(r"gfx[1-9]", out.lower()))), (["amd-smi", "list"], _amd_smi_has_gpu), ): _exe = shutil.which(_cmd[0]) diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py index bbf71b4496..4fd14e5023 100644 --- a/studio/install_python_stack.py +++ b/studio/install_python_stack.py @@ -110,7 +110,8 @@ def _has_rocm_gpu() -> bool: for cmd, check_fn in ( # rocminfo: look for "Name: gfxNNNN" indicating an actual GPU agent - (["rocminfo"], lambda out: "gfx" in out.lower()), + # rocminfo: look for "Name: gfxNNNN" with nonzero first digit (gfx000 is the CPU agent) + (["rocminfo"], lambda out: bool(re.search(r"gfx[1-9]", out.lower()))), # amd-smi list: require "GPU: " data rows, not just a header ( ["amd-smi", "list"],