Skip to content

Commit 7584c86

Browse files
Unlock skipped linalg tests that use gesv (#1791)
* Unskip tests using gesv * Update TODOs for skipped tests
1 parent 859aa9a commit 7584c86

4 files changed

Lines changed: 17 additions & 26 deletions

File tree

tests/test_linalg.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -433,10 +433,10 @@ def test_det_singular_matrix(self, matrix):
433433

434434
assert_allclose(expected, result, rtol=1e-3, atol=1e-4)
435435

436-
# TODO: remove skipif when MKLD-16626 is resolved
436+
# TODO: remove skipif when MKLD-13852 is resolved
437437
# _getrf_batch does not raise an error with singular matrices.
438438
# Skip running on cpu because dpnp uses _getrf_batch only on cpu.
439-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
439+
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-13852")
440440
def test_det_singular_matrix_3D(self):
441441
a_np = numpy.array(
442442
[[[1, 2], [3, 4]], [[1, 2], [1, 2]], [[1, 3], [3, 1]]]
@@ -652,8 +652,6 @@ def test_inv_empty(self, shape):
652652
expected = numpy.linalg.inv(a)
653653
assert_dtype_allclose(result, expected)
654654

655-
# TODO: remove skipif when MKLD-16626 is resolved
656-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
657655
@pytest.mark.parametrize(
658656
"matrix",
659657
[
@@ -680,9 +678,9 @@ def test_inv_singular_matrix(self, matrix):
680678
assert_raises(numpy.linalg.LinAlgError, numpy.linalg.inv, a_np)
681679
assert_raises(inp.linalg.LinAlgError, inp.linalg.inv, a_dp)
682680

683-
# TODO: remove skipif when MKLD-16626 is resolved
681+
# TODO: remove skip when MKLD-13852 is resolved
684682
# _getrf_batch does not raise an error with singular matrices.
685-
@pytest.mark.skip("MKLD-16626")
683+
@pytest.mark.skip("MKLD-13852")
686684
def test_inv_singular_matrix_3D(self):
687685
a_np = numpy.array(
688686
[[[1, 2], [3, 4]], [[1, 2], [1, 2]], [[1, 3], [3, 1]]]
@@ -750,12 +748,10 @@ def test_matrix_power_errors(self):
750748
assert_raises(TypeError, inp.linalg.matrix_power, a_dp, [2])
751749

752750
# not invertible
753-
# TODO: remove it when mkl>=2024.0 is released (MKLD-16626)
754-
if not is_cpu_device():
755-
noninv = inp.array([[1, 0], [0, 0]])
756-
assert_raises(
757-
inp.linalg.LinAlgError, inp.linalg.matrix_power, noninv, -1
758-
)
751+
noninv = inp.array([[1, 0], [0, 0]])
752+
assert_raises(
753+
inp.linalg.LinAlgError, inp.linalg.matrix_power, noninv, -1
754+
)
759755

760756

761757
class TestMatrixRank:
@@ -1456,8 +1452,6 @@ def test_solve_strides(self):
14561452
result = inp.linalg.solve(a_dp[::-2, ::-2], b_dp[::-2])
14571453
assert_allclose(expected, result, rtol=1e-05)
14581454

1459-
# TODO: remove skipif when MKLD-16626 is resolved
1460-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
14611455
@pytest.mark.parametrize(
14621456
"matrix, vector",
14631457
[
@@ -1595,10 +1589,10 @@ def test_slogdet_singular_matrix(self, matrix):
15951589
assert_allclose(sign_expected, sign_result)
15961590
assert_allclose(logdet_expected, logdet_result, rtol=1e-3, atol=1e-4)
15971591

1598-
# TODO: remove skipif when MKLD-16626 is resolved
1592+
# TODO: remove skipif when MKLD-13852 is resolved
15991593
# _getrf_batch does not raise an error with singular matrices.
16001594
# Skip running on cpu because dpnp uses _getrf_batch only on cpu.
1601-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
1595+
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-13852")
16021596
def test_slogdet_singular_matrix_3D(self):
16031597
a_np = numpy.array(
16041598
[[[1, 2], [3, 4]], [[1, 2], [1, 2]], [[1, 3], [3, 1]]]

tests/third_party/cupy/linalg_tests/test_decomposition.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,9 @@ def check_L(self, array):
129129
with pytest.raises(xp.linalg.LinAlgError):
130130
xp.linalg.cholesky(a)
131131

132-
# TODO: remove skipif when MKLD-16626 is resolved
133-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
132+
# TODO: remove skipif when MKLD-17318 is resolved
133+
# _potrf does not raise an error with singular matrices on CPU.
134+
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-17318")
134135
@testing.for_dtypes(
135136
[
136137
numpy.int32,

tests/third_party/cupy/linalg_tests/test_norms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ def test_det_zero_dim(self, dtype):
152152
with pytest.raises(xp.linalg.LinAlgError):
153153
xp.linalg.det(a)
154154

155-
# TODO: remove skipif when MKLD-16626 is resolved
155+
# TODO: remove skipif when MKLD-13852 is resolved
156156
# _getrf_batch does not raise an error with singular matrices.
157157
# Skip running on cpu because dpnp uses _getrf_batch only on cpu.
158-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
158+
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-13852")
159159
@testing.for_dtypes("fdFD")
160160
@testing.numpy_cupy_allclose(rtol=1e-3, atol=1e-4)
161161
def test_det_singular(self, xp, dtype):

tests/third_party/cupy/linalg_tests/test_solve.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from tests.helper import (
88
assert_dtype_allclose,
99
has_support_aspect64,
10-
is_cpu_device,
1110
)
1211
from tests.third_party.cupy import testing
1312
from tests.third_party.cupy.testing import _condition
@@ -164,9 +163,6 @@ def test_invalid_shape(self):
164163

165164

166165
class TestInvInvalid(unittest.TestCase):
167-
# TODO: remove skipif when MKLD-16626 is resolved
168-
# _gesv does not raise an error with singular matrices on CPU.
169-
@pytest.mark.skipif(is_cpu_device(), reason="MKLD-16626")
170166
@testing.for_dtypes("ifdFD")
171167
def test_inv(self, dtype):
172168
for xp in (numpy, cupy):
@@ -176,9 +172,9 @@ def test_inv(self, dtype):
176172
):
177173
xp.linalg.inv(a)
178174

179-
# TODO: remove skipif when MKLD-16626 is resolved
175+
# TODO: remove skip when MKLD-13852 is resolved
180176
# _getrf_batch does not raise an error with singular matrices.
181-
@pytest.mark.skip("MKLD-16626")
177+
@pytest.mark.skip("MKLD-13852")
182178
@testing.for_dtypes("ifdFD")
183179
def test_batched_inv(self, dtype):
184180
for xp in (numpy, cupy):

0 commit comments

Comments
 (0)