Is it possible enable multi-threading in RustFFT?
Currently, fftw has a multi-threading option
Is it possible enable multi-threading in RustFFT?
I searched for keywords like parallel and thread but found nothing.
And a simple test shows a only 100% CPU time, which means RustFFT does not enable multi-threading by default.
Would RustFFT support multi-threading in the future?
This could be done by adding a variant of the MixedRadix algorithm that uses rayon iterators instead of normal iterators for its inner width/height FFTs, and a custom transpose path that uses the rayon recursion feature. Then edit the planner to swap the topmost MixedRadix step with the multithreaded version. For Radix4, making that be multithreaded would be nontrivial. But what we could do is inject a ParallelMixedRadix step to divide the radix4 into 8 or 16 smaller radix4s.
And a similar process would need to be done for the AVX code path.
I'm not against it, the current architecture is explicitly designed to be highly modular to make changes like this possible, but it would be a relatively big undertaking.
Quick, somewhat related question: Is RustFFT thread-safe? (noting that FFTW is not thread-safe)
Instances of the FFT trait are completely thread safe. Instance of the FftPlanner require &mut self in order to call the plan() methods, so planners have to be stored inside a mutex in order to be used from multiple threads.
It is 100% thread safe to use one planner instance from one thread, and simultaneously use another planner instance from another thread
On Tue, Apr 23, 2024 at 4:09 PM Dorival Pedroso @.***> wrote:
Quick, somewhat related question: Is RustFFT thread-safe? (noting that FFTW is not thread-safe)
— Reply to this email directly, view it on GitHub https://github.com/ejmahler/RustFFT/issues/117#issuecomment-2073632733, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAI2M6SPYPWW5V6JBPGEESLY63S2BAVCNFSM6AAAAAAW54WNU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZTGYZTENZTGM . You are receiving this because you commented.Message ID: @.***>