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

Switch back to built-in Julia threads #1768

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions src/auxiliary/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,15 @@ macro threaded(expr)
# standard library with an additional check whether only a single thread is used
# to reduce some overhead (and allocations) for serial execution.
#
# return esc(quote
# let
# if Threads.nthreads() == 1
# $(expr)
# else
# Threads.@threads $(expr)
# end
# end
# end)
return esc(quote
let
if Threads.nthreads() == 1
$(expr)
else
Threads.@threads :static $(expr)
end
end
end)
#
# However, the code below using `@batch` from Polyester.jl is more efficient,
# since this packages provides threads with less overhead. Since it is written
Expand All @@ -241,12 +241,14 @@ macro threaded(expr)
# them) available in Julia.
# !!! danger "Heisenbug"
# Look at the comments for `wrap_array` when considering to change this macro.
#=

# By using `Trixi.@batch` we allow users of Trixi.jl to use `@threaded` without having
# Polyester.jl in their namespace.
return esc(quote
Trixi.@batch $(expr)
end)
=#
end

# @trixi_timeit timer() "some label" expression
Expand Down
Loading