Skip to content

Commit 66c23fa

Browse files
committed
Update tests for external USM allocation example
1 parent 4543541 commit 66c23fa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

examples/pybind11/external_usm_allocation/tests/test_direct.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
# coding: utf-8
1818

1919
import external_usm_allocation as eua
20+
import numpy as np
2021

2122
import dpctl
2223
import dpctl.memory as dpm
23-
import dpctl.tensor as dpt
2424

2525

2626
def test_direct():
@@ -30,8 +30,11 @@ def test_direct():
3030
mbuf = eua.make_zeroed_device_memory(nb, q)
3131

3232
assert isinstance(mbuf, dpm.MemoryUSMDevice)
33-
assert mbuf.nbytes == 2 * 30
33+
assert mbuf.nbytes == nb
3434
assert mbuf.sycl_queue == q
3535

36-
x = dpt.usm_ndarray(30, dtype="i2", buffer=mbuf)
37-
assert dpt.all(x == dpt.zeros(30, dtype="i2", sycl_queue=q))
36+
x = np.empty(30, dtype="i2")
37+
assert x.nbytes == nb
38+
39+
q.memcpy(dest=x, src=mbuf, count=nb)
40+
assert np.all(x == 0)

0 commit comments

Comments
 (0)