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

Overhead scales non-monotonically with pmap batch_size #311

Open
Socob opened this issue Apr 26, 2024 · 2 comments
Open

Overhead scales non-monotonically with pmap batch_size #311

Socob opened this issue Apr 26, 2024 · 2 comments

Comments

@Socob
Copy link

Socob commented Apr 26, 2024

I’ve noticed that for large values of pmap’s batch_size parameter, the progress meter overhead becomes large, which is especially significant since in the cases where you’d want to increase batch_size (individual items are cheap to compute), this makes the overhead dominate over the actual computation.

Example:

using Distributed
addprocs(6)
@everywhere using ProgressMeter
for batch_size in round.(Int, 10 .^ range(0, 4, length=20))
    @show batch_size
    @showprogress pmap(i -> nothing, 1:200_000; batch_size);
end

Plot of execution time vs. batch_size

So it looks like (in this case?) that there’s a “sweet spot” around batch_size=20. I found this surprising, so I’m not sure what the reason is! But it would be good if this behaved better for large batch_size.

@Socob Socob changed the title Overhead scales non-linearly with pmap batch_size Overhead scales non-monotonically with pmap batch_size Apr 26, 2024
@MarcMush
Copy link
Collaborator

what happens in the loop is only put!(channel, true), and I see the same behavior when doing only this (I only tested with 20_000 because I don't have that much patience)

channel = RemoteChannel(()->Channel{Bool}(20_000))
@elapsed pmap(i -> put!(c, true), 1:20_000; batch_size);

so I don't see how we can improve this

@Socob
Copy link
Author

Socob commented Jul 15, 2024

Hm, I see. So it rather seems an issue with pmap/asyncmap?

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

No branches or pull requests

2 participants