The following suboptimal behavior of the parallel map has been observed:
53.927 s (82132566 allocations: 2.81 GiB) 2.011 s (8000041 allocations: 167.85 MiB) 18.922 ms (2 allocations: 7.63 MiB) 20.058 ms (3 allocations: 7.63 MiB)
The above was obtained with
N = 1_000_000 a = rand(N) + rand(N)*1im using BenchmarkTools using Distributed addprocs(2) @btime aa = pmap(x -> abs(x), $a) rmprocs(workers()) @btime aa = pmap(x -> abs(x), $a) @btime aa = abs.($a) @btime aa = map(x -> abs(x), $a)
pmap allocates a lot of memory, and it is slow.
I don’t have an explanation for that. Do you?
Julia Version 1.3.0-DEV.466 Commit 8d4f6d24c0 (2019-06-28 18:40 UTC) Platform Info: OS: Windows (x86_64-w64-mingw32) CPU: Intel(R) Core(TM) i7-8705G CPU @ 3.10GHz WORD_SIZE: 64 LIBM: libopenlibm LLVM: libLLVM-6.0.1 (ORCJIT, skylake) Environment: JULIA_EDITOR = "C:\Users\PetrKrysl\AppData\Local\atom\app-1.38.2\atom.exe" -a JULIA_NUM_THREADS = 4