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

MATLAB and MKL FFTW wrapper

dr_sillekens
Beginner
806 Views

I am trying to use the MKL FFTW wrapper, however, I am stuck at something that doesn't provide google info.

It is compiling a matlab function from c. The c code expects FFTW. 

Linux xxxxx 3.10.0-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

MATLAB R2020a

oneAPI MKL 2021

>> mex sspropc.c -v -I${MKLROOT}/include/fftw -L${MKLROOT}/lib/intel64 -L${MKLROOT}/interfaces/fftw3 ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a LDFLAGS="$LDFLAGS -lgomp -lpthread -lm -ldl" CFLAGS="$CFLAGS  -DMKL_ILP64  -m64 "
Verbose mode is on.
... Looking for compiler 'gcc' ...
... Executing command 'which gcc' ...Yes ('/usr/bin/gcc').
... Executing command 'gcc -dumpversion' ...Yes ('4.8.5').
... Executing command 'gcc -print-file-name=libstdc++.so' ...Yes ('/usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so').
Found installed compiler 'gcc'.
Options file details
-------------------------------------------------------------------
	Compiler location: /usr/bin/gcc
	Options file: /apps/matlab-r2020a/bin/glnxa64/mexopts/gcc_glnxa64.xml
	CMDLINE2 : /usr/bin/gcc -pthread -Wl,--no-undefined -Wl,-rpath-link,/apps/matlab-r2020a/bin/glnxa64 -lgomp -lpthread -lm -ldl -shared  -O -Wl,--version-script,"/apps/matlab-r2020a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_9932417573564106_21669/sspropc.o /tmp/mex_9932417573564106_21669/c_mexapi_version.o   ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a  -L${MKLROOT}/lib/intel64  -L${MKLROOT}/interfaces/fftw3   -L"/apps/matlab-r2020a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o sspropc.mexa64
	CC : /usr/bin/gcc
	DEFINES : -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE 
	MATLABMEX : -DMATLAB_MEX_FILE 
	CFLAGS : -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64 
	INCLUDE : -I"${MKLROOT}/include/fftw"  -I"/apps/matlab-r2020a/extern/include" -I"/apps/matlab-r2020a/simulink/include"
	COPTIMFLAGS : -O2 -fwrapv -DNDEBUG
	CDEBUGFLAGS : -g
	LD : /usr/bin/gcc
	LDFLAGS : -pthread -Wl,--no-undefined -Wl,-rpath-link,/apps/matlab-r2020a/bin/glnxa64 -lgomp -lpthread -lm -ldl
	LDTYPE : -shared 
	FUNCTIONMAP : "/apps/matlab-r2020a/extern/lib/glnxa64/mexFunction.map"
	VERSIONMAP : "/apps/matlab-r2020a/extern/lib/glnxa64/c_exportsmexfileversion.map"
	LINKEXPORT : -Wl,--version-script,"/apps/matlab-r2020a/extern/lib/glnxa64/mexFunction.map"
	LINKEXPORTVER : -Wl,--version-script,"/apps/matlab-r2020a/extern/lib/glnxa64/c_exportsmexfileversion.map"
	LINKLIBS : ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a  -L${MKLROOT}/lib/intel64  -L${MKLROOT}/interfaces/fftw3   -L"/apps/matlab-r2020a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++
	LDOPTIMFLAGS : -O
	LDDEBUGFLAGS : -g
	MWCPPLIB : "/apps/matlab-r2020a/sys/os/glnxa64/libstdc++.so.6"
	OBJEXT : .o
	LDEXT : .mexa64
	SETENV : CC="/usr/bin/gcc"
                CXX="g++"
                CFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                CXXFLAGS="-fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -std=c++11 -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE "
                COPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
                CXXOPTIMFLAGS="-O2 -fwrapv -DNDEBUG"
                CDEBUGFLAGS="-g"
                CXXDEBUGFLAGS="-g"
                LD="/usr/bin/gcc"
                LDXX="g++"
                LDFLAGS="-pthread -Wl,--no-undefined -Wl,-rpath-link,/apps/matlab-r2020a/bin/glnxa64 -lgomp -lpthread -lm -ldl -shared  ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a  -L${MKLROOT}/lib/intel64  -L${MKLROOT}/interfaces/fftw3   -L"/apps/matlab-r2020a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -Wl,--version-script,"/apps/matlab-r2020a/extern/lib/glnxa64/mexFunction.map""
                LDDEBUGFLAGS="-g"
	GCC : /usr/bin/gcc
	VER : 4.8.5
	CPPLIBS : /usr/lib/gcc/x86_64-redhat-linux/4.8.5/libstdc++.so
	MATLABROOT : /apps/matlab-r2020a
	ARCH : glnxa64
	SRC : "/home/uceeesi/code/ssprop-3.0.1/sspropc.c";"/apps/matlab-r2020a/extern/version/c_mexapi_version.c"
	OBJ : /tmp/mex_9932417573564106_21669/sspropc.o;/tmp/mex_9932417573564106_21669/c_mexapi_version.o
	OBJS : /tmp/mex_9932417573564106_21669/sspropc.o /tmp/mex_9932417573564106_21669/c_mexapi_version.o 
	SRCROOT : /home/uceeesi/code/ssprop-3.0.1/sspropc
	DEF : /tmp/mex_9932417573564106_21669/sspropc.def
	EXP : "sspropc.exp"
	LIB : "sspropc.lib"
	EXE : sspropc.mexa64
	ILK : "sspropc.ilk"
	MANIFEST : "sspropc.mexa64.manifest"
	TEMPNAME : sspropc
	EXEDIR : 
	EXENAME : sspropc
	OPTIM : -O2 -fwrapv -DNDEBUG
	LINKOPTIM : -O
	CMDLINE1_0 : /usr/bin/gcc -c -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"${MKLROOT}/include/fftw"  -I"/apps/matlab-r2020a/extern/include" -I"/apps/matlab-r2020a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -O2 -fwrapv -DNDEBUG "/home/uceeesi/code/ssprop-3.0.1/sspropc.c" -o /tmp/mex_9932417573564106_21669/sspropc.o
	CMDLINE1_1 : /usr/bin/gcc -c -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"${MKLROOT}/include/fftw"  -I"/apps/matlab-r2020a/extern/include" -I"/apps/matlab-r2020a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -O2 -fwrapv -DNDEBUG "/apps/matlab-r2020a/extern/version/c_mexapi_version.c" -o /tmp/mex_9932417573564106_21669/c_mexapi_version.o
-------------------------------------------------------------------
Building with 'gcc'.
Warning: You are using gcc version '4.8.5-44)'. The
version of gcc is not supported. The version currently
supported with MEX is '6.3.x'. For a list of currently
supported compilers see:
https://www.mathworks.com/support/compilers/current_release. 
/usr/bin/gcc -c -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"${MKLROOT}/include/fftw"  -I"/apps/matlab-r2020a/extern/include" -I"/apps/matlab-r2020a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -O2 -fwrapv -DNDEBUG "/home/uceeesi/code/ssprop-3.0.1/sspropc.c" -o /tmp/mex_9932417573564106_21669/sspropc.o
/usr/bin/gcc -c -DMATLAB_DEFAULT_RELEASE=R2017b  -DUSE_MEX_CMD   -D_GNU_SOURCE -DMATLAB_MEX_FILE  -I"${MKLROOT}/include/fftw"  -I"/apps/matlab-r2020a/extern/include" -I"/apps/matlab-r2020a/simulink/include" -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMKL_ILP64 -m64  -O2 -fwrapv -DNDEBUG "/apps/matlab-r2020a/extern/version/c_mexapi_version.c" -o /tmp/mex_9932417573564106_21669/c_mexapi_version.o
/usr/bin/gcc -pthread -Wl,--no-undefined -Wl,-rpath-link,/apps/matlab-r2020a/bin/glnxa64 -lgomp -lpthread -lm -ldl -shared  -O -Wl,--version-script,"/apps/matlab-r2020a/extern/lib/glnxa64/c_exportsmexfileversion.map" /tmp/mex_9932417573564106_21669/sspropc.o /tmp/mex_9932417573564106_21669/c_mexapi_version.o   ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_gnu_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_cdft_core.a  -L${MKLROOT}/lib/intel64  -L${MKLROOT}/interfaces/fftw3   -L"/apps/matlab-r2020a/bin/glnxa64" -lmx -lmex -lmat -lm -lstdc++ -o sspropc.mexa64
Error using mex
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_mic_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_mic_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_mic_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_mic_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx512_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx2_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx2_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx2_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx2_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_avx_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc3_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc3_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc3_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc3_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_mc_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_def_dfti_create_drmd.o):
In function `commit':
dfti_create_drmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_def_dfti_create_dr1d.o):
In function `commit':
dfti_create_dr1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_r2c_1d_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_def_dfti_create_dcmd.o):
In function `commit':
dfti_create_dcmd.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_md_omp'
/home/uceeesi/intel/oneapi/mkl/latest/lib/intel64/libmkl_core.a(_def_dfti_create_dc1d.o):
In function `commit':
dfti_create_dc1d.c:(.text+0x4): undefined reference to
`mkl_dft_commit_node_d_c2c_1d_omp'
collect2: error: ld returned 1 exit status
0 Kudos
2 Replies
RahulV_intel
Moderator
769 Views

Hi,


Could you please provide a small reproducer code and the build steps?

Also, specify your OS name and version.


Thanks,

Rahul


0 Kudos
Gennady_F_Intel
Moderator
763 Views

Is that FFTW3 wrappers for C?

Did you try to build this C code without mex file but using only icc/gcc compilers and the same linking mkl's line?


0 Kudos
Reply