Linking MKL to R on Windows
š° Iām still using this on R version 4.3.0 and it works fine.
š¦ The Bottom Line (at the top)
Revolutions R came along around 2007 and provided more powerful R computingā¦ it was freeware, but as I recall you had to register to get it. A few years later, Microsoft bought it and called it Microsoft R Open. Unfortunately, it will be gone soon if not gone already. Here is a work around from the discussion on Stackoverflow - Linking Intelās Math Kernel Library (MKL) to R on Windows.
These notes are for Windows. If you run Linux, go to MKL4DEB for details (as mentioned there, youāll want to scroll down to the Appendix first).
Before you start, do this and record how flippinā long it takes to run:
# Singular Value Decomposition
m <- 10000
n <- 2000
A <- matrix (runif (m*n), m, n)
system.time (S <- svd (A, nu=0, nv=0))
Now close R and let the magic begin ā¦
š¦ Steps to Enhance R version 4
This is an easy update as described in the discussion on Stackoverflow previously mentioned.
-
Download the library files from here (itās an archive with 2 directories) libraries.zip and extract everything.
-
Go to the directory where R is installed, something like
C:\Program Files\R\R-4.xxx\bin\x64\
, and changeRlapack.dll
andRblas.dll
toRlapack.dll.bak
andRblas.dll.bak
, respectively, as backups. -
From the extracted folder in step 1, paste all the content from the folders
complier
andmkl
into the directory where R is installed. -
Inside the destination folder, create 2 (additional) copies of
mkl_rt.dll
and rename the new files asRlapack.dll
andRblas.dll
and keepmkl_rt.dll
. -
Start R and rerun the SVD code and be amazed š at the difference in computation time.