Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Budisky__Jakub
Beginner
72 Views

FFT incorrect output [regression]

Hello everyone,

I've noticed that the MKL is giving me a wrong result while calculating 3D real-to-complex in-place FFT with specific sizes. I've found a test program on this forums to confirm it's not a bug in my code, attaching the source code with settings I've used.

The error is present using both Windows and GNU/Linux, and all the Intel MKL versions following 2017.0.0 are broken (the 2017.0.0 version is the last working for me). I can use a newer Intel C Compiler but have to link the older MKL library in order to get a working code so it seems to be a bug in the library itself.

Compiling on GNU/Linux with:

icc basic_sp_real_dft_3d.c -DMKL_ILP64 -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -o dfttest -qopenmp

Output:

Intel(R) Math Kernel Library Version 2017.0.3 Product Build 20170413 for Intel(R) 64 architecture applications
Example basic_sp_real_dft_3d
Forward-Backward single-precision in-place 3D real FFT
Configuration parameters:
 DFTI_PRECISION                = DFTI_SINGLE
 DFTI_FORWARD_DOMAIN           = DFTI_REAL
 DFTI_DIMENSION                = 3
 DFTI_LENGTHS                  = {360, 384, 433}
 DFTI_PLACEMENT                = DFTI_INPLACE
 DFTI_CONJUGATE_EVEN_STORAGE   = DFTI_COMPLEX_COMPLEX
Create DFTI descriptor
Set configuration: CCE storage
Set input  strides = { 0, 166656, 434, 1 }
Set output strides = { 0, 83328, 217, 1 }
Commit the descriptor
Allocate data array
Initialize data for r2c transform
Compute real-to-complex in-place transform
Verify the result
 Check if err is below errthr 7.7e-06
 Verified,  maximum error was 2.67e-07
Change strides to compute backward transform
Commit the descriptor
Initialize data for c2r transform
Compute backward transform
Verify the result
 Check if err is below errthr 7.7e-06
 x[359][2][0]:  expected 0,  got 0.0003608387,  err 0.000361
 Verification FAILED
 ERROR, status = 1
Free DFTI descriptor
Free data array
TEST FAILED

Thanks for pointing out if I'm doing anything wrong. It would be nice to get a working version otherwise :).

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
72 Views

thanks, we take a look at the case. Is this case happens with ILP64 or lp64 API too? Are there any specific CPU where do you this issue?

Budisky__Jakub
Beginner
72 Views

I've just checked, and even thought I use 64-bit API (ILP64) it is broken with 32-bit (LP64) one too, with the exact same result.

As far as processors go, I can confirm it's broken on several (at least E5-2620, E5-2695, i5-6500). Weirdly enough, it seems to work (both APIs) on E5-2670. To confirm this, I've tried to link the library statically on the E5-2670 machine and it still yields the wrong result on the others.

Edit:
So with some help I've obtained results from more systems. So to summarize:

Sandy Bridge - E5-2650, E5-2670
Ivy Bridge - i7-3770
are passing the attached test;

Haswell - E5-2620 v3, E5-2695 v3
Broadwell - E5-2620 v4
Skylake - i5-6500
are failing the attached test.

Since I suspect the MKL supports the conditional code execution depending on the architecture, AVX2 version is probably the one to blame.

Reply