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

Unable to find reference to fftw3 subroutine

Rakesh_M_
Beginner
770 Views

Hello,
In my application i am trying to use Intel MKL wrappers for FFTW3 to call from Fortran code and followed these steps:

To build the fftw3 wrapper library, I followed Intel procedure explained in https://software.intel.com/en-us/node/471470#68C58A01-0636-463B-8A6B-38C376D600B9 
I built using following command within the 'fftw3x_cdft' directory under $MKLROOT/interfaces :

make libintel64

which will be compiled by Intel compiler and Intel MPI and places the built library "libfftw3x_cdft_lp64.a" in
$MKLROOT/lib/intel64/ and

$MKLROOT/lib/intel64_lin/

I have added required links to MKL as follows:

-Wl,--start-group  ${MKLROOT}/lib/intel64/libfftw3x_cdft_ilp64.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_sequential.a ${MKLROOT}/lib/intel64/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group -lpthread -lm -I${MKLROOT}/include -I${MKLROOT}/include/fftw -mkl -lfftw3x_cdft_lp64

after building I am trying to use the library without any modifications in the fftw3 calling convention in Fortran  at two places as below:

 call fftw_mpi_execute_dft_r2c(p,q,r)
 call fftw_mpi_execute_dft_c2r(x,y,z)

But while compiling the application its throwing error in following function:

inv.o: In function `inverse_fourier_':
inv.f90:(.text+0x86d): undefined reference to `fftw_mpi_execute_dft_c2r'


So, I tried checking whether the library is having wrapper for the subroutines or not.
Surprisingly it has the wrapper definition for both, but the build process didn't build the second wrapper subroutine and binary didn't have code for it.
I confirmed this with greping under $MKLROOT:

$ grep -rn "fftw_mpi_execute_dft_r2c" *

include/fftw/fftw3-mpi.f03:409:    subroutine fftw_mpi_execute_dft_r2c(p,in,out) bind(C, name='fftw_mpi_execute_dft_r2c')
include/fftw/fftw3-mpi.f03:414:    end subroutine fftw_mpi_execute_dft_r2c
Binary file interfaces/fftw3x_cdft/obj_intel64_lp64/execute.o matches
Binary file interfaces/fftw3x_cdft/obj_intel64_ilp64/execute.o matches
Binary file lib/intel64_lin/obj_intel64_lp64/execute.o matches
Binary file lib/intel64_lin/libfftw3x_cdft_ilp64.a matches
Binary file lib/intel64_lin/libfftw3x_cdft_lp64.a matches
Binary file lib/intel64/obj_intel64_lp64/execute.o matches
Binary file lib/intel64/libfftw3x_cdft_ilp64.a matches
Binary file lib/intel64/libfftw3x_cdft_lp64.a matches

$ grep -rn "fftw_mpi_execute_dft_c2r" *

include/fftw/fftw3-mpi.f03:416:    subroutine fftw_mpi_execute_dft_c2r(p,in,out) bind(C, name='fftw_mpi_execute_dft_c2r')
include/fftw/fftw3-mpi.f03:421:    end subroutine fftw_mpi_execute_dft_c2r

Why the the build process not creating executable code for the c2r subroutine? Could any one help me out how to resolve the error.

0 Kudos
1 Solution
Evarist_F_Intel
Employee
770 Views

Hi Rakesh,

There was a small typo in MKL FFTW3 MPI wrappers prior to MKL 11.3.2. There are two possible solutions:

  1. either apply a small patch (shown below) to the MKL FFTW3 MPI wrappers manually and then rebuild them
  2. or please update your Intel MKL to version 11.3.2 or newer and rebuild the wrappers

The patch (execute_dft_c2t -> execute_dft_c2r):

$MKLROOT/interfaces/fftw3x_cdft/wrappers/execute.c
@@ -47,7 +47,7 @@ FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_r2c)
     tmp_plan_s.execute(&tmp_plan_s);
 }

-FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2t)
+FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2r)
      (FFTW_MANGLE(plan) p, complex_t *in, real_t *out)
 {
     struct fftw_mkl_plan_s tmp_plan_s = ((fftw_mkl_plan)p)[0];

 

View solution in original post

0 Kudos
2 Replies
Evarist_F_Intel
Employee
771 Views

Hi Rakesh,

There was a small typo in MKL FFTW3 MPI wrappers prior to MKL 11.3.2. There are two possible solutions:

  1. either apply a small patch (shown below) to the MKL FFTW3 MPI wrappers manually and then rebuild them
  2. or please update your Intel MKL to version 11.3.2 or newer and rebuild the wrappers

The patch (execute_dft_c2t -> execute_dft_c2r):

$MKLROOT/interfaces/fftw3x_cdft/wrappers/execute.c
@@ -47,7 +47,7 @@ FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_r2c)
     tmp_plan_s.execute(&tmp_plan_s);
 }

-FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2t)
+FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2r)
      (FFTW_MANGLE(plan) p, complex_t *in, real_t *out)
 {
     struct fftw_mkl_plan_s tmp_plan_s = ((fftw_mkl_plan)p)[0];

 

0 Kudos
Rakesh_M_
Beginner
770 Views

Evarist Fomenko (Intel) wrote:

Hi Rakesh,

There was a small typo in MKL FFTW3 MPI wrappers prior to MKL 11.3.2. There are two possible solutions:

  1. either apply a small patch (shown below) to the MKL FFTW3 MPI wrappers manually and then rebuild them
  2. or please update your Intel MKL to version 11.3.2 or newer and rebuild the wrappers

The patch (execute_dft_c2t -> execute_dft_c2r):

$MKLROOT/interfaces/fftw3x_cdft/wrappers/execute.c
@@ -47,7 +47,7 @@ FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_r2c)
     tmp_plan_s.execute(&tmp_plan_s);
 }

-FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2t)
+FFTW_EXTERN void FFTW_MPI_MANGLE(execute_dft_c2r)
      (FFTW_MANGLE(plan) p, complex_t *in, real_t *out)
 {
     struct fftw_mkl_plan_s tmp_plan_s = ((fftw_mkl_plan)p)[0];

 

hi Evarist Fomenko (Intel),

It's compiled successfully...! Thank you very much. That was very helpful.

0 Kudos
Reply