YAXArrays.jl icon indicating copy to clipboard operation
YAXArrays.jl copied to clipboard

Should we use `@threads :greedy` for the innerloop threading?

Open felixcremer opened this issue 10 months ago • 0 comments

According to the documentation of @threads this is the scheduler that would work best for non-uniform running times in different threads.

:greedy scheduler spawns up to Threads.threadpoolsize() tasks, each greedily working on the given iterated values as they are produced. As soon as one task finishes its work, it takes the next value from the iterator. Work done by any individual task is not necessarily on contiguous values from the iterator. The given iterator may produce values forever, only the iterator interface is required (no indexing).

This scheduling option is generally a good choice if the workload of individual iterations is not uniform/has a large spread.

felixcremer avatar Jan 15 '25 09:01 felixcremer