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

Intel MKL FFT module access violation

Wang__Jingchun
Beginner
1,293 Views

Hi,

 

I am currently using MKL FFT module for our application on Windows 10 and Linux. Frequently I got Access violation exception on Win10 when the program enters this line:

status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 2, dim).

The complete function is:

    DFTI_DESCRIPTOR_HANDLE descriptor = NULL;
	MKL_LONG status;
	MKL_LONG dim[2]{ height, width };

	status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 2, dim);
	status = DftiSetValue(descriptor, DFTI_PLACEMENT, DFTI_NOT_INPLACE); //Out of place FFT
	status = DftiCommitDescriptor(descriptor);
	status = DftiComputeForward(descriptor, in.data(), out.data());
	status = DftiFreeDescriptor(&descriptor); //Free the descriptor

The full message thrown at this point is:

Exception thrown at [some address] in fft.exe: 0xC0000005: Access violation reading location 0x0000000000000018.
The two addresses 0x05 and 0x18 are constant in both our application and the small test.

The problem is triggered randomly. For example I have a lot, say, 1000 images. The problem happens when processing 200th image at this time, then 300th in another try.

The configuration for the problem is: x64, (debug/release), openmp multi threads. If I disable openmp, there is no problem.

Does anyone know how to deal with it? Thank you!

 

Best,

Jingchun

0 Kudos
8 Replies
Gennady_F_Intel
Moderator
1,293 Views

which version of mkl do you try?

how did you link your application? is that LP or ALP64 API, threaded or sequential?  if threaded - do you use OpenMP or TBB based threading mode?

0 Kudos
Wang__Jingchun
Beginner
1,293 Views

Gennady F. (Blackbelt) wrote:

which version of mkl do you try?

how did you link your application? is that LP or ALP64 API, threaded or sequential?  if threaded - do you use OpenMP or TBB based threading mode?

Hi Gennady,

Thank you for the reply! The MKL version I use is "compilers_and_libraries_2018.4.274 (2018 update 4)". It is linked against LP64 and sequential libraries. We use OpenMP based multithread mode. Basically we have many images with the same size to process so we assign batches of images to every thread. In a single thread the FFT process is executed sequentially.

It was confirmed that the same error did not happen after we link the latest version of MKL. But for some reason (other groups use old one and do not want any change) we have to limit our application to 2018.4 version.

Best,

Jingchun

0 Kudos
Gennady_F_Intel
Moderator
1,293 Views

Jingchun,  I slightly redesigned your project into one testfft.cpp file ( attached), linked with MKL v.2019 u5 and ran 1000000 times w/o problems.

building: icc -qopenmp -mkl testfft.cpp.

Could you check if this code will generate some exception you reported? 

 

0 Kudos
Gennady_F_Intel
Moderator
1,293 Views

You may switch on/of mkl_verbose(1/0) function. I ran the executable on the AVX, AVX2, and AVX-512 based systems and see no problem on my side.

e.x, here are outputs:

AVX:

MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions (Intel(R) AVX) enabled processors, Lnx 2.80GHz intel_thread
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_output,desc:0x2b8628020940) 0.00s CNR:OFF Dyn:1 FastMM:1 TID:19 NThr:1
......................................
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_input,unaligned_output,desc:0xeb3140) 57.12us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:1
 test passed after 1000000 interations 

AVX2 ( broadwell):

MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 2 (Intel(R) AVX2) enabled processors, Lnx 2.20GHz intel_thread
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_output,desc:0x2ba798020940) 82.09s CNR:OFF Dyn:1 FastMM:1 TID:13 NThr:1
...................
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_output,desc:0x2ba79c020940) 67.41us CNR:OFF Dyn:1 FastMM:1 TID:15 NThr:1
 test passed after 1000000 interations 
 

AVX-512 (Skylake)

MKL_VERBOSE Intel(R) MKL 2019.0 Update 5 Product build 20190808 for Intel(R) 64 architecture Intel(R) Advanced Vector Extensions 512 (Intel(R) AVX-512) enabled processors, Lnx 2.20GHz intel_thread
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_output,desc:0x2ba3fc020940) 119.37us CNR:OFF Dyn:1 FastMM:1 TID:55 NThr:1
....................................
MKL_VERBOSE FFT(scfo128x128,tLim:1,unaligned_input,desc:0x18dc840) 28.16us CNR:OFF Dyn:1 FastMM:1 TID:0  NThr:1
 test passed after 1000000 interations 
 

 

0 Kudos
Wang__Jingchun
Beginner
1,293 Views

Gennady F. (Blackbelt) wrote:

Jingchun,  I slightly redesigned your project into one testfft.cpp file ( attached), linked with MKL v.2019 u5 and ran 1000000 times w/o problems.

building: icc -qopenmp -mkl testfft.cpp.

Could you check if this code will generate some exception you reported? 

 

Hi Gennady,

Thank you for the reply! I noticed you linked with MKL v.2019.5 which already works well in our test. However we have to use v.2018.4 which caused the same exception like before. There was no error message printed out, as the exception was thrown right before the first ERRCHECK function.

I know you wonder why we have to stick with older version. I have the same question as you do and as a junior engineer I can do nothing about the architect. I just wonder if there is a way to avoid such the error with old MKL library and, only out of curiosity, what causes the problem in old MKL version (I searched the Internet and rarely saw any report over this problem). Is Openmp thread model under windows not compatible with MKL?

Best,

Jingchun

0 Kudos
Gennady_F_Intel
Moderator
1,293 Views

Jingchun, 

yes, I confirmed I see the same segfault with the 2018.5 version of FFT on my side also. Actually, this is an unknown issue for MKL and we didn't investigate the cause of the issue and therefore I couldn't comment on this case. Regarding "Is OpenMP thread model under windows not compatible with MKL?"  - yes, these runtime libs are compatible with each other.  Particular in this case, I see the problem when linking against the sequential version of mkl also...

Gennady

0 Kudos
Wang__Jingchun
Beginner
1,293 Views

Gennady F. (Blackbelt) wrote:

Jingchun, 

yes, I confirmed I see the same segfault with the 2018.5 version of FFT on my side also. Actually, this is an unknown issue for MKL and we didn't investigate the cause of the issue and therefore I couldn't comment on this case. Regarding "Is OpenMP thread model under windows not compatible with MKL?"  - yes, these runtime libs are compatible with each other.  Particular in this case, I see the problem when linking against the sequential version of mkl also...

Gennady

Hi Gennady,

Thank you for the answer all the way! Yes I guess the only possible solution to this annoying segfault issue is to use the latest MKL libs.

Best,

Jingchun

0 Kudos
Gennady_F_Intel
Moderator
1,293 Views
in the case, if we will root caused the problem, we will update this forum thread accordingly. In the case, if you like to escalate this case, you may submit the issue to the Intel Online Service Center for priority support. thanks, Gennady
0 Kudos
Reply