-
Notifications
You must be signed in to change notification settings - Fork 27
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
FFTW wisdom is not thread safe? #160
Comments
I think it's only the planning itself that's not threadsafe JuliaMath/FFTW.jl#66 |
actually I think even that is safe now JuliaMath/FFTW.jl#105 The other thing to be wary of is that FFTW.jl by default now plans multi-threaded FFTs (JuliaMath/FFTW.jl#121) so concurrently calling multiple FFTs from different threads may not give any speedup |
This does not appear to be true. In that I get very different results when setting FFTW.set_num_threads(8) and if I don't set it the performance monitor shows that only a single thread is used. |
And those PRs did not deal with wisdom. |
E.g. FFTW (the C library) is also thread safe, but does not allow wisdom to be shared for different numbers of threads, see the link I sent. |
Sorry, misunderstood your original point. Yes we probably need one wisdom file for each number of threads. That should be easy to implement.
That's odd, I'm pretty sure I've seen it plan multi-threaded FFTs by default. Is there a difference if you set FFTW.set_num_threads(4) instead? AFAIU it defaults to 4 threads (assuming |
So if I do not run If I do run This is on FFTW 1.2.0 and Julia 1.4.1. So it seems something is wrong. I might open an issue on this. But note that none of this changes the wisdom story. THE FFTW.jl code directly calls the FFTW c library wisdom code, so I'm sure that must be different amongst threads, and clearing the wisdom cache got rid of a nasty hard to find bug for me. EDIT: this seems to be JuliaMath/FFTW.jl#138 I'll check on FFTW master |
Nope, on FFTW master this is still not fixed. |
Actually it does work, but only for if the number of Julia threads is strictly > 1, so for 1 thread (default) it does not help. This should give a huge speedup for freespace sims. (Even for 1D sim it gives double speed). Note that FFTW.PATIENT is even longer now, as for 4 threads it asks for 16 (!) which takes an age to plan (even just for 1D) so wisdom will be really needed. |
So if Did I get that right? |
Yes, on fftw master. |
Note this is now released https://github.com/JuliaMath/FFTW.jl/releases/tag/v1.2.1 |
Yes, I asked them to release it! |
Ah fair enough 😆 |
See http://www.fftw.org/fftw3_doc/Usage-of-Multi_002dthreaded-FFTW.html
I'm still investigating but it seems that wisdom cannot be used for different numbers of threads. Perhaps have a thread specific wisdom file?
The text was updated successfully, but these errors were encountered: