[R-sig-Debian] custom built R will not change BLAS/LAPACK with update-alternatives

Ramon Diaz-Uriarte rd|@z02 @end|ng |rom gm@||@com
Sat Dec 30 18:37:06 CET 2023


Dear All,

I am building R from source[1], following what is done in "rules" for building Debian's R. But the R I generate, in contrast to the standard Debian's R, will not change the BLAS and LAPACK libraries it uses when I change them via "update-alternatives". I have no idea what I am doing wrong (but, somehow, I've been quite capable of making the same mistake(s) in three different machines).

I can "solve" the issue by running configure with
--with-blas="-lblas"
--with-lapack="-llapack"

but I do not understand why I need to do this, when Dirk's configure in rules is using just
--with-blas
--with-lapack

(and this is also what I understand I should be doing from section A.3.1 of "R Installation and Administration" ---https://cran.r-project.org/doc/manuals/r-release/R-admin.html#BLAS).

This concerns me in so far as it suggests that I am missing something rather obvious.

Thanks,

R.


Details of the steps I am following.

1. update-alternatives: use Atlas (lower priority than OpenBLAS)

   update-alternatives --config libblas.so.3-x86_64-linux-gnu 
  There are 3 choices for the alternative libblas.so.3-x86_64-linux-gnu (providing /usr/lib/x86_64-linux-gnu/li

  Selection    Path                                                    Priority   Status
------------------------------------------------------------
  0            /usr/lib/x86_64-linux-gnu/openblas-openmp/libblas.so.3   95        auto mode
 * 1            /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3             35        manual mode
  2            /usr/lib/x86_64-linux-gnu/blas/libblas.so.3              10        manual mode
  3            /usr/lib/x86_64-linux-gnu/openblas-openmp/libblas.so.3   95        manual mode

update-alternatives --config liblapack.so.3-x86_64-linux-gnu 
There are 3 choices for the alternative liblapack.so.3-x86_64-linux-gnu (providing /usr/lib/x86_64-linux-gnu/
3).

  Selection    Path                                                      Priority   Status
------------------------------------------------------------
  0            /usr/lib/x86_64-linux-gnu/openblas-openmp/liblapack.so.3   95        auto mode
 * 1            /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3             35        manual mode
  2            /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3            10        manual mode
  3            /usr/lib/x86_64-linux-gnu/openblas-openmp/liblapack.so.3   95        manual mode



2. Just in case, run /sbin/ldconfig

3. No LD_LIBRARY_PATH in env.


4. Configure: ./configure --with-blas --with-lapack --enable-R-shlib --without-recommended-packages

5. Interestingly, this picks up OpenBLAS:

 configure: searching for an external BLAS
configure: searching for BLAS in default libraries
checking for dgemm_... no
configure: searching for OpenBLAS

and

R is now configured for x86_64-pc-linux-gnu
(...)
External libraries:          pcre2, readline, BLAS(OpenBLAS), LAPACK(in blas), curl
Options enabled:             shared R library, R profiling
(...)
Options not enabled:         shared BLAS, memory profiling


6. After make is finished, ldd:
libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f01b1ac2000)
libatlas.so.3 => /usr/lib/x86_64-linux-gnu/libatlas.so.3 (0x00007f01b0f57000)

And no openblas in any line.

7. sessionInfo shows it is using OpenBLAS

  Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/openblas-openmp/libopenblasp-r0.3.25.so;  LAPACK version 3.11.0

8. R CMD config shows difference in the configuration
- My build:
     ./R CMD config BLAS_LIBS: -lopenblas
   - ./R CMD config LAPACK_LIBS: nothing
- Debian's R
   - /usr/bin/R CMD config BLAS_LIBS: -lblas
   - /usr/bin/R CMD config LAPACK_LIBS: -llapack



[1] Why am I building from source? To match the exact version in BioConductor devel and for a cluster where I am playing with some compiler options



-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-31
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: rdiaz02 using gmail.com
       r.diaz using uam.es
       ramon.diaz using iib.uam.es

https://ligarto.org/rdiaz




More information about the R-SIG-Debian mailing list