Skip to content

Commit

Permalink
Merge pull request #6733 from chainer-ci/bp-6603-v10-xfail-rocm-5.0-l…
Browse files Browse the repository at this point in the history
…obpcg

[backport] Xfail a test of LOBPCG on ROCm 5.0+
  • Loading branch information
kmaehashi committed Jun 14, 2022
2 parents dd81198 + a38a5bb commit 159eb88
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/cupyx_tests/scipy_tests/sparse_tests/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1172,19 +1172,33 @@ def test_random_initial_float32(self, xp, sp):
verbosityLevel=1)
return eigvals, _eigen_vec_transform(vecs, xp)

@pytest.mark.xfail(
runtime.is_hip and driver.get_build_version() >= 5_00_00000,
reason='ROCm 5.0+ may have a bug')
def test_maxit_None(self):
"""Check lobpcg if maxit=None runs 20 iterations (the default)
by checking the size of the iteration history output, which should
be the number of iterations plus 2 (initial and final values).
"""
def make(xp, sp):
vals = -xp.arange(1, n + 1)
A = sp.diags([vals], [0], (n, n))
A = A.astype(xp.float32)
X = testing.shaped_random((n, m), xp=xp, seed=1566950023)
return A, X
n = 50
m = 4
vals = -cupy.arange(1, n + 1)
A = sparse.diags([vals], [0], (n, n))
A = A.astype(cupy.float32)
X = testing.shaped_random((n, m), xp=cupy, seed=1566950023)
_, _, l_h = sparse.linalg.lobpcg(A, X, tol=1e-8, maxiter=None,
retLambdaHistory=True)
A, X = make(cupy, sparse)
w, _, l_h = sparse.linalg.lobpcg(
A, X, tol=1e-8, maxiter=None, retLambdaHistory=True)

# Assert the eigenavlues against SciPy
A_np, X_np = make(numpy, scipy.sparse)
w_np, _ = scipy.sparse.linalg.lobpcg(
A_np, X_np, tol=1e-8, maxiter=None)
testing.assert_allclose(w, w_np, rtol=1e-5)

# Assert the number of iterations
assert len(l_h) == 22


Expand Down

0 comments on commit 159eb88

Please sign in to comment.