eddelbuettel/mkl4deb

Fixing problems with MKL when using `intel-mkl`

cloudbroken opened this issue · 1 comments

Documenting here how to get R working properly with MKL when installing the intel-mkl package on Ubuntu.

I am running Ubuntu 20.4 LTS and R 4.2.2
Install the MKL package sudo apt install intel-mkl

If you are working in the R console, it is sufficient to set MKL_THREADING_LAYER=GNU or MKL_THREADING_LAYER=SEQUENTIAL environment variables, eg in /etc/environment. The terminal session needs to be restarted (not just the R session).

RStudio won't load these variables however - it needs to be set in an .Renviron file in the home directory. Restart R after modifying .Renviron.

With either approach, verify the MKL_THREADING_LAYER variable is set by runnning Sys.getenv().

With the above approach, I am seeing consistent behaviour of pcox with small and large data uisng MKL as described in #13 (comment)
The example in the bug reported here https://bugs.launchpad.net/ubuntu/+source/intel-mkl/+bug/1989161 is resolved.
The issue with running benchmarks described here #2 (comment) is also resolved.

Thanks for taking the time to contribute this here, but you picked the wrong repo. Read the README.md, check the commit history: I set this up for a helper script to get MKL before it was added to Ubuntu proper so if there are improvements to be had, please talk to the respective maintainers (at Ubuntu/Canonical) or the upstream folks at Intel. Good luck!