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

Discussion in 'C++' started by Kazik�, Jul 6, 2009.

  1. Kazik�

    Kazik� Guest

    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.
    --
    Kind regards,
    Kazik
    Kazik�, Jul 6, 2009
    #1
    1. Advertising

  2. Re: Intel compiler, efficiency of various complex number types andFFTW vs. Intel's FFT.

    Kazik? wrote:
    > 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
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, Jul 6, 2009
    #2
    1. Advertising

  3. Kazik�

    Kazik� Guest

    Re: Intel compiler, efficiency of various complex number types andFFTW vs. Intel's FFT.

    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,
    --
    Best,
    Kazik
    Kazik�, Jul 6, 2009
    #3
  4. Re: Intel compiler, efficiency of various complex number types andFFTW vs. Intel's FFT.

    On Jul 6, 11:56 am, Kazik <> wrote:
    > 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.
    Steven G. Johnson, Jul 6, 2009
    #4
  5. Kazik�

    Jonathan Lee Guest

    Re: Intel compiler, efficiency of various complex number types andFFTW vs. Intel's FFT.

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

    On Jul 6, 11:56 am, Kazik <> wrote:
    > 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
    Jonathan Lee, Jul 6, 2009
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. aj
    Replies:
    3
    Views:
    4,179
    Jaakko Varteva
    Nov 24, 2005
  2. Soren Kuula
    Replies:
    2
    Views:
    561
    Henry S. Thompson
    Dec 1, 2005
  3. Michael Wagner

    When to use various types of casts?

    Michael Wagner, Aug 18, 2003, in forum: C++
    Replies:
    4
    Views:
    527
    Rolf Magnus
    Aug 18, 2003
  4. Ryan Mitchley
    Replies:
    0
    Views:
    408
    Ryan Mitchley
    Jul 19, 2004
  5. whatnext
    Replies:
    9
    Views:
    419
Loading...

Share This Page