-
Notifications
You must be signed in to change notification settings - Fork 66
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
Support for Multi-Threading with PythonCall? #330
Comments
This issue has been marked as stale because it has been open for 30 days with no activity. If the issue is still relevant then please leave a comment, or else it will be closed in 7 days. |
Because of the GIL, Python itself has poor support for multithreading, because only one thread can hold the GIL at a time, and this is required to do anything Pythonic. Hence multithreading is only useful in Python if you are doing a lot of work which can release the GIL (such as IO or long-running numerical routines written in C). In general, if you want to parallelise Python it's generally better to use multiprocessing instead of multithreading. So there are no plans for PythonCall to support it. |
Thank you for taking the time to report this issue! |
Are there any plans to support multi-threading with
PythonCall.jl
in the near future? Almost everything about this package is superior toPyCall.jl
except for thread safety.Specifically, it would be great (and in my case - is essential) to be able to call python functions on many threads in parallel. This is useful when a core routine is written in python and needs to be called many time independently.
For example, some environments in
ReinforcementLearning.jl
rely on the python bindings to MuJoCo. Evaluating these environments efficiently requires multi-threading (eg: this implementation withPyCall.jl
), which is currently impossible inPythonCall
.Is this something you would consider supporting in the near future?
The text was updated successfully, but these errors were encountered: