Skip to content

Commit 79bd9cc

Browse files
committed
TST: add a test for lapack_lite thread safety
1 parent 3a4e776 commit 79bd9cc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

numpy/_core/tests/test_multithreading.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,16 @@ def func(count):
7171
(alarge + blarge) - 2
7272

7373
run_threaded(func, 100, pass_count=True)
74+
75+
76+
def test_eigvalsh_thread_safety():
77+
# if lapack isn't thread safe this will randomly segfault or error
78+
# see gh-24512
79+
rng = np.random.RandomState(873699172)
80+
matrices = (
81+
rng.random((5, 10, 10, 3, 3)),
82+
rng.random((5, 10, 10, 3, 3)),
83+
)
84+
85+
run_threaded(lambda i: np.linalg.eigvalsh(matrices[i]), 2,
86+
pass_count=True)

0 commit comments

Comments
 (0)