Search code examples
c++intel-mkl

Output Buffer Requirements for MKL FFT


I am writing a program in C++ using MKL 2018.1 FFT functionality for 2-D FFT (rank=2). The MKL reference does not appear to explicitly state what the output size is for DftiComputeForward and DftiComputeBackward (true?).

What are the required output buffers sizes for a Real-to-complex forward and Complex-to-Real computations using the following type of descriptor?

MKL_LONG status, l[2];
l[0] = 32; l[1] = 100;
status = DftiCreateDescriptor(&my_desc1_handle, DFTI_SINGLE,
    DFTI_REAL, 2, l);
status = DftiCommitDescriptor(my_desc1_handle);
status = DftiSetValue(my_desc1_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);

Solution

  • The Intel Math Kernel (MKL) Library Reference Manual specified the sizes in the section "DFTI_CCS_FORMAT for One-dimensional Transforms" for Real to Complex transformations.

    For 1-D Transforms:

    MKL 1D Sizes

    And for 2-D Transforms is says:

    DFTI_CCS_FORMAT for Two-dimensional Transforms The following figure illustrates the storage of a two-dimensional (2D) M-by-N conjugate-even sequence in a real array for the CCS packed format. This format requires an array of size (M+2)-by-(N+2). Row-major layout and zero-based indexing are used. Different colors mark logically separate parts of the result. "n/u" means "not used".

    MKL 2D Sizes