开发者

C/C++ Matlab compiler vs MKL

Is there a significant performance difference between Matlab numerical routines exposed as a C/C++ dll through Matlab mcc versus equivalent routines found in 开发者_如何转开发Math Kernel Library?

I'm particularly interested in the performance of linear least square solvers such as ?gels and fourier transform routines.


Matlab adds a layer to anything it calls, fftw, lapack, mkl.

If you compile a special version, of whatever code, it will always run faster without the matlab overhead.

If you don't know what you're doing, use built-in libs, if you're an old f77 hacker like me, I write my own routines and only use the built-in libs when I'm feeling lazy or prototyping an algorithm.


For the Fourier Transform routines, I would recommand FFTW depending on the usage scenario. FFTW is optimized for a prepare-once, reuse-often scenario. So if you need to compute the same kind of transform, let's say a 1024x2000 (non-power-of-2) transform inside a loop, FFTW will be faster. If you need to compute a different transform type (dimensions change every time), then MKL will be faster.

The way FFTW works is that your software first call the prepare routine, which can take from a few ms to a few seconds (you can configure this) to check your particular platform and choose the most optimized routine. Then you can call repeatedly the transform routine with optimized parameter.

All other known libraries have fix-ed-optimization, which may or may not be optimal for your platform.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜