Skip to content

pyFFTW vs MATLAB FFT #19

@NimaSarajpoor

Description

@NimaSarajpoor

pyfftw_sdp is one of the fast methods in computing the sliding-dot-product of two arrays. It uses pyfftw, a wrapper around FFTW, the core algorithm behind MATLAB FFT. So, it is worthwhile to compare pyFFTW and MATLAB FFT to see how close they are to each other from performance perspective.

Note that MATLAB FFT does not support RFFT. Since RFFT is what we care about from sliding-dot-product's perspective, the following comparison is between pyfftw RFFT and MATLAB FFT. The following figures reflect the performance of pyFFTW (RFFT) w.r.t MATLAB (FFT). The timing scripts were executed on MATLAB online, and you can find the scripts attached at the bottom of this comment.


The functions, i.e. FFT or RFFT, are called 100 times for each case, and the average of the running time is recorded.

1-Thread pyFFTW (RFFT) vs 1-Thread MATLAB (FFT)

Image

1-, 2-, 4-, 8- Threaded pyFFTW (RFFT) vs 8-Threaded MATLAB (FFT)

Image

It is interesting to see that single-threaded pyFFTW RFFT outperforms MATLAB FFT in almost all cases even if it uses 8 threads.


To double check the performance, I increased the number of iterations per case from 100 to 10000. The maximum length of arrays is set to 2^20.

Image Image

Scripts used for timing:

run_FFT_MATLAB.zip
run_pyfftw_on_MATLAB.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions