Skip to content

Commit bacb140

Browse files
Merge pull request #884 from IntelPython/tests-on-iris-xe
Tests on iris xe
2 parents 4b31460 + 10a3e2b commit bacb140

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

dpctl/tensor/_copy_utils.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,19 @@ def _copy_to_numpy(ary):
5959
def _copy_from_numpy(np_ary, usm_type="device", sycl_queue=None):
6060
"Copies numpy array `np_ary` into a new usm_ndarray"
6161
# This may peform a copy to meet stated requirements
62-
Xnp = np.require(np_ary, requirements=["A", "O", "C", "E"])
63-
if sycl_queue:
64-
ctor_kwargs = {"queue": sycl_queue}
62+
Xnp = np.require(np_ary, requirements=["A", "E"])
63+
alloc_q = normalize_queue_device(sycl_queue=sycl_queue, device=None)
64+
dt = Xnp.dtype
65+
if dt.char in "dD" and alloc_q.sycl_device.has_aspect_fp64 is False:
66+
Xusm_dtype = (
67+
np.dtype("float32") if dt.char == "d" else np.dtype("complex64")
68+
)
6569
else:
66-
ctor_kwargs = dict()
67-
Xusm = dpt.usm_ndarray(
68-
Xnp.shape,
69-
dtype=Xnp.dtype,
70-
buffer=usm_type,
71-
buffer_ctor_kwargs=ctor_kwargs,
70+
Xusm_dtype = dt
71+
Xusm = dpt.empty(
72+
Xnp.shape, dtype=Xusm_dtype, usm_type=usm_type, sycl_queue=sycl_queue
7273
)
73-
Xusm.usm_data.copy_from_host(Xnp.reshape((-1)).view("u1"))
74+
_copy_from_numpy_into(Xusm, Xnp)
7475
return Xusm
7576

7677

dpctl/tensor/_usmarray.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ cdef class usm_ndarray:
937937
except Exception:
938938
raise ValueError(
939939
f"Input of type {type(val)} could not be "
940-
"converted to numpy.ndarray"
940+
"converted to usm_ndarray"
941941
)
942942

943943
def __sub__(first, other):

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,10 @@ def test_pyx_capi_check_constants():
588588
)
589589
@pytest.mark.parametrize("usm_type", ["device", "shared", "host"])
590590
def test_tofrom_numpy(shape, dtype, usm_type):
591-
q = dpctl.SyclQueue()
591+
try:
592+
q = dpctl.SyclQueue()
593+
except dpctl.SyclQueueCreationError:
594+
pytest.skip("Could nto create default SyclQueue")
592595
Xnp = np.zeros(shape, dtype=dtype)
593596
Xusm = dpt.from_numpy(Xnp, usm_type=usm_type, sycl_queue=q)
594597
Ynp = np.ones(shape, dtype=dtype)

dpctl/tests/test_usm_ndarray_manipulation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ def test_stack_2arrays(data):
965965
Y = dpt.asarray(Ynp, sycl_queue=q)
966966

967967
Znp = np.stack([Xnp, Ynp], axis=axis)
968-
print(Znp.shape)
969968
Z = dpt.stack([X, Y], axis=axis)
970969

971970
assert_array_equal(Znp, dpt.asnumpy(Z))

dpctl/tests/test_usm_ndarray_operators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def multiply(a, b):
4949

5050
@pytest.mark.parametrize("namespace", [None, Dummy()])
5151
def test_fp_ops(namespace):
52-
X = dpt.usm_ndarray(1, "d")
52+
X = dpt.ones(1)
5353
X._set_namespace(namespace)
5454
assert X.__array_namespace__() is namespace
5555
X[0] = -2.5

0 commit comments

Comments
 (0)