[prev in list] [next in list] [prev in thread] [next in thread]
List: r-sig-mac
Subject: Re: [R-SIG-Mac] Linking R 4.0 to an alternative BLAS
From: "Braun, Michael" <braunm () mail ! smu ! edu>
Date: 2020-04-30 14:42:53
Message-ID: 13F3ED3F-168C-42E1-92A8-84372FD45530 () mail ! smu ! edu
[Download RAW message or body]
Douglas:
Thank you for your response. I apologize for not being more clear in my post. I \
know how to link *to* a BLAS, just as you described. The problem is that under R \
4.0.0, it is not clear what to link *from*.
This is my $R_HOME/lib directory for R-4 (removing dSYM directories for space)
~ $ ls -l $R_HOME/lib
total 19120
-rwxrwxr-x@ 1 root admin 4070896 Apr 24 05:23 libR.dylib
-rwxrwxr-x 1 root admin 201472 Apr 24 05:23 libRblas.dylib
-rwxrwxr-x 1 root admin 2181472 Apr 24 05:23 libRlapack.dylib
-rw-rw-r-- 1 root admin 160624 Apr 24 05:23 libgcc_s.1.dylib
-rwxrwxr-x 1 root admin 2851008 Apr 24 05:23 libgfortran.5.dylib
-rwxrwxr-x 1 root admin 309648 Apr 24 05:23 libquadmath.0.dylib
You will see that libRblas.dylib is an actual library for the default R BLAS, not a \
symlink. So if I were to do as you suggest, I would overwrite the default reference \
BLAS with the symlink. I would not be able to go back to the default BLAS if I ever \
needed to.
Under R-3.6.3 and earlier, $R_HOME/lib looks like this (after linking to the Intel \
BLAS, and again edited for space)
~ $ ls -l /Library/Frameworks/R.framework/Versions/3.6/Resources/lib
total 22168
-rwxrwxr-x 1 root admin 3720000 Mar 5 20:06 libR.dylib
-rwxrwxr-x 1 root admin 210512 Mar 5 20:06 libRblas.0.dylib
lrwxr-xr-x 1 root admin 73 Mar 10 13:05 libRblas.dylib -> \
$MKLROOT/lib/libmkl_rt.dylib
-rwxrwxr-x 1 root admin 2225088 Mar 5 20:06 libRlapack.dylib
-rwxrwxr-x 1 root admin 874416 Mar 5 20:06 libc++.1.dylib
-rwxrwxr-x 1 root admin 237904 Mar 5 20:06 libc++abi.1.dylib
-rwxrwxr-x 1 root admin 317696 Mar 5 20:06 libgcc_s.1.dylib
-rwxrwxr-x 1 root admin 1648416 Mar 5 20:06 libgfortran.3.dylib
-rwxrwxr-x 1 root admin 610928 Mar 5 20:06 libomp.dylib
-rwxrwxr-x 1 root admin 304848 Mar 5 20:06 libquadmath.0.dylib
-rwxrwxr-x 1 root admin 1084288 Mar 5 20:06 libreadline.5.2.dylib
lrwxr-xr-x 1 root admin 21 Mar 10 13:02 libreadline.dylib -> \
libreadline.5.2.dylib
-rwxrwxr-x 1 root admin 86320 Mar 5 20:06 libunwind.1.dylib
Note that the reference BLAS file was libRblas.0.dylib, not libRblas.dylib. By \
default, libRblas.dylib was a link to libRblas.0.dylib, but I changed that link to \
the BLAS I want (here I use Intel because it works with parallel R code, but I can \
do the same kind of thing with vecLib). This is the *expected* behavior, and is \
consistent with the R for Mac FAQ.
Now, it is correct that the FAQ is not up-to-date anyway, since \
libRblas.vecLib.dylib is not included (and I do not think it has been for a while). \
Your workaround is exactly what I did under R-3, but does not seem to be possible in \
R-4 without some manual renaming. Before I do that renaming (and possibly break \
something), I'd like some confirmation that this is an oversight, and not by design.
Thanks,
Michael
On Apr 30, 2020, at 4:22 AM, Douglas Yu <dougwyu@mac.com<mailto:dougwyu@mac.com>> \
wrote:
libBLAS.dylib is indeed the one to link
i did the following on macOS 10.14.6:
# R default BLAS test
d <- 5e3
system.time({ x <- matrix(rnorm(d^2),d,d); tcrossprod(x) })
# user system elapsed
# 186.718 1.483 189.839
system.time({ x <- matrix(rnorm(d^2),d,d); solve(x) })
# user system elapsed
# 273.504 1.909 277.557
# to use vecLib
cd /Library/Frameworks/R.framework/Resources/lib
ln -sf /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib \
libRblas.dylib
# Restart R
# vecLib test
d <- 5e3
system.time({ x <- matrix(rnorm(d^2),d,d); tcrossprod(x) })
# user system elapsed
# 11.030 0.266 3.876
system.time({ x <- matrix(rnorm(d^2),d,d); solve(x) })
# user system elapsed
# 23.432 0.621 6.830
--
Prof. Douglas W. Yu
School of Biological Sciences, University of East Anglia, Norwich, Norfolk NR4 7TJ \
UK, mob +44-7510-308-272 Kunming Institute of Zoology, 21 Qingsong Lu, Kunming, \
Yunnan 650201 China 中国云南昆明市盘龙区茨坝青松路21号, ofc \
+86-871-519 9178, mob +86 183 138 29970 \
people.uea.ac.uk/en/persons/douglas-yu<https://people.uea.ac.uk/en/persons/douglas-yu>, \
eastanglia.academia.edu/DouglasYu/Papers<http://eastanglia.academia.edu/DouglasYu/Papers> \
for pdfs
On 29 Apr 2020, at 18:11, Braun, Michael \
<braunm@mail.smu.edu<mailto:braunm@mail.smu.edu>> wrote:
Under R 3.6.3 and earlier, I would link R to an alternative BLAS. Following R for Mac \
FAQ, Sec. 10.5, I would redirect the symbolic link $R_HOME/lib/libRblas.dylib to \
point to whichever BLAS I wanted to use, (either vecLib or Intel MKL) instead of the \
reference BLAS at libRblas.0.dylib.
With the R 4.0.0 precompiled binaries from CRAN, under $R_HOME/lib, libRblas.dylib \
is the reference BLAS itself, and there is no libRblas.0.dylib file. Is this by \
design? Is there an officially recommended alternative?
Thanks,
MB
--------------------------
Michael Braun
Associate Professor of Marketing, and
Corrigan Research Professor
Cox School of Business
Southern Methodist University
Dallas, TX 75275
braunm _at_ smu.edu<http://smu.edu/><http://smu.edu<http://smu.edu/>>
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org<mailto:R-SIG-Mac@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
[[alternative HTML version deleted]]
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic