|
16 | 16 |
|
17 | 17 | import numpy as np |
18 | 18 | import pytest |
| 19 | +from helper import get_queue_or_skip |
19 | 20 |
|
20 | 21 | import dpctl |
21 | 22 | import dpctl.tensor as dpt |
@@ -193,10 +194,7 @@ def test_asarray_scalars(): |
193 | 194 |
|
194 | 195 |
|
195 | 196 | def test_asarray_copy_false(): |
196 | | - try: |
197 | | - q = dpctl.SyclQueue() |
198 | | - except dpctl.SyclQueueCreationError: |
199 | | - pytest.skip("Could not create a queue") |
| 197 | + q = get_queue_or_skip() |
200 | 198 | rng = np.random.default_rng() |
201 | 199 | Xnp = rng.integers(low=-255, high=255, size=(10, 4), dtype=np.int64) |
202 | 200 | X = dpt.from_numpy(Xnp, usm_type="device", sycl_queue=q) |
@@ -229,10 +227,15 @@ def test_asarray_copy_false(): |
229 | 227 |
|
230 | 228 |
|
231 | 229 | def test_asarray_invalid_dtype(): |
232 | | - try: |
233 | | - q = dpctl.SyclQueue() |
234 | | - except dpctl.SyclQueueCreationError: |
235 | | - pytest.skip("Could not create a queue") |
| 230 | + q = get_queue_or_skip() |
236 | 231 | Xnp = np.array([1, 2, 3], dtype=object) |
237 | 232 | with pytest.raises(TypeError): |
238 | 233 | dpt.asarray(Xnp, sycl_queue=q) |
| 234 | + |
| 235 | + |
| 236 | +def test_asarray_cross_device(): |
| 237 | + q = get_queue_or_skip() |
| 238 | + qprof = dpctl.SyclQueue(property="enable_profiling") |
| 239 | + x = dpt.empty(10, dtype="i8", sycl_queue=q) |
| 240 | + y = dpt.asarray(x, sycl_queue=qprof) |
| 241 | + assert y.sycl_queue == qprof |
0 commit comments