[R-SIG-Mac] Can R on a Mac use the GPU
William R Revelle
reve||e @end|ng |rom northwe@tern@edu
Wed Feb 22 16:54:25 CET 2023
Dear Taras et al.
I currently use
BLAS: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/Resources/lib/libRlapack.dylib
In the help page for R-mac developers it says:
The BLAS library used by R depends on the way R was compiled (see ‘R Installation and Administration’ manual for details). Current R binaries supplied from CRAN provide both vecLib-based BLAS and reference BLAS shipped with R. vecLib is a part of Apple’s Accelerate framework which provides an optimized BLAS implementation for Mac hardware. Although fast, it is not under our control and may possibly deliver inaccurate results.
The CRAN binary uses --enable-BLAS-shlib option and two Rblas shared libraries are supplied: libRblas.vecLib.dylib which uses vecLib BLAS and libRblas.0.dylib which uses reference BLAS from R. A symbolic link libRblas.dylib determines which one is used. Currently the default is to use the R BLAS: this is recommended for precision.
The statement: "Although fast, it is not under our control and may possibly deliver inaccurate results” worries me. Should it?
My routines that are most matrix heavy are finding correlations, doing factor analysis using my fa function, and using the CFA function in Lavaan. Accuracy in these results is important,
But spending several hours finding large correlation matrices has driven me to search for speed.
Bill
On Feb 22, 2023, at 12:46 AM, Taras Zakharko <taras.zakharko using uzh.ch> wrote:
H Bill,
I am not aware of any packages that do this for you directly. While it is certainly possible to write a Metal shader that will get the job done, it will likely take a substantial amount of non-trivial effort. To further complicate the issue Apple GPUs do not support double-precision computation (used by R).
Maybe it would be possible for you to accelerate computation used Apple-provided routines from the Acceleration framework (e.g. BLAS and LAPACK)? Many of those routines have access to the hardware matrix accelerators present on Apple hardware and can result in major performance improvements.
Best,
Taras
On 21 Feb 2023, at 18:12, William R Revelle <revelle using northwestern.edu> wrote:
Dear R-Mac users.
In trying to speed up a large correlation problem (600K subjects, 6k variables,) which I can do using my bigCor function, I decided it was time to learn how to use GPU on my Mac book with its M1 Max gpu.
Having spent a day searching the web and trying various approaches, I give up.
Are there any packages I can use to do calculations on the GPU part of my Mac using R?
Thanks.
Bill
William Revelle personality-project.org/revelle.html
Professor personality-project.org
Department of Psychology www.wcas.northwestern.edu/psych/
Northwestern University www.northwestern.edu/
Use R for psychology personality-project.org/r
It is 90 seconds to midnight www.thebulletin.org
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac using r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
William Revelle personality-project.org/revelle.html
Professor personality-project.org
Department of Psychology www.wcas.northwestern.edu/psych/
Northwestern University www.northwestern.edu/
Use R for psychology personality-project.org/r
It is 90 seconds to midnight www.thebulletin.org
[[alternative HTML version deleted]]
More information about the R-SIG-Mac
mailing list