fftw

Management of fftw threaded / non-threaded wisdom


I'm using FFTW's wisdom feature to speed up my FFTs and it's working well. Next I'd like to enable FFTW threading using OMP to achieve an additional speed-up on large FFTs (I'm taking FFTs of very large (image-sized) objects, so I hope the speed-up should be worth the overhead.

I'm unsure about how to handle wisdom though. The FFTW documentation states: "if you save wisdom from a program using the multi-threaded FFTW, that wisdom cannot be used by a program using only the single-threaded FFTW", but it doesn't say anything about how to manage threaded and non-threaded wisdom on the same system, and some other programs on the system (and in fact some other parts of the program I'm working on) may use single-threaded FFTW plans, so there is the possibility of ending up with wisdom from both threaded and non-threaded plans.

Do I need to do anything to manage this, for example ensuring that threaded and non-threaded wisdom files are kept separate, or can I just save everything to a single wisdom file and assume FFTW will manage the appropriate wisdom for threaded and non-threaded FFTs itself?

On a similar note, is it safe to mix fftw and fftwf (and, I guess, fftwq) wisdom in the same file or should they be separated? The line entries start with fftw_ and fftwf_ respectively so it looks like it should be okay but I'd be happy of confirmation.


Solution

  • You can simply pass a different filename to fftw_export_wisdom_to_filename() and fftw_import_wisdom_from_filename(), depending whether you use multithreading or not. That way you keep the wisdom separate. This is the way I handled the issue in the past. Saving and loading the wisdom to the same file will not work properly.