numpy / numpy/numpy

ENH: Optimize the FFT implementation

Open
#17,839 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
32.8k
Forks
12.8k
Avg merge
1d 7h
Merged PRs (30d)
197

Description

Fast Fourier transforms are widely used for applications in engineering, music, science, and mathematics.The current fft implementation was introduced two years ago(#11885, #11888 ), which is not the best implementation as far as I know, The drawbacks includes:

  • Don't supports single precision transforms.
  • Don't support for multi-D transforms.
  • Don't make use of vector instructions for FFTs, The main reason that It's performance is not good enough(At least better than fftpack).

Although the author published the C++ based pypocketfft later, which has overcame these shortcomings, but It's was not compatible with C based numpy, I found out that there has several backend projects that worth considering.

project worth introducing?
fftw3 Most popular FFT library, which nowadays is the "gold standard" for FFT implementations. It's also the default fft algorithm of matlab, there has a python wrapper pyfftw, can't integrated due to it's GPL Licence.
Intel MKL/IPP Significantly faster than FFTW with intel processors, already integrated as a third party lib.
KFR Claims to be faster than FFTW, can't integrated due to it's commecial Licence.
FFTS reported to be faster than FFTW because the use of SIMD instructions, at least in some cases. worth considering.
FFTE reported to be faster than FFTW, but the source code is Fortran-based.
Ooura FFT provide C and Fortran version implementation, but It hasn't been updated in a long time.
muFFT/pffft/PGFFT have performance comparable to FFTW.depends strongly on the SIMD instructions. but with limited features.
KissFFT/PocketFFT The simplest but also the slowest one here, which is the current solution.

Now we have two options:

  • choose a new backend system such as FFTS, which is painful because of the trival adaptation process.
  • optimize the current algorithm based on universal intrinsics, which is more practical and operable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing NumPy's current FFT implementation and the history in issues #11885 and pull request #11888. Compare the proposed FFTS, pypocketfft, and universal-intrinsics approaches, including their licensing and support for single-precision and multidimensional transforms. Done requires an agreed backend or optimization plan with improved performance and the missing transform support.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, cpp, python
Domain
backend, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.