Skip to content
Merged
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
14 changes: 11 additions & 3 deletions cuda_core/tests/test_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,26 @@ def test_device_set_current(deinit_cuda):
assert handle_return(driver.cuCtxGetCurrent()) is not None


def test_device_repr():
def test_device_repr(deinit_cuda):
device = Device(0)
device.set_current()
assert str(device).startswith("<Device 0")


def test_device_alloc(init_cuda):
def test_device_alloc(deinit_cuda):
device = Device()
device.set_current()
buffer = device.allocate(1024)
device.sync()
assert buffer.handle != 0
assert buffer.size == 1024
assert buffer.device_id == 0
assert buffer.device_id == int(device)


def test_device_id(deinit_cuda):
for device in cuda.core.experimental.system.devices:
device.set_current()
assert device.device_id == handle_return(runtime.cudaGetDevice())


def test_device_create_stream(init_cuda):
Expand Down
Loading