The instructions in this section explain how to configure Oracle R Distribution to use MKL on a Linux or Windows client. With this simple configuration step, Oracle R Distribution dynamically uses MKL if it is installed on your system.
This topic contains these sections:
Follow these steps to enable MKL for Oracle R Distribution on a Linux Client.
Install MKL. You can download MKL from the Intel® Math Kernel Library website.
Note: To install MKL on your computer, you must have an MKL license.
Add libmkl_rt.so
, $RHOME/lib
, and $ORACLE_HOME/lib
to the LD_LIBRARY_PATH
system environment variable. For example, in the Bash shell:
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:
/path_to/libmkl_rt.so:
${RHOME}/lib:
${ORACLE_HOME}/lib
Start R and execute the Sys.BlasLapack
function:
Sys.BlasLapack() $vendor [1] "Intel Math Kernel Library (Intel MKL)" $nthreads [1] -1
The returned value of $vendor
indicates that MKL has replaced the BLAS
and LAPACK
that are native to R.
The returned value of nthreads
indicates the number of threads to be used by MKL. By default all available threads are used ($nthreads
= -1).
You can change the number of threads to be used by MKL by editing the system environment variable MKL_NUM_THREADS
. For example, the following statement in the Bash shell, causes MKL to use 3 threads:
export MKL_NUM_THREADS=3
After setting MKL_NUM_THREADS
to 3, the output of Sys.BlasLapack
shows a value of 3 for $nthreads
.
R> Sys.BlasLapack() $vendor [1] "Intel Math Kernel Library (Intel MKL)" $nthreads [1] 3
Follow these steps to enable MKL for Oracle R Distribution on a Windows client (64-bit).
Install MKL. You can download MKL from the Intel® Math Kernel Library website:
Note: To install MKL on your computer, you must have an MKL license.
Add the location of libOrdBlasLoader.dll
and mkl_rt.dll
to the PATH
system environment variable.For instructions, see.
Note:
In a typical installation of Oracle R Distribution, libOrdBlasLoader.dll
is located in the R home directory:
C:\Program Files\R\R-version\bin\x64
In a full installation of MKL 11.1, mkl_rt.dll
is located in the Intel MKL Composer XE directory:
C:\Program Files (x86)\Intel\Composer XE 2013 SP
Start R and execute the Sys.BlasLapack
function:
R> Sys.BlasLapack() $vendor [1] "Intel Math Kernel Library (Intel MKL)" $nthreads [1] -1
The returned value of $vendor
indicates that MKL has replaced the BLAS
and LAPACK
that are native to R.
The returned value of nthreads
indicates the number of threads to be used by MKL. By default all available threads are used ($nthreads
= -1).
You can change the number of threads to be used by MKL by editing the system environment variable MKL_NUM_THREADS
. If MKL_NUM_THREADS
does not exist, then you must create it as described in:
After setting MKL_NUM_THREADS
to 3, the output of Sys.BlasLapack
shows a value of 3 for $nthreads
.
R> Sys.BlasLapack() $vendor [1] "Intel Math Kernel Library (Intel MKL)" $nthreads [1] 3