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

FFT not working for N >= 2048

Novack__Bryan
Beginner
563 Views

I'm attempting to compute an FFT on sizes N>=2048. What I can't explain is why the FFT output looks great for N<2048 but then goes to garbage when N>=2048. I've poured over other forum posts and examples online and haven't found anything useful to date. I'm using the 2019 initial release on 64-bit CentOS7 machine compiled into C++ project.

My code is pretty simple, but hopefully it is something obvious that I've just overlooked.

My tempSignal variable is the real data coming from an RF receiver. You'll notice the printf statements. The first printf statement is logging the fftInput to terminal which I then copy into Matlab. The final printf shows only the first 20 entries of the fftOutput which I then compare to what Matlab produces via its fft function.

unsigned int N = 2048
std::vector<MKL_Complex8> fftInput(N);
for(unsigned int i=0; i<fftInput.size(); ++i) {
  fftInput.data().real = tempSignal.getData().real();
  fftInput.data().imag = tempSignal.getData().imag();
  printf("%f + %fi\n", fftInput.data().real, fftInput.data().imag);
}

std::vector<MKL_Complex8> fftOutput(fftInput.size());

DFTI_DESCRIPTOR_HANDLE descriptor;
MKL_LONG status;
status = DftiCreateDescriptor(&descriptor, DFTI_SINGLE, DFTI_COMPLEX, 1, fftInput.size());
status = DftiSetValue(descriptor, DFTI_PLACEMENT, DFTI_NOT_INPLACE); //Out of place FFT
status = DftiCommitDescriptor(descriptor); //Finalize the descriptor
status = DftiComputeForward(descriptor, fftInput.data(), fftOutput.data()); //Compute the Forward FFT
status = DftiFreeDescriptor(&descriptor); //Free the descriptor

for(unsigned int i=0; i<20; ++i) {
  printf("i: %d, (%f, %f)\n", i, fftOutput.real, fftOutput.imag);
}

Thanks in advance for any help.

0 Kudos
2 Replies
Gennady_F_Intel
Moderator
563 Views

could you show VERBOSE mode output?

0 Kudos
Novack__Bryan
Beginner
563 Views

For those who come across this post.....

I don't fully understand why but my problem was solved by linking against the following libraries:

  "iomp5",
  "mkl_core",
  "mkl_intel_ilp64",
  "mkl_intel_thread",

I was initially linking against only "mkl_rt" which 'worked' in the sense that it executed, but the results were not correct. Someone mentioned in a different forum post to use the following website which I did and it led me to use the libraries I listed above.

https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor

Maybe this will help someone else along the way.

0 Kudos
Reply