Add :greedy scheduler to @threads#52096
Conversation
|
Some initial benchmarks: https://github.com/carstenbauer/parallel-julia-zoo/tree/greedy/multithreading In particular, see the
The worst result is probably found in the |
To reference the conversation on slack, that benchmark was run with N = 10_000 and 8 threads, so 80_000 elements in the input array or about 64 KiB of data. With 800 chunks, that's a miniscule amount of data per chunk, increasing the overhead dramatically. I'll keep that in mind for the docs of In general, I don't expect |
|
A bit of an aside, but could we actually make |
I was thinking about that too while implementing this, but that's likely something better suited for another PR later. I thought about this in particular because I originally wanted to just have this implementation be a replacement for
Emphasis mine. The problem with this is that we can't then swap the underlying implementation to be greedily work stealing (or otherwise loadbalancing on a per-item basis), since that would result in the regions/items worked on no longer being contiguous for any given task. In essence, this makes |
|
Does this need anything else? |
|
CI failures seem unrelated. Does this need anything else? |
|
No idea what the SparseArrays build/test failures mean. This shouldn't touch them at all. Is this just master being flaky master again? Other than that, @vtjnash if you agree I think this is good to go. |
|
What's the status here? |
|
Thank you! |
This implements a very greedy scheduler for
@threads, spawning up tothreadpoolsize()tasks that greedily work on the elements from the iterator as they are produced. This scheduler supports infinite iterators.Needs