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
51 lines
1.4 KiB
Python
51 lines
1.4 KiB
Python
# Copyright © Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
"""Pytest configuration for hipDNN Python binding tests.
|
|
|
|
Auto-skips tests marked ``gpu`` when no ROCm-capable GPU is usable, so the
|
|
suite can run on CPU-only machines without spurious failures.
|
|
"""
|
|
|
|
import functools
|
|
import warnings
|
|
|
|
import pytest
|
|
|
|
import hipdnn_frontend as hipdnn
|
|
|
|
|
|
@functools.lru_cache(maxsize=1)
|
|
def _gpu_available():
|
|
"""Return True when HIP reports at least one visible GPU device."""
|
|
try:
|
|
device_count = hipdnn.hip_get_device_count()
|
|
except Exception as exc:
|
|
warnings.warn(f"HIP device probe failed: {exc!r}", stacklevel=1)
|
|
return False
|
|
if device_count <= 0:
|
|
warnings.warn(
|
|
f"HIP device probe reported {device_count} visible device(s).",
|
|
stacklevel=1,
|
|
)
|
|
return False
|
|
return True
|
|
|
|
|
|
def pytest_configure(config):
|
|
config.addinivalue_line("markers", "gpu: test requires a ROCm-capable GPU")
|
|
|
|
|
|
def pytest_collection_modifyitems(config, items):
|
|
if _gpu_available():
|
|
return
|
|
gpu_items = [item for item in items if "gpu" in item.keywords]
|
|
if gpu_items:
|
|
warnings.warn(
|
|
f"No ROCm-capable GPU available; skipping {len(gpu_items)} gpu test(s).",
|
|
stacklevel=1,
|
|
)
|
|
skip_gpu = pytest.mark.skip(reason="no ROCm-capable GPU available")
|
|
for item in gpu_items:
|
|
item.add_marker(skip_gpu)
|