Saving FFTW plans for future use

Is there anyway to save and load FFTW plans?

For example:

using FFTW

sz = 2^13
ar = rand(ComplexF64,(sz,sz));
pthread =FFTW.plan_fft!(ar,flags=FFTW.MEASURE);
inv(pthread);
pthreadpatient =FFTW.plan_fft!(ar,flags=FFTW.PATIENT);
inv(pthreadpatient);

For large data, planning with FFTW.PATIENT takes a huge amount of time but may well be worth the initial wait.
However, if you know your data is going to be the same size the next time you start up Julia, there should be a way to save these FFTW plans to be used again.

Any thoughts?

FFTW FAQ: Can I save FFTW’s plans? In Julia, you can call FFTW.export_wisdom(filename) to save to a file, and FFTW.import_wisdom(filename) to import.

2 Likes

Thanks @stevengj!