[Rd] boneheaded BLAS questions

Tomas Kalibera tom@@@k@||ber@ @end|ng |rom gm@||@com
Thu Mar 18 09:34:39 CET 2021


On 3/18/21 9:15 AM, Tomas Kalibera wrote:
> On 3/18/21 3:53 AM, Ben Bolker wrote:
>> Thanks.  I know it's supposed to Just Work (and I definitely 
>> appreciate all the work that's gone into making it Just Work 99% of 
>> the time!).
>>
>>   I tried --with-lapack, no joy.
>>   Will try to decipher the rules file tomorrow ...
>
> This is documented in R Admin manual, section A.3, and there is also 
> "configure --help".
>
> On my Ubuntu 20.04, using "--with-blas --with-lapack" when a 
> BLAS/LAPACK implementation is installed via "apt" works for me:
>
> with libblas3, liblapack3 I get in R via sessionInfo()
>
> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
>
> then I install libopenblas0 and get, after re-starting R (not 
> rebuilding):
>
> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

and to install say MKL, this works for me:

apt-get install intel-mkl-full

and then:

env MKL_INTERFACE_LAYER=GNU,LP64 MKL_THREADING_LAYER=GNU R

gives me:

BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libmkl_rt.so

This is following documentation in A.3.1.3 of R Admin manual.

Best
Tomas


>
> Best
> Tomas
>
>
>>
>>   cheers
>>    Ben
>>
>>
>> On 3/17/21 10:25 PM, Dirk Eddelbuettel wrote:
>>>
>>> Ben,
>>>
>>> This stuff has worked unchanged since the 1990s when we had a 
>>> _really_ far
>>> sighted fellow in Debian come up with the 'switch the links' scheme 
>>> which was
>>> (and is) subsequently deployed by many numerical applications within 
>>> Debian,
>>> R and e.g. Octave included.
>>>
>>> And I used this ability to switch over a decade ago in a 
>>> never-quite-finished
>>> paper which resulted in a package as well as a vignette as paper 
>>> draft on
>>> CRAN: gcbd [1] It used the ability to switch between implementation 
>>> to time
>>> and compare and benchmark the various BLAS and LAPACK libraries -- 
>>> which was
>>> then motivated by a comparison with GPUs. (The actual code / package is
>>> stale-ish as some of the underlying packages have gone as eg the GPU 
>>> one --
>>> but the mechanics you are after still work the exact same way on 
>>> Debian and
>>> derivarives including Ubuntu and PopOS.)
>>>
>>> (As a complete aside, the state of the art here is now one level up in
>>> libraries based on flame/blis (a riff on blas) which can do a 
>>> similar logical
>>> switch _at runtime_ (rather than by flipping softlinks and 
>>> restarting the
>>> app). Julia and some other languages uses that, I think Fedora may 
>>> have it in
>>> its R build as well. Inaki may know more...)
>>>
>>> That said, from the top of my head, I think you error may just be 
>>> with the
>>> second R compilation -- I always (i.e. for the Debian package) use both
>>>    --with-blas --with-lapack
>>> and not just --with-blas. And I do there is public: if you know 
>>> where to look
>>> you can see the exact invocation of the Debian build of the R 
>>> package (which
>>> Ubuntu and Pop and ... then shadow) [2]
>>>
>>> Hth, Dirk
>>>
>>> [1] https://cran.r-project.org/package=gcbd
>>> [2] https://sources.debian.org/src/r-base/4.0.4-1/debian/rules/
>>>      (and I apologise for how messy this still is)
>>>
>>
>> ______________________________________________
>> R-devel using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



More information about the R-devel mailing list