8000 add test for issue 27036 · numpy/numpy@b19b685 · GitHub
[go: up one dir, main page]

Skip to content

Commit b19b685

Browse files
committed
add test for issue 27036
1 parent e125e3c commit b19b685

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

numpy/linalg/tests/test_regression.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,17 @@ def test_matrix_rank_rtol_argument(self, rtol):
161161
x = np.zeros((4, 3, 2))
162162
res = np.linalg.matrix_rank(x, rtol=rtol)
163163
assert res.shape == (4,)
164+
165+
def test_openblas_threading(self):
166+
# gh-27036
167+
# Test whether matrix multiplication involving a large matrix always gives the same answer
168+
x = np.arange(500000, dtype=np.float64)
169+
src = np.vstack((x, -10*x)).T
170+
matrix = np.array([[0, 1], [1, 0]])
171+
expected = np.vstack((-10*x, x)).T # src @ matrix
172+
for i in range(200):
173+
result = src @ matrix
174+
mismatches = (~np.isclose(result, expected)).sum()
175+
if mismatches != 0:
176+
assert False, ("unexpected result from matmul, "
177+
"probably due to OpenBLAS threading issues")

0 commit comments

Comments
 (0)
0