Release the GIL on calls to mumps
Releases the GIL on calls to the mumps library function mumps_c
. This call can take a large amount of time during analysis, factorization, and solve stages. Releasing the GIL during this time allows for other python threads to continue moving forward (e.g. it would allow dask threads to continue talking to each other).
However, calls to mumps using the same mumps structure are not threadsafe and must be protected with a lock, (so this implements it using pythread locks). The lock is initialized in the cdef class
's __cinit__
function. This function is gauranteed to be called when the object (or any subclasses of it) is created. This means the user doesn't need to ensure a call to super().__init__(...)
in a subclass for it to still work properly.
Since there is a __cinit__
function now, it also moves the relevant c initialization parts of the mumps cdef class
(mostly for the same reasons as above). The __cinit__
is gauranteed to be called, and only called once for each instance of the class.