[Rd] boneheaded BLAS questions

Ben Bolker bbo|ker @end|ng |rom gm@||@com
Thu Mar 18 02:18:03 CET 2021

   I've been going around in circles trying to get BLAS-switching 
working on a current r-devel, I'm sure I'm doing something dumb.  Any 
ideas about what I might be doing wrong, or suggestions for further 
diagnosis, would be welcome!

   tl;dr  I am compiling R-devel with (to the best of my knowledge) 
options set to allow BLAS-switching, but getting "undefined symbol" errors.


   Latest R-devel (via SVN), PopOS!/Ubuntu 20.10

   I have read Dirk E's post: https://github.com/eddelbuettel/mkl4deb
   I have attempted to read the relevant section of R Installation & 
Administration several times: 

   I have installed MKL and OpenBLAS on my system via 'apt install' 
(libopenblas-dev, libopenblas-base, and TWO versions of intel-mkl-64bit)

   When I build R without BLAS everything is OK;

	rm -Rf r-build; mkdir r-build; cd r-build; ../r-devel/configure 
--without-blas --enable-R-shlib --enable-BLAS-shlib; make -j 6

Matrix products: default
BLAS:   /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so

    When I look at my BLAS alternatives I don't see anything obviously 

sudo 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/libblas.so.3).

   Selection    Path 
Priority   Status
* 0            /opt/intel/mkl/lib/intel64/libmkl_rt.so 
150       auto mode
   1            /opt/intel/mkl/lib/intel64/libmkl_rt.so 
  150       manual mode
   2            /usr/lib/x86_64-linux-gnu/blas/libblas.so.3 
  10        manual mode
   3            /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
  100       manual mode

   When I rebuild R with --with-blas:

	rm -Rf r-build; mkdir r-build; cd r-build; ../r-devel/configure 
--with-blas --enable-R-shlib --enable-BLAS-shlib; make -j 6

  I end up with this:

gcc -I../../../r-devel/src/extra -I/usr/include/tirpc -I. 
-I../../src/include -I../../../r-devel/src/include  -I/usr/local/include 
-I../../../r-devel/src/nmath -DHAVE_CONFIG_H   -fopenmp -fpic  -g -O2 
-c ../../../r-devel/src/main/Rmain.c -o Rmain.o
gcc -Wl,--export-dynamic -fopenmp  -L"../../lib" -L/usr/local/lib -o 
R.bin Rmain.o  -lR -lRblas

/usr/bin/ld: ../../lib/libR.so: undefined reference to `zgemm_'
/usr/bin/ld: ../../lib/libR.so: undefined reference to `daxpy_'
/usr/bin/ld: ../../lib/libR.so: undefined reference to `dgemv_'
/usr/bin/ld: ../../lib/libR.so: undefined reference to `dscal_'


intel-mkl-64bit-2018.2-046/all,now 2018.2-046 amd64 [installed]
intel-mkl-64bit-2020.4-912/all,now 2020.4-912 amd64 [installed]

<... lots more intel-mkl stuff>

libblas-dev/groovy,now 3.9.0-3ubuntu1 amd64 [installed,automatic]
libblas3/groovy,now 3.9.0-3ubuntu1 amd64 [installed,automatic]
libgraphblas3/groovy,now 1:5.8.1+dfsg-2 amd64 [installed,automatic]
libgslcblas0/groovy,now 2.6+dfsg-2 amd64 [installed,automatic]
libopenblas-base/groovy,now 0.3.10+ds-3ubuntu1 amd64 [installed]
libopenblas-dev/groovy,now 0.3.10+ds-3ubuntu1 amd64 [installed]
libopenblas-pthread-dev/groovy,now 0.3.10+ds-3ubuntu1 amd64 
libopenblas0-pthread/groovy,now 0.3.10+ds-3ubuntu1 amd64 
libopenblas0/groovy,now 0.3.10+ds-3ubuntu1 amd64 [installed]

More information about the R-devel mailing list