Which Intel FFT to use - IPP or MKL?


#1

Intel provides two FFT libraries - one in MKL (“Math Kernel Library”) and one in IPP (“Integrated Performance Primitives”).

I wasn’t aware of this fact until I was looking into switching code which uses an Intel FFT to use JUCE’s new wrapper of an Intel FFT. I then found out that my colleague’s code uses Intel IPP while JUCE wraps Intel MKL.

So what are the differences? which one is better? which should I use?

  • Intel provides a comparison page which says that for “media and communications” (“Signal processing”, “Audio coding”, “Speech coding and recognition”) IPP is the right choice, and that it is “specifically designed for smaller problem sizes including those used in multimedia” and “embedded C/C++ applications”.
  • From FFTW’s (somewhat old) benchmark results it looks like IPP’s FFT handily beats MKL’s (and beats FFTW too) where it’s available (power-of-2 ffts).
  • KFR’s fft benchmark compares to IPP and FFTW but doesn’t even mention MKL. So this implies that according to them IPP is the obvious choice between the too?

Does anyone have additional data about this? Does anyone know why JUCE chose MKL rather than IPP?


#2

I also find this a bit irritating, especially since the Projucer has a dedicated field for choosing the IPP linking type, so I’d guess they’ve settled on the IPP path.

Disclaimer: the IPP property in the Projucer was a dedicated feature request from myself :slight_smile:


#3

I also find the choice of the more generic MKL library a bit bizarre. I already use the IPP in my project for other stuff, so having to link the MKL again (and not even have proper Projucer support to do it) seems a bit redundant.


#4

Don’t mean to hijack this, but specifically with the FFT are the IPP and MKL versions bit exact relative to each other? And is one faster than the other?


#5

It looks like Intel first made IPP with the focus of having the best performance (according to wp v2 is from 2002).
I guess they then found out that many users won’t use it rather than FFTW because it isn’t feature complete (nothing that concerns us - JUCE only wraps power-of-2 ffts anyhow), so they released MKL’s FFT at 2003 with the focus of having the same features and API as FFTW, so that FFTW users could use it as a drop-in replacement. But it appears not to be as fast as IPP.

EDIT: Corrected by Mathieu below that MKL and FFTW’s interfaces differ


#6

MKL has the same API if you compile the wrappers, but otherwise, it is close to IPP, not FFTW.
https://software.intel.com/en-us/articles/the-intel-math-kernel-library-and-its-fast-fourier-transform-routines


#7

To be honest, I wasn’t aware that IPP also had an FFT. I’ve been using MKL for a while now - I should have done my research.

Is it really true that IPP is significantly faster? Would seem strange to me as MKL is already highly optimised by the same engineers. Also, MKL is freely available to use - is this also true for IPP?

If there is a good reason to add IPP then we’ll definitely do so.


#8

There is a free version of IPP as well.

IPP is definitely more suited for audio application FWIW.


#9

Yes. They are both packaged together under the same license if I understand correctly.


#10

All the scientific Intel libraries are now free (IPP, MKL, TBB…) even for commercial usage (TBB was Open source, but not usable for commercial purposes without agreeing to the GPL IIRC).


#11

One major reason for me, is that the IPP is already supported by the projucer. For the MKL we need to add include paths, linker paths and library names. For IPP we flip a switch.

Makes it MUCH easier to use.

The IPP is also able to take some shortcuts, as it’s designed with audio/video in mind, whereas the MKL is more for scientific computing and more general.


#12

Anyone have any tips on adding the MKL libraries to an Xcode project? I’ve added the .a files but Xcode complains that it can’t find the libs.

Also which are the minimum libs to add just to use the FFT?

Cheers,

Rail


#13

If you’re only using Intel libraries for the FFT, why would you use MKL rather than IPP??


#14

I looked at the JUCE FFT code and the JUCE_DSP_USE_INTEL_MKL has:

#if JUCE_DSP_USE_INTEL_MKL
 #include <mkl_dfti.h>
#endif

Which means I need to use the MKL library (I believe).

I’ve got the environment variables set… but that has no effect on Xcode projects… and adding header and the lib search path:

/opt/intel/compilers_and_libraries_2017.5.220/mac/mkl/include

“/opt/intel/compilers_and_libraries_2017.5.220/mac/mkl/lib”

respectively and adding the libraries to the Other Linker Flags doesn’t work… it still complains it can’t load the library.

Cheers,

Rail


#15

If you’re using JUCE’s current FFT implementation, yes you need to use MKL. However, that would probably be the wrong Intel FFT to choose.


#16

I’m just using the FFT for a Spectroscope… and I wanted to test the Intel FFT to see if there’s any benefit for this application.

The point is that I can’t get the MKL Libs to work… and I’d imagine I’d have the exact same issue with the IPP libs… so any ideas?

Cheers,

Rail


#17

I agree. I ran into the same confusion… MKL option for Juce’s FFT, but also the option in the Projucer to flag that IPP can be used (for what actually?).
I use IPP for convolution (and thus FFT/IFFT). For Eq spectrums I started with the JUCE FFT, but will have to port that to IPP. I do not want to link to MKL as well.

PS to @Rail_Jon_Rogut: drawing paths take much more time than Juce’s basic FFT (at for instance size 1024). I am also very interested to see the difference in performance between the basic Juce FFT and the IPP FFT for such short sizes. Not yet tested or timed in release mode.


#18

Hi Peter,

Can you tell me how you got the Intel IPP Lib to link in Xcode (not using a make file) ?

Cheers,

Rail


#19

For macOS -

Extra linker flags: -Wl,/opt/intel/ipp/lib/libipps.a,/opt/intel/ipp/lib/libippcore.a,/opt/intel/ipp/lib/libippvm.a

Header search paths: /opt/intel/ipp/include/

If I didn’t miss anything then that’s it.


#20

@Rail_Jon_Rogut:

In the Projuce Xcode settings:

External libraries to link:
ippcore
ipps
irc
svml
ippvm
imf

(That’s for my application, some may not be needed)

And in debug and release settings:

Extra library include paths:
/opt/intel/-my-ipp-version-/ipp/include

Extra library search paths:
/opt/intel/-my-ipp-version-/ipp/lib
/opt/intel/-my-ipp-version-/ipp/compiler/lib

Again, for my application, not sure about the second search path

Do not forget to call ippInit() from ipps.h

PS: I am using an older version of IPP, not a recent one.