feat: print HIP SDK path and full hipconfig version in terminal on AMD detection
Both install.ps1 and setup.ps1 now emit substeps under the gpu step when
AMD ROCm is detected:
gpu AMD ROCm (gfx1200)
HIP SDK: C:\Program Files\AMD\ROCm\7.1
hipconfig: 7.1.51803-d3a86bd04
Previously only the gpu label (e.g. "AMD ROCm (gfx1200)") was shown with
no indication of where the SDK was found or which exact build was active.
The full hipconfig build string (e.g. 7.1.51803-d3a86bd04 instead of just
7.1) is now stored in ROCmVersionFull and also used in setup.ps1's
'rocm' step label.
9 new tests in TestHipSdkDetectedSubstep; total 192 passed, 2 skipped
This commit is contained in:
parent
116fa6eb92
commit
ae6d042caf
3 changed files with 75 additions and 4 deletions
11
install.ps1
11
install.ps1
|
|
@ -1339,8 +1339,12 @@ shell.Run cmd, 0, False
|
|||
if ($hipConfigExe) {
|
||||
try {
|
||||
$hipVerOut = & $hipConfigExe.Source --version 2>&1 | Out-String
|
||||
if ($LASTEXITCODE -eq 0 -and $hipVerOut -match '(\d+\.\d+)') {
|
||||
$ROCmVersion = $Matches[1]
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$hipVerLine = ($hipVerOut -split '\r?\n' | Where-Object { $_.Trim() } | Select-Object -First 1).Trim()
|
||||
if ($hipVerLine -match '(\d+\.\d+)') {
|
||||
$ROCmVersion = $Matches[1]
|
||||
$ROCmVersionFull = $hipVerLine
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
|
|
@ -1362,6 +1366,9 @@ shell.Run cmd, 0, False
|
|||
step "gpu" "NVIDIA GPU detected"
|
||||
} elseif ($HasROCm) {
|
||||
step "gpu" $ROCmGpuLabel
|
||||
$hipSdkPath = if ($env:HIP_PATH) { $env:HIP_PATH } elseif ($env:ROCM_PATH) { $env:ROCM_PATH } else { "on system PATH" }
|
||||
substep "HIP SDK: $hipSdkPath"
|
||||
if ($ROCmVersionFull) { substep "hipconfig: $ROCmVersionFull" }
|
||||
} elseif ($ROCmGpuLabel) {
|
||||
step "gpu" "AMD GPU detected -- HIP SDK not found" "Yellow"
|
||||
substep "Detected: $ROCmGpuLabel" "Yellow"
|
||||
|
|
|
|||
|
|
@ -825,7 +825,13 @@ if (-not $HasNvidiaSmi) {
|
|||
if ($hipConfigExe) {
|
||||
try {
|
||||
$hipVerOut = & $hipConfigExe.Source --version 2>&1 | Out-String
|
||||
if ($LASTEXITCODE -eq 0 -and $hipVerOut -match '(\d+\.\d+)') { $script:ROCmVersion = $Matches[1] }
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
$hipVerLine = ($hipVerOut -split '\r?\n' | Where-Object { $_.Trim() } | Select-Object -First 1).Trim()
|
||||
if ($hipVerLine -match '(\d+\.\d+)') {
|
||||
$script:ROCmVersion = $Matches[1]
|
||||
$script:ROCmVersionFull = $hipVerLine
|
||||
}
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
if (-not $script:ROCmVersion) {
|
||||
|
|
@ -844,6 +850,9 @@ if ($HasNvidiaSmi) {
|
|||
step "gpu" "NVIDIA GPU detected"
|
||||
} elseif ($HasROCm) {
|
||||
step "gpu" $ROCmGpuLabel
|
||||
$hipSdkPath = if ($env:HIP_PATH) { $env:HIP_PATH } elseif ($env:ROCM_PATH) { $env:ROCM_PATH } else { "on system PATH" }
|
||||
substep "HIP SDK: $hipSdkPath"
|
||||
if ($script:ROCmVersionFull) { substep "hipconfig: $script:ROCmVersionFull" }
|
||||
} elseif ($ROCmGpuLabel) {
|
||||
Write-Host ""
|
||||
step "gpu" "AMD GPU detected -- HIP SDK not found" "Yellow"
|
||||
|
|
@ -1265,7 +1274,7 @@ if (-not $CudaArch) {
|
|||
}
|
||||
|
||||
if ($HasROCm) {
|
||||
$rocmVerLabel = if ($ROCmVersion) { "ROCm $ROCmVersion" } else { "ROCm (version unknown)" }
|
||||
$rocmVerLabel = if ($script:ROCmVersionFull) { "ROCm $script:ROCmVersionFull" } elseif ($script:ROCmVersion) { "ROCm $script:ROCmVersion" } else { "ROCm (version unknown)" }
|
||||
step "rocm" $rocmVerLabel
|
||||
} elseif ($ROCmGpuLabel) {
|
||||
step "rocm" "HIP SDK not found -- GPU-accelerated training unavailable" "Yellow"
|
||||
|
|
|
|||
|
|
@ -2200,5 +2200,60 @@ class TestHipSdkEnvPathResolution:
|
|||
)
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# TEST: HIP SDK detected substep -- path + hipconfig version shown in terminal
|
||||
# =============================================================================
|
||||
|
||||
|
||||
class TestHipSdkDetectedSubstep:
|
||||
"""Verify that both scripts print HIP SDK path and full hipconfig version
|
||||
as substeps under the gpu step when AMD ROCm is successfully detected."""
|
||||
|
||||
def test_setup_prints_hip_sdk_path_substep(self):
|
||||
"""setup.ps1 must print an 'HIP SDK:' substep showing the resolved path."""
|
||||
source = _SETUP_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "HIP SDK:" in source
|
||||
|
||||
def test_install_prints_hip_sdk_path_substep(self):
|
||||
"""install.ps1 must print an 'HIP SDK:' substep showing the resolved path."""
|
||||
source = _INSTALL_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "HIP SDK:" in source
|
||||
|
||||
def test_setup_shows_hipconfig_full_version(self):
|
||||
"""setup.ps1 must capture and display the full hipconfig version string."""
|
||||
source = _SETUP_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "ROCmVersionFull" in source or "hipconfig:" in source
|
||||
|
||||
def test_install_shows_hipconfig_full_version(self):
|
||||
"""install.ps1 must capture and display the full hipconfig version string."""
|
||||
source = _INSTALL_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "ROCmVersionFull" in source or "hipconfig:" in source
|
||||
|
||||
def test_setup_captures_full_version_not_just_major_minor(self):
|
||||
"""setup.ps1 must store the raw hipconfig output line, not just major.minor."""
|
||||
source = _SETUP_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "ROCmVersionFull" in source
|
||||
|
||||
def test_install_captures_full_version_not_just_major_minor(self):
|
||||
"""install.ps1 must store the raw hipconfig output line, not just major.minor."""
|
||||
source = _INSTALL_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "ROCmVersionFull" in source
|
||||
|
||||
def test_setup_uses_hip_path_or_rocm_path_for_sdk_display(self):
|
||||
"""setup.ps1 HIP SDK path substep must check HIP_PATH then ROCM_PATH."""
|
||||
source = _SETUP_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "HIP_PATH" in source and "ROCM_PATH" in source
|
||||
|
||||
def test_install_uses_hip_path_or_rocm_path_for_sdk_display(self):
|
||||
"""install.ps1 HIP SDK path substep must check HIP_PATH then ROCM_PATH."""
|
||||
source = _INSTALL_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "HIP_PATH" in source and "ROCM_PATH" in source
|
||||
|
||||
def test_setup_rocm_step_uses_full_version(self):
|
||||
"""setup.ps1 'rocm' step label must prefer the full version string."""
|
||||
source = _SETUP_PS1_PATH.read_text(encoding = "utf-8")
|
||||
assert "ROCmVersionFull" in source and "rocm" in source
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-v"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue