Skip to content

Commit 22579f6

Browse files
Add a test to exercise copy via host
1 parent e01f33b commit 22579f6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dpctl/tests/test_usm_ndarray_dlpack.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,3 +696,13 @@ def test_dlpack_size_0_on_kdlcpu():
696696
cap = x_np.__dlpack__()
697697
y = _dlp.from_dlpack_capsule(cap)
698698
assert y.ctypes.data == x_np.ctypes.data
699+
700+
701+
def test_copy_via_host():
702+
get_queue_or_skip()
703+
x = dpt.ones(1, dtype="i4")
704+
x_np = np.ones(1, dtype="i4")
705+
y = dpt.from_dlpack(x_np, device=x.__dlpack_device__())
706+
assert isinstance(y, dpt.usm_ndarray)
707+
assert y.sycl_device == x.sycl_device
708+
assert y.usm_type == "device"

0 commit comments

Comments
 (0)