Study parallel jobs should use multiprocessing
See original GitHub issueWhen you do parallel execution in study.optimize
(when n_jobs=-1
for example). You say with Parallel(n_jobs=n_jobs, prefer="threads") as parallel:
. See here:
https://github.com/optuna/optuna/blob/61c6a0acb22338789a83a02bb147326159f41d1e/optuna/study.py#L317
IMO this just opens (threading) which suffers from the Python Global Interpreter Lock. See here: https://joblib.readthedocs.io/en/latest/generated/joblib.Parallel.html
This would not lead to real parallel execution and is useless with CPU bound problems. I suggest to use this: with Parallel(n_jobs=n_jobs, backend="multiprocessing") as parallel:
If you want to I can provide a PR.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:16
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Parallelization with MultiProcessing in Python | by Vatsal
This article will provide an intuitive understanding of how multiprocessing works and the associated steps to use it for running your jobs ......
Read more >A Guide to Python Multiprocessing and Parallel Programming
Learn what Python multiprocessing is, its advantages, and how to improve the running time of Python programs by using parallel programming.
Read more >A Beginner's guide to parallel and concurrent programming
In this article, we discuss the differences between concurrency and parallelism as well as multi-threading and multi-processing.
Read more >Parallel For-Loop With a Multiprocessing Pool
You can convert a for-loop to be parallel using the multiprocessing.Pool class. In this tutorial you will discover how to convert a for-loop ......
Read more >Parallelising Python with Threading and Multiprocessing
However, Python DOES have a Threading library. So what is the benefit of using the library if we (supposedly) cannot make use of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@sile I see thanks
FYI. Optuna contributors are currently developing the v3 version, and there are storage/multi-process related topics (e.g., Consider storage that can be easily used with multi-process). Thus, your feedback or opinion will be welcomed I think.