Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R detection of Blas version

Tags:

Is there a way of detecting the version of BLAS that R is using from inside R? I am using Ubuntu, and I have a couple of BLAS versions installed - I just don't know which one is "active" from R's point of view!

I am aware of http://r.789695.n4.nabble.com/is-Rs-own-BLAS-td911515.html where Brian Ripley said in June 2006 that it was not possible - but have things changed?

like image 760
Sean Avatar asked Mar 12 '12 10:03

Sean


People also ask

How do I check my Blas?

The first step is to determine where is the BLAS library on your system. Use the command "locate libblas.so" to find the library. If several results are reported, look for the version under /usr/lib/ or /usr/lib64 or something similar to that path.

What is Blas in R?

The BLAS (Basic Linear Algebra Subprograms) are routines that provide standard building blocks for performing basic vector and matrix operations.

Does R use LAPACK?

Typically, the R version of LAPACK will appear as libRlapack.so ( libRlapack. dylib ), depending on how R was built. Note that libRlapack.so ( libRlapack. dylib ) may also be shown for an external LAPACK implementation that had been copied, hard-linked or renamed by the system administrator.


1 Answers

I think you cannot. R will be built against the BLAS interface, and R itself does not which package supplies the actual library.

You can only look at ldd output. On my server, this points to Atlas

edd@max:~$ ldd /usr/lib/R/bin/exec/R     linux-vdso.so.1 =>  (0x00007fffc8ddb000)     libR.so => /usr/lib/libR.so (0x00007f8be940c000)     libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f8be91ef000)     libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f8be8e4d000)     libblas.so.3gf => /usr/lib/atlas-base/atlas/libblas.so.3gf (0x00007f8be88e4000)     libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8be8660000)     libreadline.so.6 => /lib/libreadline.so.6 (0x00007f8be841d000)     libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f8be81e1000)     liblzma.so.2 => /usr/lib/liblzma.so.2 (0x00007f8be7fbf000)     libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f8be7da6000)     librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f8be7b9e000)     libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f8be799a000)     libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f8be778b000)     /lib64/ld-linux-x86-64.so.2 (0x00007f8be99a5000)     libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f8be7475000)     libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8be725f000)     libtinfo.so.5 => /lib/libtinfo.so.5 (0x00007f8be7037000)     libquadmath.so.0 => /usr/lib/x86_64-linux-gnu/libquadmath.so.0 (0x00007f8be6e01000) edd@max:~$  

which makes sense as this BLAS-providing package gets the highest priority per the Debian packaging.

Edit, some nine years later: R, which always grows in capabilities, now reports this (even pretty-printed) in sessionInfo(). On my machine (R 4.1.1, Ubuntu 21.04) it says just that too:

> sessionInfo() R version 4.1.1 (2021-08-10) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 21.04  Matrix products: default BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so  [...] 

You can also access those two paths directly:

> si <- sessionInfo() > si$BLAS [1] "/usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3" > si$LAPACK [1] "/usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.13.so" >  
like image 194
Dirk Eddelbuettel Avatar answered Sep 21 '22 14:09

Dirk Eddelbuettel