File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -161,3 +161,17 @@ def test_matrix_rank_rtol_argument(self, rtol):
161
161
x = np .zeros ((4 , 3 , 2 ))
162
162
res = np .linalg .matrix_rank (x , rtol = rtol )
163
163
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" )
You can’t perform that action at this time.
0 commit comments