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

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

Open
DanielDoehring opened this issue Dec 11, 2023 · 6 comments
Labels
parallelization Related to MPI, threading, tasks etc. performance We are greedy

Comments

@DanielDoehring
Copy link
Contributor

DanielDoehring commented Dec 11, 2023

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

# return esc(quote
# let
# if Threads.nthreads() == 1
# $(expr)
# else
# Threads.@threads $(expr)
# end
# end
# end)

instead of

return esc(quote
Trixi.@batch $(expr)
end)

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: #1766 and JuliaSIMD/Polyester.jl#128

@DanielDoehring DanielDoehring added performance We are greedy parallelization Related to MPI, threading, tasks etc. labels Dec 11, 2023
@DanielDoehring DanielDoehring changed the title Allocations for Julia built-in @threads instead of Polyester @batch Allocations for Julia built-in @threads in contrast to Polyester @batch Dec 12, 2023
@jlchan
Copy link
Contributor

jlchan commented Apr 16, 2024

Does Threads.@threads :static help at all?

@DanielDoehring
Copy link
Contributor Author

Does Threads.@threads :static help at all?

I.e.,

Threads.@threads :static $(expr) 

?

@jlchan
Copy link
Contributor

jlchan commented Apr 16, 2024

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.

@DanielDoehring
Copy link
Contributor Author

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

@DanielDoehring
Copy link
Contributor Author

Hm, this is not really looking good: #1768

@ranocha
Copy link
Member

ranocha commented Apr 17, 2024

:static is required to make it correct (see #1768 (comment)) but I would not expect to see a difference in allocations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parallelization Related to MPI, threading, tasks etc. performance We are greedy
Projects
None yet
Development

No branches or pull requests

3 participants