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:
a = randn(2000); tic; [b,c]=eig(a);toc;
– Archisman Panigrahi
Aug 09 '20 at 19:15
htop? I thought it is a CLI task manager
– Archisman Panigrahi
Aug 09 '20 at 19:18
htop is a console-based process manager. I have checked load of dynamic MKL libraries by using it to be sure that they were really loaded. Will do the benchmark.
– N0rbert
Aug 09 '20 at 19:22
intel-mkl package. It is much faster (i3), but the results are all wrong for large matrices. Could you check whether the code at the end of that link gives wrong answer (which changes every time!!) with MKL? Then I would open a bug report.
– Archisman Panigrahi
Aug 10 '20 at 05:04
scilab-cli gives correct results with MKL and it is 2.5 times faster (to compare with default libraries) for the same task. The test script is located on GitHub. So you have to create bug report about using MKL with Octave.
– N0rbert
Aug 10 '20 at 10:24