question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Study parallel jobs should use multiprocessing

See original GitHub issue

When 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:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
profPlumcommented, Feb 23, 2022

@sile I see thanks

1reaction
silecommented, Feb 23, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found