Dear R-devel team, I've encountered problems with recent Rs (>= 3.5.3) and MKL. I've followed Dirk's (http://dirk.eddelbuettel.com/blog/2018/04/15/) and Intel's ( https://software.intel.com/en-us/articles/quick-linking-intel-mkl-blas-lapack-to-r) instructions and many versions of MKL. All works fine in my Ubuntu 18 setup for R 3.5.2 and older. Carrying out the install and linking instructions works fine for later Rs, but calculations involving linear algebra become corrupted. E.g., following Dirk's very simple svd example from that link above ...> n <- 1e3 > X <- matrix(rnorm(n*n),n,n) > Xsvd <- svd(X) > Xsvd$d[1:5][1] 63.09366 62.47868 62.26147 61.94530 61.84727 ... you get Eigenvalues that are bigger than 1e26 in R-devel, say, but (correct) values near 60 with R 3.5.2. I just wanted to throw that out there in case anyone else had come across something similar. I don't mind using a slightly older R/MKL for my stuff. I might speculate that the Microsoft R Open folks are having similar issues because they're still using older Rs. I haven't tried compiling and linking from source ( https://cran.r-project.org/doc/manuals/R-admin.html#MKL) because I haven't had success with that in some time. -B [[alternative HTML version deleted]]
Dear Robert, try setting these MKL environment variables export MKL_INTERFACE_LAYER=GNU,LP64 export MKL_THREADING_LAYER=GNU the example should then report correct results (and regardless of the version of R). There is no need to rebuild R from source, but when you are building from source, this problem would be detected by checks in R configure scripts. I can reproduce the problem on Ubuntu 19.04 and MKL installed from binaries as described in Dirk's blog, both with R 3.5.2 and R-devel, and the problem goes away on both when the variables are set. Best Tomas On 7/17/19 3:18 PM, Robert B. Gramacy wrote:> Dear R-devel team, > > I've encountered problems with recent Rs (>= 3.5.3) and MKL. I've followed > Dirk's (http://dirk.eddelbuettel.com/blog/2018/04/15/) and Intel's ( > https://software.intel.com/en-us/articles/quick-linking-intel-mkl-blas-lapack-to-r) > instructions and many versions of MKL. All works fine in my Ubuntu 18 > setup for R 3.5.2 and older. Carrying out the install and linking > instructions works fine for later Rs, but calculations involving linear > algebra become corrupted. E.g., following Dirk's very simple svd example > from that link above ... > >> n <- 1e3 >> X <- matrix(rnorm(n*n),n,n) >> Xsvd <- svd(X) >> Xsvd$d[1:5] > [1] 63.09366 62.47868 62.26147 61.94530 61.84727 > > ... you get Eigenvalues that are bigger than 1e26 in R-devel, say, but > (correct) values near 60 with R 3.5.2. > > I just wanted to throw that out there in case anyone else had come across > something similar. I don't mind using a slightly older R/MKL for my > stuff. I might speculate that the Microsoft R Open folks are having > similar issues because they're still using older Rs. > > I haven't tried compiling and linking from source ( > https://cran.r-project.org/doc/manuals/R-admin.html#MKL) because I haven't > had success with that in some time. > > -B > > [[alternative HTML version deleted]] > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel
Hi Tomas, That does the trick, thanks! In fact, I had those lines commented out in my Rmkl startup script but I can't remember why, since they're part of Intel's instructions. Strange that things still worked for somewhat older Rs. (Perhaps that's why I canceled them.) Dirk, if you're listening, it might help to add a note to your blog post. I guess it's not as simple as "update-alternatives and done" because environment variables still need to be set. Cheers, Bobby On Fri, 26 Jul 2019 at 06:22, Tomas Kalibera <tomas.kalibera at gmail.com> wrote:> Dear Robert, > > try setting these MKL environment variables > > export MKL_INTERFACE_LAYER=GNU,LP64 > export MKL_THREADING_LAYER=GNU > > the example should then report correct results (and regardless of the > version of R). There is no need to rebuild R from source, but when you > are building from source, this problem would be detected by checks in R > configure scripts. I can reproduce the problem on Ubuntu 19.04 and MKL > installed from binaries as described in Dirk's blog, both with R 3.5.2 > and R-devel, and the problem goes away on both when the variables are set. > > Best > Tomas > > On 7/17/19 3:18 PM, Robert B. Gramacy wrote: > > Dear R-devel team, > > > > I've encountered problems with recent Rs (>= 3.5.3) and MKL. I've > followed > > Dirk's (http://dirk.eddelbuettel.com/blog/2018/04/15/) and Intel's ( > > > https://software.intel.com/en-us/articles/quick-linking-intel-mkl-blas-lapack-to-r > ) > > instructions and many versions of MKL. All works fine in my Ubuntu 18 > > setup for R 3.5.2 and older. Carrying out the install and linking > > instructions works fine for later Rs, but calculations involving linear > > algebra become corrupted. E.g., following Dirk's very simple svd example > > from that link above ... > > > >> n <- 1e3 > >> X <- matrix(rnorm(n*n),n,n) > >> Xsvd <- svd(X) > >> Xsvd$d[1:5] > > [1] 63.09366 62.47868 62.26147 61.94530 61.84727 > > > > ... you get Eigenvalues that are bigger than 1e26 in R-devel, say, but > > (correct) values near 60 with R 3.5.2. > > > > I just wanted to throw that out there in case anyone else had come across > > something similar. I don't mind using a slightly older R/MKL for my > > stuff. I might speculate that the Microsoft R Open folks are having > > similar issues because they're still using older Rs. > > > > I haven't tried compiling and linking from source ( > > https://cran.r-project.org/doc/manuals/R-admin.html#MKL) because I > haven't > > had success with that in some time. > > > > -B > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-devel at r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-devel > > >[[alternative HTML version deleted]]