getting incorrect fft output

getting incorrect fft output

I noticed I was getting some incorrect output for some fft's, I noticed all the incorrect output corresponded to fft's of length 168. Code which reproduces the error, mkl_test.c, and its output mkl_test.txt are attached.

In the attached code I am doing fft for a complex signal encoding a real signal, (all the imaginary values are 0), so the 0^th sine coefficient should be 0, but this is not what I get.




Downloadtext/x-csrc mkl_test.c5.98 KB
Downloadtext/plain mkl_test.txt4.08 KB
8 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi Arin!

Yes, the output is incorrect. I've tried to reproduce the failure on our side but without success - your code produces correct output (I have tested both ia32 and inte64 arches on Linux OS, with different MKL versions and different IA).

Could you please specify what processor, OS, architecture, MKL version and compiler do you use?

Thank you for your response, I use a build system that abstracts away these details for us, I will find out and update this track.


win64 produces the  correct output with the 11.2 beta too, so, we need more details for reproducing the issue.

1 .Intel Compiler version:  icc (ICC) 13.1.0 20130121

2. The MKL version shipped with this compiler is version 11.0.2

3.  Built with the following flags   -static-intel –mkl=sequential

Hi Arin!

Yes, finally I was able to reproduce the issue. The environment was: both Mac 64bit and 32bit on Intel Core i7. MKL 11.0.2 and MKL 11.0.3 gave me incorrect results. However MKL 11.0.4 and higher perform fft in a right way. Linux and Windows version are also not affected.

So could please try newer version of MKL? Or, if this suggestion doesn't work for you, you can try the following workaround: since you do real to complex fft, try to use r2c transform, instead of c2c. Actually this way is preferable because r2c is twice faster then c2c and needs less memory.

I attached modified version of your mkl_tests.c - mkl_test_r2c.c. It produces correct results (compare r2c.txt and c2c.txt).

Thank you!


Downloadtext/plain c2c.txt4.1 KB
Downloadtext/x-csrc mkl_test_r2c.c6.14 KB
Downloadtext/plain r2c.txt4.1 KB

Hi Evarist,

What is the workaround if I  have to perform fft on a complex signal?


Hi Arin!

Probably the only one workaround for c2c is to use DFTI_COMPLEX_COMPLEX format instead of DFTI_REAL_REAL of DFTI_COMPLEX_STORAGE setting.

Updating to MKL 11.0.4 and higher should also resolve the problem.

Leave a Comment

Please sign in to add a comment. Not a member? Join today