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

Efficiency of various complex number types & FFTW vs. Intel's FFT.

Kazik
Beginner
1,156 Views
Hello,
at the beginning I shall say that I'm pretty fresh in Intel compiler and in MKL business.
I have to quite general questions.

1:
I'm about to write a program performing some fast Fourier transforms and I'm going to use the FFTW (via Intel's wrapper library). However, I've started to wonder (in quite general terms) which of complex types that are provided shall I use. There are std::complex, MKL_Complex 16, and also FFTW provides fftw_complex type. I'm little bit confused about that. What are (if there are) "dependencies" between these types? Do all typical functions (from standard complex c++ library) like polar(), sqrt() or cosh() support types different than std::complex?
What is more, I'm really interested in efficiency (speed) of the code. I've heard quite bad things about this aspect of std::complex [people I've spoken to suggested me rather splitting complex numbers into real and imaginary part and perform all the operations "explicitly" on the Re and Im]. So what do you think? And are MKL_Complex16 or fftw_complex real alternatives for std::complex in this particular field?

2:
As I've mentioned above I'm going to use FFTW via Intel's wrapper library. As I've mentioned as well, I really seek for efficiency of my code (I perform some scientific computations). My doubt is how efficient is this "joint" of Intel and FFTW? Maybe it would be better to use these Intel-built FFT functions? Another doubt concerns multithreading of FFTW. I know how to make FFTW work multithreaded using gcc compiler but I know as well that Intel's icc and icpc use more "general" mechanism to use multi-core processors. So how effective is this native Intel's mechanism? And what are the results of using them to multithread FFTW code?

I will be very grateful for any explanations or suggestions.
--
Kind regards,
Kazik
0 Kudos
1 Reply
TimP
Honored Contributor III
1,156 Views
There's a preference for C99 complex when performance is desired from compiled code, but that doesn't affect the performance you get from someone else's library. If you are forced to compile your own code under a prohibition against C99, it's possible that declaring your complex arrays as plain float or double may give better performance.
You'd have to dig into the MKL documents to see what it says about which functions take advantage of threading for which problem sizes, if that's what you mean by your talk of multi-core mechanism.
0 Kudos
Reply