Intel compiler, efficiency of various complex number types and FFTWvs. Intel's FFT.

K

Kazik�

Hello,
at the beginning I shall say that I'm pretty fresh in Intel compiler
and in MKL (Math Kernel Library) business.
I have two 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.
 
V

Victor Bazarov

Kazik? said:
Hello,
at the beginning I shall say that I'm pretty fresh in Intel compiler
and in MKL (Math Kernel Library) business.
I have two quite general questions.
[..]

Doesn't Intel have developer forums on their web site? Have you tried
asking there?

V
 
K

Kazik�

Hi,
yes, I have tried, but the larger community the more accurate answer
(averaged over many replies), so that is why I've put this post also
here.
Unfortunately I didn't find any Intel compiler oriented group in
google-groups.
Still hoping for some comments,
 
S

Steven G. Johnson

I'm about to write a program performing some fast Fourier transforms
and I'm going to use theFFTW(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 alsoFFTWprovides 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?

As described in the FFTW manual, FFTW's fftw_complex type is bit-
compatible with std::complex, so you can safely use std::complex and
convert to fftw_complex via a typecast reinterpret_cast<fftw_complex*>
(x).

(The reason FFTW defines its own type is that FFTW is an ANSI C-89
API.)

See the FFTW manual:

http://www.fftw.org/doc/Complex-numbers.html

Regards,
Steven G. Johnson

PS. Note that if you are using Intel's wrappers, you are actually
using Intel MKL and not FFTW itself. The wrappers provide the FFTW
API for Intel's MKL code, which supports a subset of the FFTW
functionality. Not that this matters when it comes to datatype
considerations.
 
J

Jonathan Lee

Hi Kazik,
As Victor already mentioned you might find better information
elsewhere. Maybe the fftw mailing list would be best?

There are std::complex, MKL_Complex 16, and also FFTW provides
fftw_complex type. [...] What are (if there are) "dependencies"
between these types?

I don't know what MKL_Complex is, but there are no dependencies
between fftw_complex, and std::complex. The former is simply
a typedef of a double[2]. The latter is (in all likelihood) a
class wrapping the same construct.
Do all typical functions (from standard complex c++ library)
like polar(), sqrt() or cosh() support types different than
std::complex?

No. How could they support non-standard or non-builtin types?
It would be up to the implementer of the type to provide the
overloads.
What is more, I'm really interested in efficiency (speed) of the code.
[...] So what do you think?

Use fftw_complex. Given FFTW's reputation for ridiculous
amounts of optimization, I would use the type they want me
to use. Besides, you're not really interested in the
interface that std::complex provides, so why use a class?

(Don't take that as general advice -- just for the whole
FFT thing).
My doubt is how efficient is this "joint" of Intel and FFTW?

From what I've heard the Intel wrapper is nearly transparent.
But why not just test it? At _worst_ it would copy the data
before and after calling some fft() function. I think they
went to lengths to avoid that, however.
Another doubt concerns multithreading of FFTW.

Don't know anything about this, sorry.

--Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top