Skip to content

Bug Report: R for Windows installer fails to enable Intel MKL on modern hardware

2 messages · mo. sadik khan, Tomas Kalibera

#
Dear R Core Development Team,

I am writing to report a potential issue with the standard R installer for
Windows. On modern, high-performance hardware, the installer does not
appear to be automatically enabling the Intel Math Kernel Library (MKL) as
expected, defaulting instead to the standard, single-threaded BLAS/LAPACK
libraries.

Here are the details of my system and the steps to reproduce the issue:

*1. System Information*

   -

   *Hardware:* Lenovo Legion Pro 5 Laptop
   -

   *Operating System:* Windows 11 x64 (build 26100)
   -

   *R Version:* R version 4.5.1 (2025-06-13 ucrt)
   -

   *sessionInfo() Output:*

   R version 4.5.1 (2025-06-13 ucrt)
   Platform: x86_64-w64-mingw32/x64
   Running under: Windows 11 x64 (build 26100)

   Matrix products: default
     LAPACK version 3.12.1

   locale:
   [1] LC_COLLATE=English_United States.utf8
   [2] LC_CTYPE=English_United States.utf8
   [3] LC_MONETARY=English_United States.utf8
   [4] LC_NUMERIC=C
   [5] LC_TIME=English_United States.utf8


*2. Steps to Reproduce*

   1.

   Performed a clean uninstall of any previous R versions.
   2.

   Downloaded the latest R installer from the official CRAN mirror:
   https://cran.r-project.org/bin/windows/base/.
   3.

   Ran the installer using the standard, default settings.
   4.

   Opened R and ran the sessionInfo() command to check the linked math
   libraries.

*3. Expected Result* I expected the sessionInfo() output to show a
reference to mkl_rt.dll in the LAPACK line, confirming that the
high-performance, multi-threaded MKL was active.

*4. Actual Result* The sessionInfo() output shows Matrix products: default
and LAPACK version 3.12.1, with no mention of MKL. This indicates that the
standard, slower libraries were installed. This significantly impacts
performance for computationally intensive tasks like PCA on large matrices.

Thank you for your incredible work on R. I hope this report is helpful in
improving the installation experience on Windows. Please let me know if any
further information or testing would be useful.

Sincerely,

Mohd. sadik
#
If you want to use MKL or other optimized BLAS/LAPACK implementation 
with released versions of R, you have to use Linux (or macOS). It is 
easily possible on Debian (/Ubuntu) or Fedora distributions without 
building R from source.

---

On Windows, this is not readily supported. BLAS/LAPACK there is linked 
via libraries Rlapack.dll and Rblas.dll included in the R installation. 
In the official installer from CRAN, these are always (statically) 
linked to the reference implementation. It is possible to build R from 
source and make these use an alternative implementation - the make files 
included within R sources include support for OpenBLAS (which is part of 
Rtools) and ATLAS (but that hasn't been tested recently).? There are 
reports from users who have been using OpenBLAS repeatedly.

It should not be too hard to use another external implementation, but 
this hasn't been tested afaik. The BLAS/LAPACK detection you can see in 
sessionInfo() on Unix systems doesn't work on Windows (except for LAPACK 
version which can be obtained via LAPACK API) - the detection based on 
figuring out which dynamic library is linked to provide BLAS/LAPACK on 
Windows wouldn't give anything useful (always it is Rlapack, Rblas).

If you try building R from source, it is tempting to use more aggressive 
compiler optimizations than by default even for R itself and R packages? 
(the default in R make files for Windows). If you do that, be prepared 
to run into problems, because this is not routinely tested and may lead 
to different/incorrect numerical results due to code not robust enough 
to optimizations or due to compiler bugs.

Best
Tomas
On 8/4/25 19:30, mo. sadik khan wrote: