CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
139 lines
3.3 KiB
Python
139 lines
3.3 KiB
Python
#!/usr/bin/env python3
|
|
# Copyright Advanced Micro Devices, Inc.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""
|
|
Sanity check script for CI runners.
|
|
|
|
On Linux:
|
|
- run "amd-smi static"
|
|
- run "rocminfo"
|
|
|
|
On Windows:
|
|
- run "hipInfo.exe"
|
|
|
|
This script prints only raw command output.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
import platform
|
|
import shlex
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from typing import List, Optional
|
|
|
|
|
|
def log(*args, **kwargs):
|
|
print(*args, **kwargs)
|
|
sys.stdout.flush()
|
|
|
|
|
|
def run_command(args: List[str | Path], cwd: Optional[Path] = None) -> None:
|
|
args = [str(arg) for arg in args]
|
|
if cwd is None:
|
|
cwd = Path.cwd()
|
|
|
|
log(f"++ Exec [{cwd}]$ {shlex.join(args)}")
|
|
|
|
try:
|
|
proc = subprocess.run(
|
|
args,
|
|
cwd=str(cwd),
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT,
|
|
text=True,
|
|
check=False,
|
|
stdin=subprocess.DEVNULL,
|
|
)
|
|
log(proc.stdout.rstrip())
|
|
except FileNotFoundError:
|
|
log(f"{args[0]}: command not found")
|
|
|
|
|
|
def run_command_with_search(
|
|
label: str,
|
|
command: str,
|
|
args: List[str],
|
|
extra_command_search_paths: List[Path],
|
|
) -> None:
|
|
"""
|
|
Run a command, searching in extra paths first, then PATH.
|
|
|
|
Example:
|
|
run_command_with_search(
|
|
label="amd-smi static",
|
|
command="amd-smi",
|
|
args=["static"],
|
|
extra_command_search_paths=[bin_dir],
|
|
)
|
|
"""
|
|
# Try explicit directories first (e.g. THEROCK_DIR/build/bin)
|
|
for base in extra_command_search_paths:
|
|
candidate = base / command
|
|
if candidate.exists():
|
|
log(f"\n=== {label} ===")
|
|
run_command([candidate] + args)
|
|
return
|
|
|
|
# Then fall back to PATH
|
|
resolved = shutil.which(command)
|
|
if resolved:
|
|
log(f"\n=== {label} ===")
|
|
run_command([resolved] + args)
|
|
return
|
|
|
|
# Nothing found
|
|
log(f"\n=== {label} ===")
|
|
log(f"{command}: command not found")
|
|
|
|
|
|
def run_sanity(os_name: str) -> None:
|
|
THIS_SCRIPT_DIR = Path(__file__).resolve().parent
|
|
THEROCK_DIR = THIS_SCRIPT_DIR.parent
|
|
bin_dir = Path(os.getenv("THEROCK_BIN_DIR", THEROCK_DIR / "build" / "bin"))
|
|
|
|
log("=== Sanity check: driver / GPU info ===")
|
|
|
|
if os_name.lower() == "windows":
|
|
# Windows: only hipInfo.exe
|
|
run_command_with_search(
|
|
label="hipInfo.exe",
|
|
command="hipInfo.exe",
|
|
args=[],
|
|
extra_command_search_paths=[bin_dir],
|
|
)
|
|
else:
|
|
# Linux: amd-smi static + rocminfo
|
|
run_command_with_search(
|
|
label="amd-smi static",
|
|
command="amd-smi",
|
|
args=["static"],
|
|
extra_command_search_paths=[bin_dir],
|
|
)
|
|
run_command_with_search(
|
|
label="rocminfo",
|
|
command="rocminfo",
|
|
args=[],
|
|
extra_command_search_paths=[bin_dir],
|
|
)
|
|
run_command_with_search(
|
|
label="Kernel version",
|
|
command="uname",
|
|
args=["-r"],
|
|
extra_command_search_paths=[bin_dir],
|
|
)
|
|
|
|
log("\n=== End of sanity check ===")
|
|
|
|
|
|
def main(argv: Optional[List[str]] = None) -> int:
|
|
detected = platform.system()
|
|
run_sanity(detected)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|