Sat, 28 Dec 2019 02:08:30 +0200
@threadsif
src/Util.jl | file | annotate | diff | comparison | revisions |
--- a/src/Util.jl Fri Dec 27 22:04:49 2019 +0200 +++ b/src/Util.jl Sat Dec 28 02:08:30 2019 +0200 @@ -23,7 +23,21 @@ mean, proj_norm₂₁ball!, curry, - ⬿ + ⬿, + @threadsif + + +########## +# Threads +########## + +macro threadsif(threads, loop) + return esc(:(if $threads + Threads.@threads $loop + else + $loop + end)) +end ######################## # Functional programming