[SciPy-Dev] default scipy fft performance

Sturla Molden sturla@molden...
Fri Dec 21 10:14:16 CST 2012

Den 21. des. 2012 kl. 16:16 skrev Paul Anton Letnes <paul.anton.letnes@gmail.com>:

> Dear Scipy devs,
> 1) thanks for doing a great job in general!
> 2) Why is there a huge performance difference between scipy.fft and scipy.fftpack.fft? It apperars that scipy.fft == numpy.fft:
> In [4]: import numpy as np
> In [5]: from scipy import fft
> In [6]: from scipy import fftpack
> In [7]: d = np.linspace(0, 1e3, 1e7)
> In [8]: %timeit np.fft.fft(d)
> 1 loops, best of 3: 1.29 s per loop
> In [9]: %timeit fft(d)
> 1 loops, best of 3: 1.3 s per loop
> In [10]: %timeit fftpack.fft(d)
> 1 loops, best of 3: 651 ms per loop

They are not the same. SciPy fftpack is fortran FFTPACK. NumPy uses the C coded fftpack-lite. The wrappers are also different, and SciPy can modify arrays inplace.

> 3) On a related note - what's the best performing python fft library/wrapper out there? I take it from some google research I did that e.g. fftw cannot be used due to the GPL licence.

If you use EPD, numpy.fft will use MKL. That will be about as fast as it gets.


FFTW is GPL, but you can use it if GPL is ok. It usually is: If you can use Linux, you can use FFTW as well. 

ACML is also an option. It is not as fast as MKL or FFTW, but faster than FFTPACK.

You can also call MKL, ACML or FFTW directly using Cython, f2py or ctypes.

There is also a TVirtualFFT in ROOT, that uses FFTW. ROOT has a Python interface as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20121221/5ba56754/attachment-0001.html 

More information about the SciPy-Dev mailing list