Skip to content

Fix performance when using 3d arrays #59

Open
@slingyropert

Description

@slingyropert

I installed Intel Python on Windows 10, the version of mkl_fft is 1.3.0 and it is package py37h5a85a7c_0.

If one does a 2D FFT on a ndim=3 array, the resulting computation takes much longer than doing the same 2D FFT on an ndim=2 array. For example:

In [1]: import numpy as np, mkl_fft
In [2]: a = np.ones((4096,4096), dtype=np.complex128)
In [3]: %timeit b = mkl_fft.fftn(a, axes=(0, 1))
183 ms ± 3.26 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)
In [4]: b = np.ones((1, 4096,4096), dtype=np.complex128)
In [5]: %timeit c = mkl_fft.fftn(b, axes=(1, 2))
354 ms ± 13.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

I believe that what is happening is that any time one feeds in a 3d array, all of the multi-threading turns off and you get the performance of a single-threaded computation.

This can not be the intended behavior. It's 2021 and the MKL has one of the finest FFT algorithms on the planet. It has got to be better than this in Intel's Python distribution.

The above behavior also occurs in Anaconda's python distribution which is where I discovered the problem originally but I switched to ipd to verify.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @slingyropert

        Issue actions

          Fix performance when using 3d arrays · Issue #59 · IntelPython/mkl_fft