Reputation: 13
I am using MPI to run FFTW but it triggers undefined reference error as below when compiling the program with -lfftw3f_mpi -lfftw3f -lm
.
function main: error: undefined reference to 'fftw_mpi_init'
function main: error: undefined reference to 'fftw_destroy_plan'
But if modifying with -lfftw3_mpi -lfftw3 -lm
that uses double
type as default, it successfully gets compiled.
Does anyone know why?
Upvotes: 1
Views: 2654
Reputation: 74395
Because the corresponding functions are called fftwf_mpi_init
and fftwf_destroy_plan
. Extract from the documentation that can be found here:
-lfftw3f
or -lfftw3l
instead of (or in addition to) -lfftw3
. (You can link to the different-precision libraries simultaneously.)<fftw3.h>
header file.fftw_
with fftwf_
or fftwl_
for single or long-double precision, respectively. (fftw_complex
becomes fftwf_complex
, fftw_execute
becomes fftwf_execute
, etcetera.)FFTW_
, remain the same.double
with float
or long double
for subroutine parameters. Upvotes: 2