From 4705fbe551679829073514615ef9554a7d15748b Mon Sep 17 00:00:00 2001 From: Daniel_Doehring Date: Fri, 8 Dec 2023 10:09:39 +0100 Subject: [PATCH] Switch back to built-in Julia threads --- src/auxiliary/auxiliary.jl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/auxiliary/auxiliary.jl b/src/auxiliary/auxiliary.jl index 1f7d30d6aa8..b2f7a48302f 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 $(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,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