Skip to content

Commit 52879fd

Browse files
committed
test: skip unsupported managed pool warnings
Skip managed memory warning tests when explicit managed pool creation reports unsupported, now that cuda.core preserves the underlying CUDA error. xref: #2084 (comment)
1 parent 4255902 commit 52879fd

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

‎cuda_core/tests/conftest.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ def create_managed_memory_resource_or_skip(*args, xfail_device=None, **kwargs):
8787
return ManagedMemoryResource(*args, **kwargs)
8888
except CUDAError as e:
8989
xfail_if_mempool_oom(e, _device_id_from_resource_options(xfail_device, args, kwargs))
90+
if "CUDA_ERROR_NOT_SUPPORTED" in str(e):
91+
pytest.skip("ManagedMemoryResource is not supported on this platform/device")
9092
raise
9193
except RuntimeError as e:
9294
if "requires CUDA 13.0" in str(e):

‎cuda_core/tests/test_managed_memory_warning.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import pytest
1414

1515
import cuda.bindings
16-
from conftest import xfail_if_mempool_oom
16+
from conftest import create_managed_memory_resource_or_skip, xfail_if_mempool_oom
1717
from cuda.core import Device, ManagedMemoryResource, ManagedMemoryResourceOptions
1818
from cuda.core._memory._managed_memory_resource import reset_concurrent_access_warning
1919
from cuda.core._utils.cuda_utils import CUDAError
@@ -28,7 +28,10 @@
2828

2929
def _make_managed_mr(device_id):
3030
"""Create a ManagedMemoryResource with an explicit device preference."""
31-
return ManagedMemoryResource(options=ManagedMemoryResourceOptions(preferred_location=device_id))
31+
return create_managed_memory_resource_or_skip(
32+
options=ManagedMemoryResourceOptions(preferred_location=device_id),
33+
xfail_device=device_id,
34+
)
3235

3336

3437
@pytest.fixture

0 commit comments

Comments
 (0)