-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allocations when multi-threading #240
Comments
|
Thanks for the information. Is there a way to change the threading system (not the provider) to let it allocation free? |
Julia has https://github.com/JuliaSIMD/Polyester.jl, which should be able to replace Lines 56 to 60 in 17bc81a
with function spawnloop(f::Ptr{Cvoid}, fdata::Ptr{Cvoid}, elsize::Csize_t, num::Cint, callback_data::Ptr{Cvoid})
@batch per=core for i = 0:num-1
ccall(f, Ptr{Cvoid}, (Ptr{Cvoid},), fdata + elsize*i)
end
end (I didn't test it, so don't except this to work!!!!!) But I'm affraid this won't help the performance. FFT it self is much more heavy than the allocation. |
Thank you very much! I'll test it later. |
I can confirm this issue, I haven't noticed it in the past. julia> using FFTW, BenchmarkTools
julia> x = randn((1024, 1024));
julia> FFTW.set_num_threads(8)
julia> @btime ifft($x);
7.646 ms (17810 allocations: 33.20 MiB)
julia> FFTW.set_num_threads(4)
julia> @btime ifft($x);
6.362 ms (115 allocations: 32.01 MiB)
julia> FFTW.set_num_threads(6)
julia> @btime ifft($x);
10.943 ms (38485 allocations: 34.27 MiB) |
When activate multithreading by
FFTW.set_num_threads()
, it become slower and allocate more.The provider here is the default "fftw".
But when using "mkl", it just use multithreading automatically depending on the problem size and allocation is 0.
Here are some benchmarks
And
The text was updated successfully, but these errors were encountered: