0

I'm pretty new to Math Kernel Library, and I've faced a problem in compiling a very simple FFT operation on one dimension of a matrix. I know that the problem is about linking and it's not special to mkl.

MKL_Complex16 a[4];
MKL_Complex16  a_fft[4];

DFTI_DESCRIPTOR_HANDLE dft_descriptor_handle_kx; 
MKL_LONG status_kx, l;
l=4;
status_kx = DftiCreateDescriptor(&dft_descriptor_handle_kx, DFTI_DOUBLE, DFTI_COMPLEX, 1, l);
status_kx = DftiSetValue(dft_descriptor_handle_kx, DFTI_PLACEMENT, DFTI_NOT_INPLACE);
status_kx = DftiCommitDescriptor(dft_descriptor_handle_kx);
status_kx = DftiComputeBackward(dft_descriptor_handle_kx, a, a_fft);
status_kx = DftiFreeDescriptor(&dft_descriptor_handle_kx);

and I receive this error messages:

/tmp/icpcxXraKo.o: In function `main':
testing.cpp:(.text+0x47): undefined reference to `DftiCreateDescriptor_d_1d'
testing.cpp:(.text+0x60): undefined reference to `DftiSetValue'
testing.cpp:(.text+0x6d): undefined reference to `DftiCommitDescriptor'
testing.cpp:(.text+0x85): undefined reference to `DftiComputeBackward'
testing.cpp:(.text+0x92): undefined reference to `DftiFreeDescriptor'

I would be so glad if you help me with this issue.

Amir D.
  • 21
  • 2

1 Answers1

0

Your build command should look something like this:

g++ -v -m64 \
 -I/opt/intel/mkl/include -I/home/…/include -g -O2 -O2 -o exp_1.exe exp_1.cc \
 -L/opt/intel/composerxe/lib/intel64 \
 -L/opt/intel/mkl/lib/intel64 \
 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -Wl,--verbose

Specifically, "-L" should point to your MKL library directory, and you need a "-l" for every library you need to link with.

The syntax will differ depending on your a) application, b) OS and c) compiler.

You can find the documentation for your platform here:

FoggyDay
  • 11,962
  • 4
  • 34
  • 48