anthonix / ffts

The Fastest Fourier Transform in the South
http://anthonix.com/ffts
Other
536 stars 213 forks source link

ffts_init_1d slow? #31

Closed FlorianIragne closed 9 years ago

FlorianIragne commented 9 years ago

Hi,

i've a library that is able to use several FFTs (FFTS, FFTW3, my own one, OSX, etc). I've run a benchmark to check that FFTS was at least as fast as FFTW3, an found that FFTW3 is 9 times faster.

My benchmark was badly designed: i ran the fft compute in a for loop, but also init the fft at each loop.

Once corrected (i.e., fft init before the for loop), FFTS is a bit faster than FFTW3.

So, i guess that the fft_init_1d step is really slow compared to FFTW3 equivalent.

Is it a known issue, or is it expected behaviour?

thanks for your answer

meaticulous commented 9 years ago

In short: this IS expected behavior.

FFTS has an on-the-fly compiler for Fourier transformations that is called in fft_init_1d. So every time you call the init procedure, the internal compiler generates the FFT procedure anew. FFTW3 has a different approach: it uses precompiled codelets and uses the ones that seem to fit best to your architecture and problem dimensions. It will also remember previous decisions as long as you use the same dimensions, so this is why the setup speed of FFTW3 may seem faster. If you really want to compare setup speeds, you should prevent FFTW3 from using previous knowledge.

In any case, pulling the setup out of the loop is the correct way, be it FFTS or FFTW3. And as you are saying, FFTS is slightly faster in that case.

FlorianIragne commented 9 years ago

Ok,

thanks for the exlanations