Open MasonProtter opened 7 months ago
I agree, this could be useful. If we want to implement new schedulers - say a dynamic load-balancing one that only uses a fixed subset of the threads - we probably need/want something like this. However, this is isn't just more advanced from a users POV but also (much?) more ambitious for us. AFAIR, Polyester jumps through a number of hoops to make the basics of this work.
I think it doesn't necessarily need to be so complicated as Polyester, e.g. here's a much simpler go at the same idea: https://github.com/JuliaFolds2/FoldsThreads.jl/blob/master/src/taskpool.jl
but yes, this'd require a lot of design work to figure out properly. Not a short-term idea.
Potentially related to or overlapping with https://github.com/JuliaFolds2/OhMyThreads.jl/issues/75, I think it'd be good if there was a scheduler that had a pre-allocated set of
Task
s stored inside it that are then re-used, like how Polyester.jl handles its tasks.This could help users avoid allocations and GC-latency, and also potentially do other things like re-use
TaskLocalValues
between multiple calls totmapreduce
. Definitely an advanced feature we shouldn't recommend to everyone, but in certain circumstances, it could be useful.