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

fftw3xf_intel conflicts with other libs

Damien_Desmidts
Beginner
1,449 Views
Hi,
I'm trying to build a Fortran program which uses the FFTW routines from MKL. I'm under Windows XP32, Visual Studio 2008, Intel Fortran Compiler 11.1�51.

I created a solution similar to the one sent by attachment (fftw_problem.zip) by Gennady Fedorov (Intel) in his reply to the following thread :


http://software.intel.com/en-us/forums/showthread.php?t=65448,

Since his solution is made for a 64-bit architecture, I adapted the solution for an IA-32 platform by following the steps summarized below:


1) The same Fortran file is used




implicit none
!include "fftw3.f"
INCLUDE 'fftw3.f'
INCLUDE 'mkl_fftw_examples.fi'

!!
!!
!!

integer n
parameter (n=16)

integer*8 plan, iplan

double complex in, out
dimension in(N), out(N)

integer i


print *,"n = ",n
print *,"input = "
do i=1,n
in(i) = (1.0, 0.0)
print *,in(i)
enddo

print *,"fftw_fwd = ",fftw_forward
print *,"fftw_bkwd = ",fftw_backward
print *,"fftw_estimate = ",fftw_estimate

!call dfftw_plan_dft_1d(plan, n,in,out,fftw_forward, FFTW_ESTIMATE)
call DFFTW_PLAN_DFT_1D(plan, n,in,out,fftw_forward, FFTW_ESTIMATE)
call dfftw_plan_dft_1d(iplan,n,out,in,fftw_backward,FFTW_ESTIMATE)

print *,"address of fwd plan = ",plan
print *,"address of bckwd plan = ",iplan

call dfftw_execute(plan)

print *, 'output after forward fft:'
do i=1,n
print *, out(i)
enddo

call dfftw_execute(iplan)

print *, 'after inverse fft:'
do i=1,n
print *, in(i)
enddo

call dfftw_destroy_plan(plan)
call dfftw_destroy_plan(iplan)

end


















2) I created the fftw3xf_intel.lib with the command nmake lib32
3) I created the project in VS2008 with the main Fortran file and the file mkl_fftw_examples.fi
4) I added the following paths in the tab

Fortran -> General -> Additional Include Directories : C:ProgramFilesIntelCompiler11.1�51mklinclude;C:ProgramFilesIntelCompiler11.1�51mklincludefftw;C: ProgramFilesIntelCompiler11.1�51libia32


5) I added the path of the fftw3xf_intel.lib in the tab

Linker -> General -> Additional Library Directories : C:ProgramFilesIntelCompiler11.1�51mklia32lib


5) I added fftw3xf_intel.lib in the tab

Linker -> Input -> Additional Dependencies


When I try to build i get the following errors:


------ Build started: Project: fftw3_windows, Configuration: Debug Win32 ------
Linking...
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiCreateDescriptor_d_md referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiCreateDescriptor_d_1d referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiErrorClass referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiSetValue referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _MKL_Domain_Get_Max_Threads referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _MKL_Domain_Set_Num_Threads referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiCommitDescriptor referenced in function _fftw_plan_guru64_dft
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiComputeForward referenced in function _execute_fi
fftw3xf_intel.lib(fftw_plan_guru64_dft.obj) : error LNK2019: unresolved external symbol _DftiComputeBackward referenced in function _execute_bi
fftw3xf_intel.lib(fftw_version.obj) : error LNK2019: unresolved external symbol _DftiFreeDescriptor referenced in function _delete_plan
fftw3xf_intel.lib(fftw_malloc.obj) : error LNK2019: unresolved external symbol _MKL_malloc referenced in function _fftw_malloc
fftw3xf_intel.lib(fftw_free.obj) : error LNK2019: unresolved external symbol _MKL_free referenced in function _fftw_free
Debugfftw3_windows.exe : fatal error LNK1120: 12 unresolved externals

Build log written to "file://C:Intel_fftw3fftw3_windowsDebugBuildLog.htm"
fftw3_windows - 13 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========





Could someone please help me? I already thank you very much fo your kind support.


Damien

0 Kudos
3 Replies
Vladimir_Petrov__Int
New Contributor III
1,449 Views
Damien,

I think you just need more libraries in step 5 (the second step 5 :)). To verify if this is the case, please try adding the following set of libraries there:
mkl_intel_c.lib
mkl_sequential.lib
mkl_core.lib

Please note that this will give you the sequential performance.
In general, to find out which libraries are required, please refer to our link line advisor:
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/

Best regards,
-Vladimir
0 Kudos
Damien_Desmidts
Beginner
1,449 Views
Damien,

I think you just need more libraries in step 5 (the second step 5 :)). To verify if this is the case, please try adding the following set of libraries there:
mkl_intel_c.lib
mkl_sequential.lib
mkl_core.lib

Please note that this will give you the sequential performance.
In general, to find out which libraries are required, please refer to our link line advisor:
http://software.intel.com/en-us/articles/intel-mkl-link-line-advisor/

Best regards,
-Vladimir


Dear Vladimir,

Thanks a lot for your support; now it builds perfectly!

I tried to use the same project but without using MKL libraries and rather using import libraries created from precompiled DLL's on FFTW's site by means of the

lib /def:libfftw3-3.def
lib /def:libfftw3f-3.def
lib /def:libfftw3l-3.def

commands.

However Intel Fortran fails to link it correctly and sends the following message :


------ Build started: Project: fftw, Configuration: Debug Win32 ------
Linking...
fftw3_test.obj : error LNK2019: unresolved external symbol _DFFTW_PLAN_DFT_1D referenced in function _MAIN__
fftw3_test.obj : error LNK2019: unresolved external symbol _DFFTW_EXECUTE referenced in function _MAIN__
fftw3_test.obj : error LNK2019: unresolved external symbol _DFFTW_DESTROY_PLAN referenced in function _MAIN__
Debugfftw.exe : fatal error LNK1120: 3 unresolved externals

Build log written to "file://C:fortranfftw3_VS2008fftw_fortranfftwfftwDebugBuildLog.htm"
fftw - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========






The same build error hapens if I use instead the libfftw.lib and fft3w.h generated when building fftw3 for VS2008 by means of Project Files downloaded from http://www.fftw.org/install/windows.html.



I guess some libraries are missing but which one should I add if I don't use the additional mkl_*.lib's from above? I don't think the precompiled DLL's or the libraries built with theProject Files from FFTW's webpage require the C++ Intel libraries or C++ Intel environment.


Do you have any idea about the missing stuff?


Thanks in advance,


Damien

0 Kudos
Dmitry_B_Intel
Employee
1,449 Views

Hi Damien,

It would be helpful if you posted the link line that produced the linker errors you mentioned, even though it is not related to MKL. Looks like fftw3-f.lib (or whatever the import library name is) is missing from the link line.

By the way, in the release of MKL you use the library mkl_intel_c.libshould contain fftw3 Fortran wrappers (the symbols like _DFFTW_PLAN_DFT_1D), so that you don't need to build fftw3xf_intel.lib.

Dima
0 Kudos
Reply