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

FFT error - DftiFreeDescriptor / DftiCommitDescriptor (Fortran)

Marcos_A_2
Beginner
713 Views

I'm having an error using the DftiFreeDescriptor command on the FFT computation. I'm using Intel Parallel Studio XE Cluster Edition (2016 - Student download) with Visual Studio Community 2015. And here is the code:

seqc = CMPLX(seq)
Status1 = DftiCreateDescriptor(My_Desc2_Handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, npts)
Status1 = DftiCommitDescriptor(My_Desc2_Handle)
Status1 = DftiComputeForward(My_Desc2_Handle, seqc)
Status1 = DftiFreeDescriptor(My_Desc2_Handle)

I start with this real(8)::seq(npts) and convert it to the complex seqc(npts), where npts is something between 2000 and 6000.

Debuging each step I have the following values for Status1  and My_Desc2_Handle:

Status1 = 0 / My_Desc2_Handle: Undefined address

Status1 = DftiCreateDescriptor(My_Desc2_Handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, npts)

Status1 = 0 / My_Desc2_Handle = 0

Status1 = DftiCommitDescriptor(My_Desc2_Handle)

Status1 = 0 / My_Desc2_Handle = -620492544

Status1 = DftiComputeForward(My_Desc2_Handle, seqc)

Status1 = 0 / My_Desc2_Handle = -620492544

Status1 = DftiFreeDescriptor(My_Desc2_Handle)

Error, where in the output i get this:  Invalid address specified to RtlValidateHeap( 0000000011FA0000, 0000000014312970 )

So, I've tested changing npts to values around 100, than My_desc2_Handle receives a positive value and I don't get errors with the DftiFreeDescriptor command. But if I put it up to 200, My_Desc2_Handle gets negative and the error happens again. So I guess it is something with the DftiCommitDescriptor, where it can't allocate/address the memory correctly. If I don't add the DftiFreeDescriptor command, I just get my FFT normaly, but I'm not sure if the memory is leaking each time I run it.

0 Kudos
6 Replies
Marcos_A_2
Beginner
713 Views

I changed in Project >  Fortran > Libraries > Runtime Library from Multithread DLL to Multithreaded and that error stopped from happening. I don't know why. So maybe it's a fix for the developers.

I have the MKL settings as: Parallel (/Qmkl:parallel). But with the multithreaded option, apparently it is using only one core on the MKL functions checking the Diagnostic Tools/CPU utilization window.

0 Kudos
Evgueni_P_Intel
Employee
713 Views

Hi Marcos,

We expect MKL to be compatible with MSVS 2015.

Could you post here a small reproducer including the compile and link line?

Evgueni.

0 Kudos
Marcos_A_2
Beginner
713 Views

So, here is the deal, I made a short code with the problematic functions:

    program fft_test

    use MKL_DFTI
    implicit none
    real(8)::seq(3000)
    double complex::seqc(3000)
    type(DFTI_DESCRIPTOR),POINTER::My_Desc2_Handle
    integer::Status1
    integer::i
    
    seqc=0.0d0
    Status1=0
    
    do i=1,3000
        seq(i)=1.0d0*i
    end do
    
    seqc = CMPLX(seq)
    Status1 = DftiCreateDescriptor(My_Desc2_Handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 3000)
    Status1 = DftiCommitDescriptor(My_Desc2_Handle)
    Status1 = DftiComputeForward(My_Desc2_Handle, seqc)
    Status1 = DftiFreeDescriptor(My_Desc2_Handle)
   
    end program fft_test

And I made the same changes in its proprieties as I have in my original project. So going to Project > Proprieties I have the following:

Fortran>Optimization: Maximize Speed plus Higher Level Optimizations (/O3)

Fortran>Libraries>Runtime Library: Multithread DLL (/libs:dll /threads) (As I told you previously, if I change it to Multithreaded the error doesn't occur)

Fortran>Libraries>Use Intel MKL: Parallel (/Qmkl:parallel)

Linker>Input>Additional Dependencies: mkl_blas95_lp64.lib mkl_lapack95_lp64.lib mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib

So, I found out that everything runs fine if I remove mkl_core.lib from the linker. I can use even the Multithread DLL option wihtout problems. I don't understand very well which .lib's I should add there, but well.. it is running now.

Just to add to developers, when I run the problematic code (with mkl_core.lib) in Release mode, I received the following error: Critical error detected c0000374

Here's the command Line for Fortran options for my original project: 

/nologo /O3 /module:"x64\Release\\" /object:"x64\Release\\" /Fd"x64\Release\vc140.pdb" /libs:dll /threads /Qmkl:parallel /c

And for the Linker:

/OUT:"x64\Release\FSDT.exe" /INCREMENTAL:NO /NOLOGO /MANIFEST /MANIFESTFILE:"x64\Release\FSDT.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /SUBSYSTEM:CONSOLE /IMPLIB:"E:\Doutorado\fortran\FSDT\FSDT\x64\Release\FSDT.lib" mkl_blas95_lp64.lib mkl_lapack95_lp64.lib mkl_intel_lp64.lib mkl_sequential.lib

An extra question if anyone read all that post until the end: In the code I posted here I use the command USE MKL_DFTI and I add the file mkl_dfti.f90 from the folder C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2016.0.110\windows\mkl\include into my project. Is there a way to type the command USE and make the compiler know the path without needing to add the .f90 by myself?

Thanks.

0 Kudos
Ying_H_Intel
Employee
713 Views

Hi Marcos A.

I can reproduce the problem with your  guide.  I get access violation error.  It is unexpected. 

But what I want to comment is about the quick link model:  Fortran>Libraries>Use Intel MKL: Parallel (/Qmkl:parallel)  , it is actually equivalent to " mkl_intel_lp64_dll.lib mkl_intel_thread_dll.lib mkl_core_dll.lib. when Runtime Library: Multithread DLL (/libs:dll /threads) 

and  manual  way, to  add  mkl_intel_lp64.lib mkl_sequential.lib mkl_core.lib. to Linker>Input>Additional Dependencies. 

The two kind of link ways, dynamic and static respectively conflict each other .  By default, one of them should be enough. (excepted mkl_blas95_lp64.lib mkl_lapack95_lp64.lib).  the mixed result are unknowable. so you can select  either manual way or quick link way to workaround the problem. 

Regarding the mkl_dfti.f90,  you can add it like below

include 'mkl_dfti.f90'
    program fft_test

Intel fortran Compiler should be able to find it and compile it. 

Best Regards

Ying 

0 Kudos
Evgueni_P_Intel
Employee
713 Views

Marcos, according to MKL linking model, you should use either the /Qmkl compiler switch or the explicit list of MKL libraries, not both.

0 Kudos
Marcos_A_2
Beginner
713 Views

Thank you all very much for the help!

0 Kudos
Reply