how to link FFTW in Intel Visual Fotran composer XE12.1?

how to link FFTW in Intel Visual Fotran composer XE12.1?

Bild des Benutzers Linyun Liang

Dear All, I am a newer for the interl fortran. I have a Fortran code which works well in the Linux. The code uses the fftw3. When I debug the same code in the interl visual fortran in windows, it gives the following error: Error 1 error LNK2019: unresolved external symbol _RFFTWND_F77_ONE_REAL_TO_COMPLEX referenced in function _FORWARD Source1.obj Error 2 error LNK2019: unresolved external symbol _RFFTWND_F77_ONE_COMPLEX_TO_REAL referenced in function _BACKWARD Source1.obj Error 3 error LNK2019: unresolved external symbol _RFFTW3D_F77_CREATE_PLAN referenced in function _MAIN__ Source1.obj Error 4 fatal error LNK1120: 3 unresolved externals Debug\\Console3.exe I am sure this is because the project can not find the fftw lib. Can someone tell me how to link it? I alreay have the MKL lib along with the visual studio. Thanks!

10 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.
Bild des Benutzers mecej4

It is not so much the FFTW library itself that is the problem but the F77 wrappers that you need to use. Using the provided makefile, first build the Fortran wrapper library for your selected target architecture. For example:

nmake dllia32 precision=MKL_DOUBLE

Then, build the example using the makefile again or, for just one example,

ifort /Qmkl real_1d_double_ex1.f mkl_fftw_examples_support.f fftw2xf_intel.lib

If you are building with the IDE, make corresponding changes to your project configuration.

Bild des Benutzers Linyun Liang

Thanks very much for the kind reply.

Bild des Benutzers GTA

hello, I am having almost the exact same issue where my program works on linux but not on windows. Unfortunately I cannot seem to link in my libraries properly and I think it is because I am not properly changing the project configuration. Here is what I currently do:

I compile the libraries fftw2x_cdft_DOUBLE.lib and also fftw2xf_double_msvs.lib using the visual studios compilers with the following line

C:\Program Files (x86)\Intel\Composer XE 2013\mkl\interfaces\fftw2x_cdft>nmake libintel64 mpi=msmpi fname=a_name mpidir="C:\Program Files\Microsoft HPC Pack 2008 SDK" precision=MKL_DOUBLE compiler=msvs interface_name=ilp64

These compile and are created with no problems. I use the dumpbin to dump the symbols and they are all there. Then I proceed to configuring the project as follow.

Configuration Properties->Fortran->General->Additional Include Directories: I add C:\...\mkl\include and C:\...\mkl\include\fftw

Configuration Properties->Linker->General->Additional Library Directories: C:\...\mkl\lib\intel64
Configuration Properties->Linker->General->Additional Dependancies: fftw2x_cdft_DOUBLE.lib and also fftw2xf_double_msvs.lib

I also check the box that say it should use the MKL libraries

In my fortran program I also have an include line that says: INCLUDE 'fftw_f77.i'

In regards to the fftw_mpi.h and fftw.h files that it says to use in the MKL manual, I am not sure where to reference these since they are c++ files and I can't just put them into my fortran files.

Bild des Benutzers mecej4

You have not stated what it is that failed to work.

The file fftw_f77.i is in the mkl\include\fftw directory.

Bild des Benutzers GTA

My apologies, upon linking I receive linker errors saying unresolved reference to _fftwnd_f77_one, _fftwnd_f77_mpi, and others inside of my programs respective functions. No other errors are reported. I already include the fftw_f77.i file. However when I look inside of it, it doesn't have the names of the functions. It only looks like it is setting some constants.

Bild des Benutzers mecej4

The names _fftwnd_f77_one, _fftwnd_f77_mpi, ... would have been in upper case if they had been used in Fortran source files under Windows. If you are calling from C/C++, make sure to follow the calling conventions.

Bild des Benutzers GTA

Okay, so I've just acquired the Intel demo versions of all the compilers and I am still running into the same problem. Here is an example of how I call FFTW in my program and my apologies for what is going to be a long post:

module module_Name

implicit none
include 'fftw_f77.i'

subroutine foo(variables)
!-------------------------------------------------------------------
implicit none
!variables
...code...

call fftw_f77_create_plan(fft_plan, nxyz(1), FFTW_FORWARD, FFTW_ESTIMATE)
call fftw_f77_one(fft_plan, xgaussinv, temp)
xgaussinv = 1.0_dp/temp(0:nxyz(1)-1)
call fftw_f77_destroy_plan(fft_plan)

call fftw_f77_create_plan(fft_plan, nxyz(2), FFTW_FORWARD, FFTW_ESTIMATE)
call fftw_f77_one(fft_plan, ygaussinv, temp)
ygaussinv = 1.0_dp/temp(0:nxyz(2)-1)
call fftw_f77_destroy_plan(fft_plan)

call fftw_f77_create_plan(fft_plan, nxyz(3), FFTW_FORWARD, FFTW_ESTIMATE)
call fftw_f77_one(fft_plan, zgaussinv, temp)
zgaussinv = 1.0_dp/temp(0:nxyz(3)-1)
call fftw_f77_destroy_plan(fft_plan)

deallocate(temp)
return
end subroutine foo

After examples like this all compiles well and the linker will spits out the following errors:

Linking...
Creating temporary file "RSP1.rsp" with contents
[
/OUT:"Debug\exe.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\i386" /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32" /MANIFEST /MANIFESTFILE:"C:\exe.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\\exe.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\\exe.lib" msmpi.lib msmpifmc.lib fftw2x_cdft_DOUBLE.lib fftw2xf_double_intel.lib "Debug\mpi.obj" "Debug\mod1.obj" "Debug\mod2.obj" ... other mod.obj files
]
Creating command line "Link @"C:\\RSP1.rsp""

Link: executing 'link'
mod29.obj : error LNK2019: unresolved external symbol _FFTW_F77_CREATE_PLAN referenced in function mp_COMPUTE_INV_GAUSSIAN
mod29.obj : error LNK2019: unresolved external symbol _FFTW_F77_ONE referenced in function A_mp_COMPUTE_INV_GAUSSIAN
mod29.obj :error LNK2019:unresolved external symbol _FFTW_F77_DESTROY_PLAN referenced in function A_mp_COMPUTE_INV_GAUSSIAN
nfield_corr9.obj : error LNK2001: unresolved external symbol _FFTW_F77_DESTROY_PLAN
mod29.obj : error LNK2019: unresolved external symbol _FFTWND_F77_MPI referenced in function A_mp_PRE_FFT_MAT
solver_v20timed.obj : error LNK2001: unresolved external symbol _FFTWND_F77_MPI
mod29.obj :error LNK2019:unresolved external symbol _FFTWND_F77_MPI_CREATE_PLAN referenced in function A_mp_CREATE_FFT_PLANS
mod29.obj : error LNK2019:unresolved external symbol _FFTWND_F77_MPI_LOCAL_SIZES referenced in function A_mp_CREATE_FFT_PLANS
nfield_corr9.obj : error LNK2019: unresolved external symbol _FFTWND_F77_CREATE_PLAN referenced in function _CORRECT_NFIELD_NFIELD_CORRECT_mp_PREPARE_FFT_PLANS
nfield_corr9.obj : error LNK2019: unresolved external symbol _FFTWND_F77_ONE referenced in function _CORRECT_NFIELD_NFIELD_CORRECT_mp_PREPARE_GREENS_FUNC
Debug\exe.exe : fatal error LNK1120: 8 unresolved externals

exe - 11 error(s), 0 warning(s)

Bild des Benutzers sibiao l.

Quote:

GTA wrote:

Okay, so I've just acquired the Intel demo versions of all the compilers and I am still running into the same problem. Here is an example of how I call FFTW in my program and my apologies for what is going to be a long post:

module module_Name

implicit none

include 'fftw_f77.i'

subroutine foo(variables)

!-------------------------------------------------------------------

implicit none

!variables

...code...

call fftw_f77_create_plan(fft_plan, nxyz(1), FFTW_FORWARD, FFTW_ESTIMATE)

call fftw_f77_one(fft_plan, xgaussinv, temp)

xgaussinv = 1.0_dp/temp(0:nxyz(1)-1)

call fftw_f77_destroy_plan(fft_plan)

call fftw_f77_create_plan(fft_plan, nxyz(2), FFTW_FORWARD, FFTW_ESTIMATE)

call fftw_f77_one(fft_plan, ygaussinv, temp)

ygaussinv = 1.0_dp/temp(0:nxyz(2)-1)

call fftw_f77_destroy_plan(fft_plan)

call fftw_f77_create_plan(fft_plan, nxyz(3), FFTW_FORWARD, FFTW_ESTIMATE)

call fftw_f77_one(fft_plan, zgaussinv, temp)

zgaussinv = 1.0_dp/temp(0:nxyz(3)-1)

call fftw_f77_destroy_plan(fft_plan)

deallocate(temp)

return

end subroutine foo

After examples like this all compiles well and the linker will spits out the following errors:

Linking...

Creating temporary file "RSP1.rsp" with contents

[

/OUT:"Debug\exe.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\Microsoft HPC Pack 2008 SDK\Lib\i386" /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE 2013\mkl\lib\ia32" /MANIFEST /MANIFESTFILE:"C:\exe.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\\exe.pdb" /SUBSYSTEM:CONSOLE /IMPLIB:"C:\\exe.lib" msmpi.lib msmpifmc.lib fftw2x_cdft_DOUBLE.lib fftw2xf_double_intel.lib "Debug\mpi.obj" "Debug\mod1.obj" "Debug\mod2.obj" ... other mod.obj files

]

Creating command line "Link @"C:\\RSP1.rsp""

Link: executing 'link'

mod29.obj : error LNK2019: unresolved external symbol _FFTW_F77_CREATE_PLAN referenced in function mp_COMPUTE_INV_GAUSSIAN

mod29.obj : error LNK2019: unresolved external symbol _FFTW_F77_ONE referenced in function A_mp_COMPUTE_INV_GAUSSIAN

mod29.obj :error LNK2019:unresolved external symbol _FFTW_F77_DESTROY_PLAN referenced in function A_mp_COMPUTE_INV_GAUSSIAN

nfield_corr9.obj : error LNK2001: unresolved external symbol _FFTW_F77_DESTROY_PLAN

mod29.obj : error LNK2019: unresolved external symbol _FFTWND_F77_MPI referenced in function A_mp_PRE_FFT_MAT

solver_v20timed.obj : error LNK2001: unresolved external symbol _FFTWND_F77_MPI

mod29.obj :error LNK2019:unresolved external symbol _FFTWND_F77_MPI_CREATE_PLAN referenced in function A_mp_CREATE_FFT_PLANS

mod29.obj : error LNK2019:unresolved external symbol _FFTWND_F77_MPI_LOCAL_SIZES referenced in function A_mp_CREATE_FFT_PLANS

nfield_corr9.obj : error LNK2019: unresolved external symbol _FFTWND_F77_CREATE_PLAN referenced in function _CORRECT_NFIELD_NFIELD_CORRECT_mp_PREPARE_FFT_PLANS

nfield_corr9.obj : error LNK2019: unresolved external symbol _FFTWND_F77_ONE referenced in function _CORRECT_NFIELD_NFIELD_CORRECT_mp_PREPARE_GREENS_FUNC

Debug\exe.exe : fatal error LNK1120: 8 unresolved externals

exe - 11 error(s), 0 warning(s)

 

I have  got the same problem with you.I have build the lib and use them in the configuration,but it still come up with "unresolved external symbol..." .'fftw_f77.i' is also included.

Do you have any idea about this?Waiting for your response.Thank you

Bild des Benutzers mecej4

Posting excerpts does not suffice to elicit help with non-functioning code, because it is often likely that the parts left out are responsible for the problems.

FFTW is a third party library. Recognizing that it is often used and that MKL contains the capabilities needed to support FFTW calls, Intel provides source codes to build wrapper libraries. The wrapper libraries, themselves, are not provided with MKL.

Please take the actions recommended in response #2 as a first step.

 

Melden Sie sich an, um einen Kommentar zu hinterlassen.