diff --git a/src/auxiliary/auxiliary.jl b/src/auxiliary/auxiliary.jl index 972a748c56b..bb12b2db99d 100644 --- a/src/auxiliary/auxiliary.jl +++ b/src/auxiliary/auxiliary.jl @@ -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 @@ -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