Skip to content

Commit 4a7cd59

Browse files
committed
update tests
1 parent d66777e commit 4a7cd59

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

cuda_core/tests/graph/test_graph_builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from packaging.version import Version
1818

1919
import cuda.bindings
20-
from cuda.core import Device, LaunchConfig, LegacyPinnedMemoryResource, Program, ProgramOptions, launch
20+
from cuda.core import Device, LaunchConfig, LegacyPinnedMemoryResource, Program, ProgramOptions, StreamOptions, launch
2121
from cuda.core.graph import GraphBuilder, GraphDefinition
2222
from cuda.core.graph._graph_builder import (
2323
_capture_callback_with_tail_failure_for_testing,
@@ -826,7 +826,7 @@ def test_pdl_same_stream_primary_secondary_overlap_via_graph(init_cuda):
826826
primary = module.get_kernel("primary_kernel")
827827
secondary = module.get_kernel("secondary_kernel")
828828

829-
stream = dev.create_stream(options={"nonblocking": True})
829+
stream = dev.create_stream(options=StreamOptions(nonblocking=True))
830830
mr = LegacyPinnedMemoryResource()
831831
secondary_started = np.from_dlpack(mr.allocate(4)).view(np.int32)
832832
overlapped = np.from_dlpack(mr.allocate(4)).view(np.int32)

cuda_core/tests/memory_ipc/test_event_ipc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ def test_event_is_monadic(ipc_device):
108108
"""Check that IPC-enabled events are always bound and cannot be reset."""
109109
device = ipc_device
110110
with pytest.raises(TypeError, match=r"^IPC-enabled events must be bound; use Stream.record for creation\.$"):
111-
device.create_event({"ipc_enabled": True})
111+
device.create_event(EventOptions(ipc_enabled=True))
112112

113113
stream = device.create_stream()
114-
e = stream.record(options={"ipc_enabled": True})
114+
e = stream.record(options=EventOptions(ipc_enabled=True))
115115
with pytest.raises(
116116
TypeError,
117117
match=r"^IPC-enabled events should not be re-recorded, instead create a new event by supplying options\.$",

cuda_core/tests/test_launcher.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
LegacyPinnedMemoryResource,
2323
Program,
2424
ProgramOptions,
25+
StreamOptions,
2526
launch,
2627
)
2728
from cuda.core._memory._legacy import _SynchronousMemoryResource
@@ -218,7 +219,7 @@ def test_pdl_primary_secondary_overlap_same_stream():
218219
if dev.compute_capability < (9, 0):
219220
pytest.skip("Programmatic Dependent Launch requires compute capability >= 9.0")
220221
dev.set_current()
221-
stream = dev.create_stream(options={"nonblocking": True})
222+
stream = dev.create_stream(options=StreamOptions(nonblocking=True))
222223

223224
# clock64 budgets are in GPU cycles; keep the post-trigger window long enough
224225
# for the secondary to boot, but short enough for a unit test.
@@ -483,7 +484,7 @@ def test_launch_scalar_argument(python_type, cpp_type, init_value):
483484
def test_cooperative_launch():
484485
dev = Device()
485486
dev.set_current()
486-
s = dev.create_stream(options={"nonblocking": True})
487+
s = dev.create_stream(options=StreamOptions(nonblocking=True))
487488

488489
# CUDA kernel templated on type T
489490
code = r"""

cuda_core/tests/test_object_protocols.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Device,
2424
DeviceMemoryResource,
2525
DeviceMemoryResourceOptions,
26+
EventOptions,
2627
Kernel,
2728
LaunchConfig,
2829
Program,
@@ -243,7 +244,7 @@ def sample_ipc_buffer_descriptor(ipc_device):
243244
def sample_ipc_event_descriptor(ipc_device):
244245
"""An IPCEventDescriptor."""
245246
stream = ipc_device.create_stream()
246-
e = stream.record(options={"ipc_enabled": True})
247+
e = stream.record(options=EventOptions(ipc_enabled=True))
247248
return e.ipc_descriptor
248249

249250

cuda_core/tests/test_program.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ def test_program_options_name_accepts_none(name):
368368
# This is tested against the current device's arch
369369
def test_program_compile_valid_target_type(init_cuda):
370370
code = 'extern "C" __global__ void my_kernel() {}'
371-
program = Program(code, "c++", options={"name": "42"})
371+
program = Program(code, "c++", options=ProgramOptions(name="42"))
372372

373373
with warnings.catch_warnings(record=True) as w:
374374
warnings.simplefilter("always")
@@ -380,7 +380,7 @@ def test_program_compile_valid_target_type(init_cuda):
380380
ptx_kernel = ptx_object_code.get_kernel("my_kernel")
381381
assert isinstance(ptx_kernel, Kernel)
382382

383-
program = Program(ptx_object_code.code.decode(), "ptx", options={"name": "24"})
383+
program = Program(ptx_object_code.code.decode(), "ptx", options=ProgramOptions(name="24"))
384384
cubin_object_code = program.compile("cubin")
385385
assert isinstance(cubin_object_code, ObjectCode)
386386
assert cubin_object_code.name == "24"

0 commit comments

Comments
 (0)