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

Linking MKL in Visual Studio

evgeny_shapirogmail_
1,713 Views
Hi,
can you please resolve my problem in using MKL for the first time. I am a newbie and lost.

I am trying to use the FFT transform in fortran, building in Visual Studio under Vistax64. The code is taken from the MKL manual, with adding one "use" statement in the beginning (does not help):

!!!!!!!!!!!!!!!!!!!!!!!!!
Use MKL_DFTI
Complex :: X_in(32)
Complex :: X_out(32)
type(DFTI_DESCRIPTOR), POINTER :: My_Desc1_Handle, My_Desc2_Handle
Integer :: Status

X_in = 1.

Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_SINGLE,DFTI_COMPLEX, 1, 32 )
Status = DftiSetValue( My_Desc1_Handle, DFTI_PLACEMENT, DFTI_NOT_INPLACE)
Status = DftiCommitDescriptor( My_Desc1_Handle )
Status = DftiComputeForward( My_Desc1_Handle, X_in, X_out )
Status = DftiFreeDescriptor(My_Desc1_Handle)

stop
end
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

The linker does not recognise the FFT subroutines:

Error 3 error LNK2019: unresolved external symbol dfti_commit_descriptor_external referenced in function MAIN__
Error 2 error LNK2019: unresolved external symbol dfti_set_value_intval referenced in function MAIN__
Error 3 error LNK2019: unresolved external symbol dfti_commit_descriptor_external referenced in function MAIN__
Error 4 error LNK2019: unresolved external symbol dfti_compute_forward_cc referenced in function MAIN__
Error 5 error LNK2019: unresolved external symbol dfti_free_descriptor_external referenced in function MAIN__
Error 6 error LNK2019: unresolved external symbol WinMain referenced in function __tmainCRTStartup LIBCMT.lib(wincrt0.obj)
Error 7 fatal error LNK1120: 6 unresolved externals x64\Release\DiffuseConvolutions-IF.exe

The following does not help: (all actions according to advice @ various internet cites)
- inserting the file mkl_dfti.f90 into either the resource or the header files of the project;
- Project->Properties -> :
Fortran -> General -> Additional Include Directories -> C:\Program Files (x86)\Intel\Compiler\11.1\046\mkl\include
Linker -> General -> Additional include directories -> C:\Program Files (x86)\Intel\Compiler\11.1\046\mkl\ia32\lib
Linker -> Input -> Additional dependencies -> mkl_cdft_core.lib or whatever other lib files I try

How to make it work??



Unrelated question. The MKL manual gives subroutines FFT subroutines working with real and complex data, but does not mention working with double-precision. Is that done by the same subroutines?

Thanks!
evgeny





0 Kudos
5 Replies
Gennady_F_Intel
Moderator
1,713 Views

evgeny,
it seems to me you can try to add mkl_dfti.f90 file ( MKLROOTinclude ) into your project.
--Gennady
0 Kudos
evankw21
Beginner
1,713 Views

evgeny,
it seems to me you can try to add mkl_dfti.f90 file ( MKLROOTinclude ) into your project.
--Gennady
I went through this same thing, and adding the mkl_dfti.f90 file to my project worked. It does seem like a not-very-elegant thing to have to do, however.

Although the compile works, linking for me takes several minutes as soon as I call the "DftiCreateDescriptor" function/subroutine. Have you or anyone else found this also? I've just started a discussion thread on this one in the MKL forum. I've had one going for about a month on the Ifort Forum called "Linking takes too long".

Evan
0 Kudos
Dmitry_B_Intel
Employee
1,713 Views

Hi Evan,

This was probably not what you wantedwhen youadded ia32 to the list of library directories for your x64 project. Try em64tlib instead.

Thanks
Dima
0 Kudos
barragan_villanueva_
Valued Contributor I
1,713 Views

Evgeny,

As for your question:
"The MKL manual gives subroutines FFT subroutines working with real and complex data, but does not mentionworking with double-precision. Is that done by the same subroutines?"

In order to create DFTI descriptor for double-precision data you need DFTI_DOUBLE.
For example:
Status = DftiCreateDescriptor( My_Desc1_Handle, DFTI_DOUBLE, DFTI_COMPLEX, 1, 32 )
and use the same DFTI compute functions as for single precision

Thanks
-- Victor

0 Kudos
Vadim_M_Intel
Employee
1,713 Views
To make "mkl_dfti" module availableyou can add INCLUDE "mkl_dfti.f90" statement in your source.

MKL include and library directories should be set automatically in build environment ("Tools->Options->Intel Visual Fortran->Compilers" page, "Includes" and "Libraries" fields). You can see actual build environmentin the generated "BuildLog.htm" file if "Tools->Options->Intel Visual Fortran->General->Show environment in log" is set.

If you set "Fortran->Libraries->Use Intel Math Kernel Library" to appropriate value, list of MKL libraries is automatically passed to the linker.

Setting "Linker->Optimization->Interprocedural Optimization" to "No" value reduces linking time.
0 Kudos
Reply