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.
链接已复制
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?
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!
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.