-
Notifications
You must be signed in to change notification settings - Fork 62
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
[Enhancement] Release GIL #86
Comments
Here is a quick thought on this: all the calculation is done in C++ where we can multithread without releasing the GIL. We could make a new entry point on the Python side that can take several input arrays and process them simultaneously. This is a compromise that does not give full flexibility but is safer on the Python side. Would this suit your use case? (With the limited time I have available I am going to focus on getting an update out that adds 3.12 compatibility and I want to work on the higher order narrowband initialization.) |
Hi Jason, that proposition would change the API and is not a drop-in to the existing implementation. Best, |
@jkfurtney if this is too hacky, we can (1) introduce a second method with the same signature which is releasing the GIL for the computation. Or (2) introduce a keyword to release the GIL. Both options are backwards compatible. What do you think? |
Releasing the GIL during marching would open this library for threaded applications and provide a very significant speed up to many use cases.
I am aware of #67 #36 and propose a re-evaluation of releasing the GIL.
@jkfurtney concern that manipulating the input data during marching is reasonable, but can be mitigated effectively by flagging the input numpy arrays read-only during marching.
https://numpy.org/doc/stable/reference/c-api/array.html#c.PyArray_ENABLEFLAGS
The benefits of efficient multi-threading justify the costs.
The text was updated successfully, but these errors were encountered: