Skip to content

Commit b31463f

Browse files
committed
Add nogil declaration to _run_paradiso function
This releases the Python GIL around the low level paradiso solver call. Hopefully this allows this library and dependent libraries (like SimPEG) to operate more smoothly in a multi-threaded environment. This should be safe from a Python object perspective because no Python objects are created/destroyed/inc-reffed during this call. It could still be that multiple concurrent calls of this function on the same data cause undesried results, but hopefully downstream users can apply concurrency primitives (like locks) as needed.
1 parent bbd5658 commit b31463f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

pydiso/mkl_solver.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ cdef class MKLPardisoSolver:
530530
if err!=0:
531531
raise PardisoError("Solve step error, "+_err_messages[err])
532532

533-
cdef int _run_pardiso(self, int_t phase, void* b=NULL, void* x=NULL, int_t nrhs=0):
533+
cdef int _run_pardiso(self, int_t phase, void* b=NULL, void* x=NULL, int_t nrhs=0) nogil:
534534
cdef int_t error=0
535535
cdef long_t error64=0, phase64=phase, nrhs64=nrhs
536536

0 commit comments

Comments
 (0)