Skip to content

Commit ec0f823

Browse files
committed
Added tests for SYCL queue and USM type
1 parent 2ac7f39 commit ec0f823

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

.github/workflows/conda-package.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ env:
2626
test_umath.py
2727
test_usm_type.py
2828
third_party/cupy/linalg_tests/test_product.py
29+
third_party/cupy/logic_tests/test_comparison.py
2930
third_party/cupy/logic_tests/test_truth.py
3031
third_party/cupy/manipulation_tests/test_basic.py
3132
third_party/cupy/manipulation_tests/test_join.py

dpnp/dpnp_iface_logic.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ def allclose(a, b, rtol=1.0e-5, atol=1.0e-8, **kwargs):
186186
Examples
187187
--------
188188
>>> import dpnp as np
189-
>>> np.allclose(np.array([1e10, 1e-7]), np.array([1.00001e10, 1e-8]))
189+
>>> a = np.array([1e10, 1e-7])
190+
>>> b = np.array([1.00001e10, 1e-8])
191+
>>> np.allclose(a, b)
190192
array([False])
191-
>>> np.allclose(np.array([1.0, np.nan]), np.array([1.0, np.nan]))
193+
194+
>>> a = np.array([1.0, np.nan])
195+
>>> b = np.array([1.0, np.nan])
196+
>>> np.allclose(a, b)
192197
array([False])
193-
>>> np.allclose(np.array([1.0, np.inf]), np.array([1.0, np.inf]))
198+
199+
>>> a = np.array([1.0, np.inf])
200+
>>> b = np.array([1.0, np.inf])
201+
>>> np.allclose(a, b)
194202
array([ True])
195203
196204
"""
@@ -214,6 +222,13 @@ def allclose(a, b, rtol=1.0e-5, atol=1.0e-8, **kwargs):
214222
)
215223
)
216224

225+
if dpnp.isscalar(a):
226+
a = dpnp.full_like(b, fill_value=a)
227+
elif dpnp.isscalar(b):
228+
b = dpnp.full_like(a, fill_value=b)
229+
elif a.shape != b.shape:
230+
a, b = dpt.broadcast_arrays(a, b)
231+
217232
a_desc = dpnp.get_dpnp_descriptor(a, copy_when_nondefault_queue=False)
218233
b_desc = dpnp.get_dpnp_descriptor(b, copy_when_nondefault_queue=False)
219234
if a_desc and b_desc:

tests/skipped_tests_gpu_no_fp64.tbl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ tests/test_sycl_queue.py::test_array_creation[opencl:gpu:0-arange-arg0-kwargs0]
443443
tests/test_sycl_queue.py::test_array_creation[level_zero:gpu:0-arange-arg0-kwargs0]
444444
tests/test_sycl_queue.py::test_1in_1out[opencl:gpu:0-gradient-data10]
445445
tests/test_sycl_queue.py::test_1in_1out[level_zero:gpu:0-gradient-data10]
446-
tests/test_sycl_queue.py::test_2in_1out[opencl:gpu:0-power-data112-data212]
447-
tests/test_sycl_queue.py::test_2in_1out[level_zero:gpu:0-power-data112-data212]
446+
tests/test_sycl_queue.py::test_2in_1out[opencl:gpu:0-power-data113-data213]
447+
tests/test_sycl_queue.py::test_2in_1out[level_zero:gpu:0-power-data113-data213]
448448
tests/test_sycl_queue.py::test_out_2in_1out[opencl:gpu:0-power-data19-data29]
449449
tests/test_sycl_queue.py::test_out_2in_1out[level_zero:gpu:0-power-data19-data29]
450450
tests/test_sycl_queue.py::test_eig[opencl:gpu:0]

tests/test_sycl_queue.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ def test_1in_1out(func, data, device):
276276
[0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0],
277277
[0.0, 1.0, 2.0, 0.0, 1.0, 2.0, 0.0, 1.0, 2.0],
278278
),
279+
pytest.param(
280+
"allclose",
281+
[1.0, dpnp.inf, -dpnp.inf],
282+
[1.0, dpnp.inf, -dpnp.inf],
283+
),
279284
pytest.param("copysign", [0.0, 1.0, 2.0], [-1.0, 0.0, 1.0]),
280285
pytest.param("cross", [1.0, 2.0, 3.0], [4.0, 5.0, 6.0]),
281286
pytest.param(

tests/test_usm_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,11 @@ def test_1in_1out(func, data, usm_type):
295295
@pytest.mark.parametrize(
296296
"func,data1,data2",
297297
[
298+
pytest.param(
299+
"allclose",
300+
[[1.2, -0.0], [-7, 2.34567]],
301+
[[1.2, 0.0], [-7, 2.34567]],
302+
),
298303
pytest.param(
299304
"dot",
300305
[[0.0, 1.0, 2.0], [3.0, 4.0, 5.0]],

0 commit comments

Comments
 (0)