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

getting incorrect fft output

Arin_Chaudhuri
Beginner
403 Views

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.

 

 

 

0 Kudos
7 Replies
Evarist_F_Intel
Employee
403 Views

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?

0 Kudos
Arin_Chaudhuri
Beginner
403 Views

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.

0 Kudos
Gennady_F_Intel
Moderator
403 Views

Arin,

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

0 Kudos
Arin_Chaudhuri
Beginner
403 Views

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

0 Kudos
Evarist_F_Intel
Employee
403 Views

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!

0 Kudos
Arin_Chaudhuri
Beginner
403 Views

Hi Evarist,

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

-Arin
 

0 Kudos
Evarist_F_Intel
Employee
403 Views

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.

0 Kudos
Reply