Intel Math Kernel Library is a BLAS library, which is available in Ubuntu repositories from Ubuntu 19.10 onwards, and is reported to give much faster results.
How to make GNU Octave use Intel MKL installed from the repositories?
Intel Math Kernel Library is a BLAS library, which is available in Ubuntu repositories from Ubuntu 19.10 onwards, and is reported to give much faster results.
How to make GNU Octave use Intel MKL installed from the repositories?
You have to install Octave with
sudo apt-get install octave
and then install the full Intel MKL development package with
sudo apt-get install libmkl-full-dev
during installation you have to select Intel MKL as default mathematical libraries provider.
Important:
To avoid bug between Octave and MKL one should add the following variable declaration to the ~/.bashrc or ~/.profile:
export MKL_THREADING_LAYER=gnu
and then launch Octave.
As noted in the recent comments in the bug, Octave closes with segmentation fault when __run_test_suite__ is run, even after applying this workaround. At the moment it is not recommended to use the version of Octave from the Ubuntu repositories alongside MKL.
To confirm that MKL is used one can see htop libraries listing below (F4, octave, select octave-gui, L, F4, mkl):
Benchmark by using code below
c = sin((1:500)' + (1:500).^2);
tic;
g = eig(c);
toc
m = max(real(g))
assert (m, 16.914886, 1e-6)
Using Intel i7-3537U: