Skip to content

Commit

Permalink
Unskip linalg tests due to fix in gh-2212
Browse files Browse the repository at this point in the history
  • Loading branch information
vlad-perevezentsev committed Dec 11, 2024
1 parent 5d0ea3c commit fa7ab49
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 67 deletions.
31 changes: 0 additions & 31 deletions dpnp/tests/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ def test_complex(self, dtype, shape, p):
expected = numpy.linalg.cond(a, p=p)
assert_dtype_allclose(result, expected)

@pytest.mark.skipif(is_cuda_device(), reason="SAT-7589")
@pytest.mark.parametrize(
"p", [None, -dpnp.inf, -2, -1, 1, 2, dpnp.inf, "fro"]
)
Expand Down Expand Up @@ -1820,9 +1819,6 @@ class TestLstsq:
],
)
def test_lstsq(self, a_shape, b_shape, dtype):
if is_cuda_device():
if a_shape == (2, 4):
pytest.skip("SAT-7589")
a_np = numpy.random.rand(*a_shape).astype(dtype)
b_np = numpy.random.rand(*b_shape).astype(dtype)

Expand Down Expand Up @@ -2197,9 +2193,6 @@ def test_1D_complex(self, dtype, ord, axis, keepdims):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_2D(self, dtype, ord, axis, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"] and axis == None:
pytest.skip("SAT-7589")
a = generate_random_numpy_array((3, 5), dtype)
ia = dpnp.array(a)
if (axis in [-1, 0, 1] and ord in ["nuc", "fro"]) or (
Expand All @@ -2225,9 +2218,6 @@ def test_2D(self, dtype, ord, axis, keepdims):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_2D_complex(self, dtype, ord, axis, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"] and axis == None:
pytest.skip("SAT-7589")
x1 = numpy.random.uniform(-5, 5, 15)
x2 = numpy.random.uniform(-5, 5, 15)
a = numpy.array(x1 + 1j * x2, dtype=dtype).reshape(3, 5)
Expand Down Expand Up @@ -2257,9 +2247,6 @@ def test_2D_complex(self, dtype, ord, axis, keepdims):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_ND(self, dtype, ord, axis, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"] and axis == (0, 1):
pytest.skip("SAT-7589")
a = generate_random_numpy_array((2, 3, 4, 5), dtype)
ia = dpnp.array(a)
if (axis in [-1, 0, 1] and ord in ["nuc", "fro"]) or (
Expand Down Expand Up @@ -2291,9 +2278,6 @@ def test_ND(self, dtype, ord, axis, keepdims):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_ND_complex(self, dtype, ord, axis, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"] and axis == (0, 1):
pytest.skip("SAT-7589")
x1 = numpy.random.uniform(-5, 5, 120)
x2 = numpy.random.uniform(-5, 5, 120)
a = numpy.array(x1 + 1j * x2, dtype=dtype).reshape(2, 3, 4, 5)
Expand Down Expand Up @@ -2327,9 +2311,6 @@ def test_ND_complex(self, dtype, ord, axis, keepdims):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_usm_ndarray(self, dtype, ord, axis, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"] and axis in [(0, 1), (-2, -1)]:
pytest.skip("SAT-7589")
a = numpy.array(numpy.random.uniform(-5, 5, 120), dtype=dtype).reshape(
2, 3, 4, 5
)
Expand Down Expand Up @@ -2407,9 +2388,6 @@ def test_strided_ND(self, axis, stride):
)
@pytest.mark.parametrize("keepdims", [True, False])
def test_matrix_norm(self, ord, keepdims):
if is_cuda_device():
if ord in [-2, 2, "nuc"]:
pytest.skip("SAT-7589")
a = numpy.array(numpy.random.uniform(-5, 5, 15)).reshape(3, 5)
ia = dpnp.array(a)

Expand Down Expand Up @@ -2951,9 +2929,6 @@ def check_decomposition(
ids=["(2, 2)", "(3, 4)", "(5, 3)", "(16, 16)"],
)
def test_svd(self, dtype, shape):
if is_cuda_device():
if shape == (3, 4):
pytest.skip("SAT-7589")
a = numpy.arange(shape[0] * shape[1], dtype=dtype).reshape(shape)
dp_a = dpnp.array(a)

Expand Down Expand Up @@ -3023,9 +2998,6 @@ class TestSvdvals:
ids=["(3, 5)", "(4, 2)", "(2, 3, 3)", "(3, 5, 2)"],
)
def test_svdvals(self, dtype, shape):
if is_cuda_device():
if shape == (3, 5):
pytest.skip("SAT-7589")
a = numpy.arange(numpy.prod(shape), dtype=dtype).reshape(shape)
dp_a = dpnp.array(a)

Expand Down Expand Up @@ -3096,9 +3068,6 @@ def check_types_shapes(self, dp_B, np_B):
],
)
def test_pinv(self, dtype, shape):
if is_cuda_device():
if shape in [(3, 4), (2, 2, 4)]:
pytest.skip("SAT-7589")
# Set seed_value=81 to prevent
# random generation of the input singular matrix
a = generate_random_numpy_array(shape, dtype, seed_value=81)
Expand Down
10 changes: 0 additions & 10 deletions dpnp/tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
assert_dtype_allclose,
generate_random_numpy_array,
get_all_dtypes,
is_cuda_device,
is_win_platform,
)

Expand Down Expand Up @@ -1807,9 +1806,6 @@ def test_matrix_rank(data, tol, device):
ids=["-1", "0", "1", "(0, 1)", "(-2, -1)", "None"],
)
def test_norm(device, ord, axis):
if is_cuda_device():
if axis in [(0, 1), (-2, -1)] and ord in [-2, 2, "nuc"]:
pytest.skip("SAT-7589")
a = numpy.arange(120).reshape(2, 3, 4, 5)
ia = dpnp.array(a, device=device)
if (axis in [-1, 0, 1] and ord in ["nuc", "fro"]) or (
Expand Down Expand Up @@ -1909,9 +1905,6 @@ def test_qr(shape, mode, device):
],
)
def test_svd(shape, full_matrices, compute_uv, device):
if is_cuda_device():
if shape in [(1, 4), (2, 2, 3)]:
pytest.skip("SAT-7589")
dtype = dpnp.default_float_type(device)

count_elems = numpy.prod(shape)
Expand Down Expand Up @@ -2518,9 +2511,6 @@ def test_slogdet(shape, is_empty, device):
ids=[device.filter_string for device in valid_devices],
)
def test_pinv(shape, hermitian, rcond_as_array, device):
if is_cuda_device():
if shape == (2, 2, 3):
pytest.skip("SAT-7589")
dtype = dpnp.default_float_type(device)
# Set seed_value=81 to prevent
# random generation of the input singular matrix
Expand Down
9 changes: 0 additions & 9 deletions dpnp/tests/test_usm_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,6 @@ def test_meshgrid(usm_type_x, usm_type_y):
ids=["-1", "0", "1", "(0, 1)", "(-2, -1)", "None"],
)
def test_norm(usm_type, ord, axis):
if is_cuda_device():
if axis in [(0, 1), (-2, -1)] and ord in [-2, 2, "nuc"]:
pytest.skip("SAT-7589")
ia = dp.arange(120, usm_type=usm_type).reshape(2, 3, 4, 5)
if (axis in [-1, 0, 1] and ord in ["nuc", "fro"]) or (
isinstance(axis, tuple) and ord == 3
Expand Down Expand Up @@ -1458,9 +1455,6 @@ def test_inv(shape, is_empty, usm_type):
],
)
def test_svd(usm_type, shape, full_matrices_param, compute_uv_param):
if is_cuda_device():
if shape in [(1, 4), (2, 2, 3)]:
pytest.skip("SAT-7589")
x = dp.ones(shape, usm_type=usm_type)

if compute_uv_param:
Expand Down Expand Up @@ -1529,9 +1523,6 @@ def test_matrix_rank(data, tol, usm_type):
],
)
def test_pinv(shape, hermitian, usm_type):
if is_cuda_device():
if shape == (2, 2, 3):
pytest.skip("SAT-7589")
a_np = generate_random_numpy_array(shape, hermitian=hermitian)
a = dp.array(a_np, usm_type=usm_type)

Expand Down
8 changes: 1 addition & 7 deletions dpnp/tests/third_party/cupy/linalg_tests/test_norms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

import dpnp as cupy
from dpnp.tests.helper import is_cpu_device, is_cuda_device
from dpnp.tests.helper import is_cpu_device
from dpnp.tests.third_party.cupy import testing


Expand Down Expand Up @@ -63,12 +63,6 @@ class TestNorm(unittest.TestCase):
@testing.numpy_cupy_allclose(rtol=1e-3, atol=1e-4, type_check=False)
# since dtype of sum is different in dpnp and NumPy, type_check=False
def test_norm(self, xp, dtype):
if (
is_cuda_device()
and self.shape == (1, 2)
and self.ord in [-2, 2, "nuc"]
):
pytest.skip("SAT-7589")
a = testing.shaped_arange(self.shape, xp, dtype)
res = xp.linalg.norm(a, self.ord, self.axis, self.keepdims)
if xp == numpy and not isinstance(res, numpy.ndarray):
Expand Down
12 changes: 2 additions & 10 deletions dpnp/tests/third_party/cupy/linalg_tests/test_solve.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from dpnp.tests.helper import (
assert_dtype_allclose,
has_support_aspect64,
is_cuda_device,
)
from dpnp.tests.third_party.cupy import testing
from dpnp.tests.third_party.cupy.testing import _condition
Expand Down Expand Up @@ -246,23 +245,17 @@ def check_x(self, a_shape, rcond, dtype):

def test_pinv(self):
self.check_x((3, 3), rcond=1e-15)
# skip case where n < m on CUDA (SAT-7589)
if not is_cuda_device():
self.check_x((2, 4), rcond=1e-15)
self.check_x((2, 4), rcond=1e-15)
self.check_x((3, 2), rcond=1e-15)

self.check_x((4, 4), rcond=0.3)
# SAT-7589
if not is_cuda_device():
self.check_x((2, 5), rcond=0.5)
self.check_x((2, 5), rcond=0.5)
self.check_x((5, 3), rcond=0.6)

@pytest.mark.skipif(is_cuda_device(), reason="SAT-7589")
def test_pinv_batched(self):
self.check_x((2, 3, 4), rcond=1e-15)
self.check_x((2, 3, 4, 5), rcond=1e-15)

@pytest.mark.skipif(is_cuda_device(), reason="SAT-7589")
def test_pinv_batched_vector_rcond(self):
self.check_x((2, 3, 4), rcond=[0.2, 0.8])
self.check_x((2, 3, 4, 5), rcond=[[0.2, 0.9, 0.1], [0.7, 0.2, 0.5]])
Expand Down Expand Up @@ -313,7 +306,6 @@ def check_invalid_shapes(self, a_shape, b_shape):
with pytest.raises(cupy.linalg.LinAlgError):
cupy.linalg.lstsq(a, b, rcond=None)

@pytest.mark.skipif(is_cuda_device(), reason="SAT-7589")
def test_lstsq_solutions(self):
# Compares numpy.linalg.lstsq and cupy.linalg.lstsq solutions for:
# a shapes range from (3, 3) to (5, 3) and (3, 5)
Expand Down

0 comments on commit fa7ab49

Please sign in to comment.