Skip to content

Commit c34bdbb

Browse files
committed
update tests
1 parent cef7cf6 commit c34bdbb

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
@@ -16,7 +16,7 @@
1616
from packaging.version import Version
1717

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

828-
stream = dev.create_stream(options={"nonblocking": True})
828+
stream = dev.create_stream(options=StreamOptions(nonblocking=True))
829829
mr = LegacyPinnedMemoryResource()
830830
secondary_started = np.from_dlpack(mr.allocate(4)).view(np.int32)
831831
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
@@ -21,6 +21,7 @@
2121
LegacyPinnedMemoryResource,
2222
Program,
2323
ProgramOptions,
24+
StreamOptions,
2425
launch,
2526
)
2627
from cuda.core._memory._legacy import _SynchronousMemoryResource
@@ -217,7 +218,7 @@ def test_pdl_primary_secondary_overlap_same_stream():
217218
if dev.compute_capability < (9, 0):
218219
pytest.skip("Programmatic Dependent Launch requires compute capability >= 9.0")
219220
dev.set_current()
220-
stream = dev.create_stream(options={"nonblocking": True})
221+
stream = dev.create_stream(options=StreamOptions(nonblocking=True))
221222

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

487488
# CUDA kernel templated on type T
488489
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
@@ -370,7 +370,7 @@ def test_program_options_name_accepts_none(name):
370370
# This is tested against the current device's arch
371371
def test_program_compile_valid_target_type(init_cuda):
372372
code = 'extern "C" __global__ void my_kernel() {}'
373-
program = Program(code, "c++", options={"name": "42"})
373+
program = Program(code, "c++", options=ProgramOptions(name="42"))
374374

375375
with warnings.catch_warnings(record=True) as w:
376376
warnings.simplefilter("always")
@@ -382,7 +382,7 @@ def test_program_compile_valid_target_type(init_cuda):
382382
ptx_kernel = ptx_object_code.get_kernel("my_kernel")
383383
assert isinstance(ptx_kernel, Kernel)
384384

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

0 commit comments

Comments
 (0)