From e111c5f165018210f3254a460cc24639b15ebbfc Mon Sep 17 00:00:00 2001 From: Stephen Shao Date: Tue, 14 Jul 2026 16:46:30 -0400 Subject: [PATCH] fix(context): resolve amd-smi path in get_gpu_renderD_nodes amd-smi was invoked as a bare command, relying on PATH, while every other call site in this file resolves it via self._rocm_path. On hosts where /opt/rocm*/bin is not on PATH, this caused GPU detection to fail with exit code 127 (ROCM-27727). Co-authored-by: Cursor --- src/madengine/core/context.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/madengine/core/context.py b/src/madengine/core/context.py index 48461a72..7b22443d 100644 --- a/src/madengine/core/context.py +++ b/src/madengine/core/context.py @@ -796,8 +796,10 @@ def get_gpu_renderD_nodes(self) -> typing.Optional[typing.List[int]]: else: # Modern method using amd-smi (ROCm >= 6.4.0) # Get list of GPUs from amd-smi (redirect stderr to filter warnings) + # Use resolved path since /opt/rocm*/bin is not guaranteed to be on PATH # Longer timeout (180s) for slow GPU initialization on SLURM compute nodes - output = self.console.sh("amd-smi list -e --json 2>/dev/null || amd-smi list -e --json 2>&1", timeout=180) + amd_smi_path = os.path.join(self._rocm_path, "bin", "amd-smi") + output = self.console.sh(f"{amd_smi_path} list -e --json 2>/dev/null || {amd_smi_path} list -e --json 2>&1", timeout=180) if not output or output.strip() == "": raise ValueError("Failed to retrieve AMD GPU data from amd-smi")