Skip to content
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

[TKW] Avoid nested multiprocessing.Pool usage #333

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

Hardcode84
Copy link
Contributor

Processes created by multiprocessing.Pool have daemon flag which forbids to create child processes (e.g. from nested multiprocessing.Pool). Fallback to single-process compilation in this case. This fixes a crash when compilation itself is called from inside multiprocessing.Pool processes.

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
@@ -229,7 +230,11 @@ def all_pairs_longest_paths(
# Parallel implementation
for k in range(N):
func = partial(all_pairs_longest_path_parallel, N, D, k)
results = pool.map(func, range(N))
if pool is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment explaining what would be the right way to do this?

Copy link
Contributor

@harsh-nod harsh-nod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this! Please add a comment explaining how we would do nested multiprocessing loops so someone else can take that on.

Signed-off-by: Ivan Butygin <ivan.butygin@gmail.com>
@Hardcode84 Hardcode84 enabled auto-merge (squash) December 13, 2024 19:24
@Hardcode84 Hardcode84 merged commit 3972153 into iree-org:main Dec 13, 2024
10 checks passed
@Hardcode84 Hardcode84 deleted the fix-pool branch December 13, 2024 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants