With the release of Oracle R Distribution 3.6.1, we’ve rerun the R-Benchmark-25 script to highlight the current performance gains using dynamically linked Intel Math Kernel Library with Oracle R Distribution.
Open source R's internal BLAS library was created when multi-core machines were uncommon. Hence by design, R is single-threaded and will only use one processor of a multi-core machine when doing calculations. Several parallel processing packages for R exist that enable running parallel simulations, but these libraries require rewriting your R code respectively.
However, the BLAS API in R allows linking to different, multi-threaded BLAS libraries. This makes it possible for many typical R operations, such as matrix multiplication and matrix decomposition, to compute in parallel using all available cores to reduce computation times.
Oracle R Distribution simplifies the linking process by loading the high performance math library after it's added to PATH or LD_LIBRARY_PATH, depending on the Operating System. Then you are set to use optimized math libraries - the Intel Math Kernel Library (MKL), AMD Core Math Library (ACML), or Solaris Sun Performance Library.
Our benchmark tests show that linking to MKL improves the performance of R code, especially where many vector and matrix operations are used. Performance increases with additional cores, so one can expect better results on an eight-core machine than on a four-core machine.
Compared to open source R, MKL offers significant performance gains:
The benchmark results demonstrate the performance of Oracle R Distribution 3.6.1 with and without dynamically loaded MKL. The tests were run on an 8-core Linux system with 120 GB of RAM.
On average, Oracle R Distribution with dynamically loaded MKL and 8 threads is 55 times faster than Oracle R Distribution (and open source R) using R's internal BLAS library (Netlib) with 1 thread. Matrix multiplication is an impressive 98 times faster than single-threaded R, and principal components analysis is 35 times faster. This is an overall performance boost of 15% since we last ran the benchmarks on R-3.3.0 due to linear algebra performance improvements introduced in R-3.4.0.
By default, MKL is configured to use as many parallel threads as there are available cores. However, you might want to limit the number of threads to reserve some processing capacity for other activities.
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 allows MKL to use 3 threads:
$ export MKL_NUM_THREADS=3
After setting MKL_NUM_THREADS to 3, the output of the Oracle R Distribution function Sys.BlasLapack() shows a value of 3 for $nthreads.
 "Intel Math Kernel Library (Intel MKL)"
Oracle R Distribution, Oracle's distribution of Open Source R, improves performance by dynamically linking to optimized, multi-threaded BLAS libraries. Unlike open source R, Oracle R Distribution uses all available cores and processors when dynamically linked against optimized BLAS, resulting in increased performance.
These advantages would not be possible without the contributions of the R Core Group members. Oracle is a founding member of the R Consortium, which is dedicated to promoting the R language and leading initiatives that support the R community.