Skip to content

Commit 61a7244

Browse files
Added test_meshgrid2 to test different queues
1 parent 95e52ff commit 61a7244

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1451,6 +1451,33 @@ def test_meshgrid():
14511451
dpt.meshgrid(X, dpt.asarray(Y, dtype="b1"))
14521452

14531453

1454+
def test_meshgrid2():
1455+
try:
1456+
q1 = dpctl.SyclQueue()
1457+
q2 = dpctl.SyclQueue()
1458+
q3 = dpctl.SyclQueue()
1459+
except dpctl.SyclQueueCreationError:
1460+
pytest.skip("Queue could not be created")
1461+
x1 = dpt.arange(0, 2, dtype="int16", sycl_queue=q1)
1462+
x2 = dpt.arange(3, 6, dtype="int16", sycl_queue=q2)
1463+
x3 = dpt.arange(6, 10, dtype="int16", sycl_queue=q3)
1464+
y1, y2, y3 = dpt.meshgrid(x1, x2, x3, indexing="xy")
1465+
z1, z2, z3 = dpt.meshgrid(x1, x2, x3, indexing="ij")
1466+
assert all(
1467+
x.sycl_queue == y.sycl_queue for x, y in zip((x1, x2, x3), (y1, y2, y3))
1468+
)
1469+
assert all(
1470+
x.sycl_queue == z.sycl_queue for x, z in zip((x1, x2, x3), (z1, z2, z3))
1471+
)
1472+
assert y1.shape == y2.shape and y2.shape == y3.shape
1473+
assert z1.shape == z2.shape and z2.shape == z3.shape
1474+
assert y1.shape == (len(x2), len(x1), len(x3))
1475+
assert z1.shape == (len(x1), len(x2), len(x3))
1476+
# FIXME: uncomment out once gh-921 is merged
1477+
# assert all(z.flags["C"] for z in (z1, z2, z3))
1478+
# assert all(y.flags["C"] for y in (y1, y2, y3))
1479+
1480+
14541481
def test_common_arg_validation():
14551482
order = "I"
14561483
# invalid order must raise ValueError

0 commit comments

Comments
 (0)