-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: sparse.linalg: add locks to ensure ARPACK threadsafety #5848
Conversation
The ARPACK fortran code uses SAVE variables, and is not threadsafe or re-entrant. Add locks and reentrancy checks to the Python side to deal with this issue --- previously the code used to segfault. As we use an explicit lock, it is not necessary for the Fortran code to hold the GIL, so adjust the .pyf file accordingly. Fixes scipygh-5846
@@ master #5848 diff @@
======================================
Files 236 237 +1
Stmts 43344 43374 +30
Branches 8134 8135 +1
Methods 0 0
======================================
+ Hit 33803 33832 +29
- Partial 2585 2586 +1
Missed 6956 6956
|
LGTM as is. However, this will mean that we have two slightly different versions of reentrancy check code in |
refactored |
@@ -42,6 +42,8 @@ | |||
|
|||
__all__ = ['eigs', 'eigsh', 'svds', 'ArpackError', 'ArpackNoConvergence'] | |||
|
|||
import contextlib | |||
import threading |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports aren't necessary anymore I don't think.
3978f43
to
b272920
Compare
removed unnecessary imports |
BUG: sparse.linalg: add locks to ensure ARPACK threadsafety
Thanks, merged. |
The ARPACK fortran code uses SAVE variables, and is not threadsafe or
re-entrant. Add locks and reentrancy checks to the Python side to deal
with this issue --- previously the code used to segfault.
As we use an explicit lock, it is not necessary for the Fortran code to
hold the GIL, so adjust the .pyf file accordingly.
Fixes gh-5846