Has anyone made some (good) experiences with MT on the Mac? I have a code that runs well MTed on Linux (up to 64 cores w/ corresponding number of threads), but it clearly leaves some performance on the table when run on the Mac…
I have some multithreaded code (but only 4 cores) which seems to work fine (but I did not time things properly). There was also this thread somewhat recently regarding thread overhead, maybe that’s of any help to you.
Note that multithreaded code can also be hit by this unpleasant closure bug. There was also recently a PR to resolve bad performance for one specific multithreading pattern:
function threaded_sum(arr)
@assert length(arr) % nthreads() == 0
results::Vector{Float64} = zeros(eltype(arr), nthreads())
@threads for tid in 1:nthreads()
# split work
len = div(length(arr), nthreads())
domain = ((tid-1)*len +1):tid*len
acc = zero(eltype(arr))
@simd for i in domain
@inbounds acc += arr[i]
end
results[tid] = acc
end
sum(results)
end