Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cuda_bindings/tests/nvml/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def test_read_prm_counters(all_devices):
assert len(read_counters) == 5


@pytest.mark.thread_unsafe(reason="API appears to be thread-unsafe (2026-06)")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This felt fine to me, as it writes the counter but if it doesn't seem good it could be an upstream issue. (CI ran into a segfault, IIRC.)

def test_read_write_prm(all_devices):
for device in all_devices:
# Docs say supported in BLACKWELL or later
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings/tests/nvml/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def get_architecture_name(arch):


@pytest.mark.skipif(sys.platform == "win32", reason="Test not supported on Windows")
@pytest.mark.thread_unsafe(reason="nvml init affects other threads")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely true.

def test_init_ref_count():
"""
Verifies that we can call NVML shutdown and init(2) multiple times, and that ref counting works
Expand Down
1 change: 1 addition & 0 deletions cuda_bindings/tests/test_cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ def test_cuda_mem_range_attr(device):


@pytest.mark.skipif(driverVersionLessThan(11040) or not supportsMemoryPool(), reason="Mempool for graphs not supported")
@pytest.mark.thread_unsafe(reason="used high memory can be higher if threaded.")
def test_cuda_graphMem_attr(device):
err, stream = cuda.cuStreamCreate(0)
assert err == cuda.CUresult.CUDA_SUCCESS
Expand Down
1 change: 1 addition & 0 deletions cuda_core/tests/example_tests/test_basic_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def has_recent_memory_pool_support() -> bool:


@pytest.mark.parametrize("example", sample_files)
@pytest.mark.parallel_threads_limit(8)
def test_example(example):
example_path = os.path.join(samples_path, example)
has_package_requirements_or_skip(example_path)
Expand Down
4 changes: 4 additions & 0 deletions cuda_core/tests/memory_ipc/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
POOL_SIZE = 2097152


# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


def test_outer_timeout_marker_is_applied(request):
"""Verify that memory_ipc/conftest.py applies the outer pytest-timeout marker.

Expand Down
4 changes: 4 additions & 0 deletions cuda_core/tests/memory_ipc/test_event_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
NBYTES = 64


# these tetss spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


@pytest.mark.skipif(Device().compute_capability.major < 7, reason="__nanosleep is only available starting Volta (sm70)")
class TestEventIpc:
"""Check the basic usage of IPC-enabled events with a latch kernel."""
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_ipc_duplicate_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

ENABLE_LOGGING = False # Set True for test debugging and development

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


def child_main(log, queue):
log.prefix = " child: "
Expand Down
2 changes: 2 additions & 0 deletions cuda_core/tests/memory_ipc/test_leaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
not USING_FDS or not HAVE_PSUTIL, reason="mempool allocation handle is not using fds or psutil is unavailable"
)

pytestmark = pytest.mark.thread_unsafe(reason="Tests number of fds which is shared.")


@pytest.mark.flaky(reruns=2)
@skip_if_unrunnable
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_memory_ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
NWORKERS = 2
NTASKS = 2

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


class TestIpcMempool:
@pytest.mark.flaky(reruns=2)
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_peer_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
NBYTES = 64
POOL_SIZE = 2097152

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


class TestPeerAccessNotPreservedOnImport:
"""
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_send_buffers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
NTASKS = 7
POOL_SIZE = 2097152

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


class TestIpcSendBuffers:
@pytest.mark.flaky(reruns=2)
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
NBYTES = 64
POOL_SIZE = 2097152

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


class TestObjectSerializationDirect:
"""
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/memory_ipc/test_workerpool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
NTASKS = 20
POOL_SIZE = 2097152

# these tests spawn new processes and files which fails for very many threads
pytestmark = pytest.mark.parallel_threads_limit(4)


class TestIpcWorkerPool:
"""
Expand Down
1 change: 1 addition & 0 deletions cuda_core/tests/system/test_system_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def test_unpack_bitmask_single_value():
_device._unpack_bitmask(1)


@pytest.mark.parallel_threads_limit(4) # timeouts are slow
@pytest.mark.skipif(helpers.IS_WSL or helpers.IS_WINDOWS, reason="Events not supported on WSL or Windows")
def test_register_events():
# This is not the world's greatest test. All of the events are pretty
Expand Down
3 changes: 3 additions & 0 deletions cuda_core/tests/test_graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
)
from cuda.core.utils import StridedMemoryView

# TODO(seberg): Maybe some of these tests can be made threadable?
pytestmark = pytest.mark.thread_unsafe(reason="OpenGL context not threadable")

# ---------------------------------------------------------------------------
# GL context + buffer helpers
# ---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions cuda_core/tests/test_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,7 @@ def test_managed_memory_resource_preferred_location_validation(init_cuda):
)


@pytest.mark.thread_unsafe(reason="Uses mock.")
def test_managed_memory_resource_host_numa_auto_resolve_failure(init_cuda):
"""host_numa with None raises RuntimeError when NUMA ID cannot be determined."""
from unittest.mock import MagicMock, patch
Expand Down
2 changes: 2 additions & 0 deletions cuda_core/tests/test_memory_peer_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

NBYTES = 1024

pytestmark = pytest.mark.thread_unsafe(reason="peer access tests mutate process-global CUDA memory-pool access state")


def test_peer_access_basic(mempool_device_x2):
"""Basic tests for dmr.peer_accessible_by."""
Expand Down
1 change: 1 addition & 0 deletions cuda_core/tests/test_program_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -1927,6 +1927,7 @@ def test_filestream_cache_tracker_reconciles_after_external_drift(tmp_path):
assert cache._tracked_size_bytes <= 1100 # actual on-disk is 'b' + 'c' or just 'c'


@pytest.mark.thread_unsafe(reason="already threaded and patches _file_stream")
def test_filestream_cache_tracker_clamps_at_zero_under_delete_race(tmp_path):
"""Two-thread reproduction of the ``__delitem__`` vs
``_enforce_size_cap`` race. Thread A is mid-delete: it has stat'd the
Expand Down
1 change: 1 addition & 0 deletions cuda_pathfinder/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ git_describe_command = [ "git", "describe", "--dirty", "--tags", "--long", "--ma

[tool.pytest.ini_options]
addopts = "--showlocals"
thread_unsafe_fixtures = ['mocker']

[tool.mypy]
# Try to keep the mypy configuration similar between the subprojects
Expand Down
1 change: 1 addition & 0 deletions cuda_pathfinder/tests/test_find_nvidia_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def test_find_binary_cache_negative_result(monkeypatch, mocker):


@pytest.mark.usefixtures("clear_find_binary_cache")
@pytest.mark.thread_unsafe(reason="functools.cache may replace entry.")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests identity on Path objects, which isn't a given with functools.cache right now. But it felt harmless enough to just ignore here.

def test_caching_per_utility():
"""Verify that different utilities have independent cache entries."""
nvdisasm1 = find_nvidia_binary_utility("nvdisasm")
Expand Down
Loading