Skip to content

Commit

Permalink
Switch back to built-in Julia threads
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Dec 8, 2023
1 parent 3d899bc commit 4705fbe
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 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 $(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,10 +241,11 @@ macro threaded(expr)
# them) available in Julia.
# !!! danger "Heisenbug"
# Look at the comments for `wrap_array` when considering to change this macro.

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

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

0 comments on commit 4705fbe

Please sign in to comment.