Why is Octave slower than MATLAB?

南笙酒味 提交于 2019-11-30 01:19:28

There are four ways how Matlab code gets sped up:

  • JIT: compiling at runtime helps with loops but seems to speed up (or at least interact with) other parts of the code as well, according to my anecdotal observations.

  • Implementing functions in C/C++: There's a bunch of Matlab/Octave functions that are implemented in Matlab/Octave. At every release, there's a bunch more of them that get made into built-ins.

  • Multithreading: There's a list of functions that have multithreaded implementations, which will speed up function calls.

  • Generally more efficient implementations. For example the median filter got a massive speed boost for integer inputs a few releases ago.

All of these approaches need developers dedicated to make code faster. As far as I know, a major concern of Octave developers is to make sure (Matlab) functionality is there at all, whereas performance increase seems to have been a focus of Matlab development in the last few years.

Matlab internally uses Intel Math Kernel Library (Intel MKL) for vector and matrix operations. This gives Matlab a significant advantage over Octave.

Try the commands 'version -lapack' and 'version -blas' in your Matlab to check the version of MKL your Matlab is using.

A quick link which discuss the usage of MKL by Matlab is http://stanford.edu/~echu508/matlab.html .

Intel MKL is proprietary. software.intel.com/en-us/intel-mkl . However, for non-commercial use, the Linux version is free. If Octave can somehow use the MKL installed on our machines, it should significantly speed up Octave.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!