Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Setting up a FFT 2D, defining some parameters

Silva__Saulo
Beginner
512 Views

Good evening, all.

I have successfully used FFTW wrappers for FFT 1D but am writing the 2D portion of my program using the proper MKL interface. However, there are a few points that I am in doubt as I couldn't get enough information from the development reference or other threads.

The matrix I'm working on has 2^14 columns by 2^15 rows, or 536870912 elements. The descriptor for the forward R2C transform is as follows (omitting declaration of descriptor and error checking), following the required parameters as described in manual page 2127 of the 2018 reference:

DftiCreateDescriptor(&fwfft_2D_handle, DFTI_SINGLE, DFTI_REAL, 2, <size>);
DftiSetValue(fwfft_2D_handle, DFTI_CONJUGATE_EVEN_STORAGE, DFTI_COMPLEX_COMPLEX);
DftiSetValue(fwfft_2D_handle, DFTI_PACKED_FORMAT, DFTI_CCE_FORMAT);
DftiSetValue(fwfft_2D_handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
DftiSetValue(fwfft_2D_handle, DFTI_INPUT_STRIDES, <stride>);
DftiSetValue(fwfft_2D_handle, DFTI_OUTPUT_STRIDES, <stride>);
DftiCommitDescriptor(fwfft_2D_handle);

Notice that I left <size> and <stride> undefined here as they are the subjects of my questions below:

- If I am looping through the rows, should <size> be the number of columns of the matrix? If so, how do I provide the length of the rows?
- Is <stride> an array of MKL_LONG of the individual position of each element? If so, then the program will need 2 float arrays (input, output), 1 complex, and yet another 1 of MKL_LONG?!

If I am messing up with the understanding, I appreciate any guidance on how to setup these parameters of a 2D transform for, say, a matrix of 16384 columns by 32768 rows.

Thanks in advance.

0 Kudos
2 Replies
Jonghak_K_Intel
Employee
512 Views

Hi Silva,

 

- <size> should be an array containing the number of the columns and rows. Please refer the example code https://software.intel.com/en-us/mkl-developer-reference-c-2019-beta-basic_sp_real_dft_2d

- for <stride> , please refer the example code. also.

 

Thank you

0 Kudos
Silva__Saulo
Beginner
512 Views

Good evening, Jon, and thanks for your time and patience looking into this.

I actually read the code you mentioned as well as the following thread: https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/517579

The sizes are obvious to figure out, however, my confusion is in defining the input/output strides. As the definition of these in the codes don't have specific comments, then I'm not sure how to guess it. Why are these 3-elements arrays? What does each of them represent? Why the input and output strides are different? These are my main doubts on these parameters.

I'm sure it is really simple, so if you can provide an explanation on this, then I will be ready to go.

Thanks a lot.

0 Kudos
Reply