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

Allocations for Julia built-in @threads in contrast to Polyester @batch

Open DanielDoehring opened this issue 6 months ago • 6 comments

If we use the Julia built-in @threads instead of the Polyester.jl by out-commenting the relevant section

https://github.com/trixi-framework/Trixi.jl/blob/3d899bc3a301bdc40fc57afb95ea9e88ab10c459/src/auxiliary/auxiliary.jl#L227-L235

instead of https://github.com/trixi-framework/Trixi.jl/blob/3d899bc3a301bdc40fc57afb95ea9e88ab10c459/src/auxiliary/auxiliary.jl#L245-L247

there are allocations in several elixirs, see a CI run from a hot-fix aimed PR., with very severe ones for the parabolic parts.


Related: https://github.com/trixi-framework/Trixi.jl/issues/1766 and https://github.com/JuliaSIMD/Polyester.jl/issues/128

DanielDoehring avatar Dec 11 '23 10:12 DanielDoehring

Does Threads.@threads :static help at all?

jlchan avatar Apr 16 '24 14:04 jlchan

Does Threads.@threads :static help at all?

I.e.,

Threads.@threads :static $(expr) 

?

DanielDoehring avatar Apr 16 '24 15:04 DanielDoehring

As a for loop annotation - e.g., Threads.@threads :static for ....

It seemed to do pretty well compared to Polyester in some of my experiments.

jlchan avatar Apr 16 '24 15:04 jlchan

Hm interesting, I should be able to change the PR relatively quickly.

DanielDoehring avatar Apr 16 '24 15:04 DanielDoehring

Hm, this is not really looking good: https://github.com/trixi-framework/Trixi.jl/pull/1768

DanielDoehring avatar Apr 17 '24 08:04 DanielDoehring

:static is required to make it correct (see https://github.com/trixi-framework/Trixi.jl/pull/1768#discussion_r1420161554) but I would not expect to see a difference in allocations

ranocha avatar Apr 17 '24 10:04 ranocha