LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-18-2019, 02:36 AM   #1
Geist
Member
 
Registered: Jul 2013
Distribution: Slackware 14 / current
Posts: 442

Rep: Reputation: 196Reputation: 196
Slackbuild for "R" (The language) README is unclear to me.


This part confuses me:


If you do not need to build the BLAS shared library (which is useful
for swapping default unaccelerated BLAS for an accelerated one),
execute the script as BLAS_SHLIB=no ./R.SlackBuild

https://slackbuilds.org/repository/14.2/academic/R/

Do I enable or disable this to use the openBLAS library I have on my system?
 
Old 07-18-2019, 04:59 AM   #2
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by Geist View Post
Do I enable or disable this to use the openBLAS library I have on my system?
When you just enable it (leave it at the default), R will build its own BLAS library, so - haven't done this myself yet - you probably have to specify the location OF the openBlas library you got, for R to build against it. With the pure source build, this is done in the ./configure stage, don't know about the SlackBuild as I never used that.
 
1 members found this post helpful.
Old 07-18-2019, 05:24 AM   #3
fskmh
Member
 
Registered: Jun 2002
Location: South Africa
Distribution: Custom slackware64-current
Posts: 307

Rep: Reputation: 92
Quote:
Originally Posted by Geist View Post
Do I enable or disable this to use the openBLAS library I have on my system?
If you build R with the SlackBuild variable R_SHLIB set to yes then R builds its own libRblas.so in /usr/lib64/R/lib and /usr/lib64/R/bin/exec/R links with this:
Code:
/usr/lib64/R/bin/exec> objdump -x R | grep NEED
  NEEDED               libR.so
  NEEDED               libRblas.so
  NEEDED               libgomp.so.1
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  VERNEED              0x0000000000400768
  VERNEEDNUM           0x0000000000000001
If you build with R_SHLIB set to no then it doesn't built any optimised BLAS library.

If, like me, you have OpenBLAS installed then you need to change the contents of blas_shlib in the Slackbuild from this
Code:
blas_shlib="--enable-BLAS-shlib"
to this
Code:
blas_shlib="--with-blas --with-lapack"
You can also add an "else" condition that checks for the openblas_config header file, which is what I do. If you build with the above modification you don't get /usr/lib64/R/bin/exec/R linked with an internal blas library:
Code:
/usr/lib64/R/bin/exec> objdump -x R | grep NEED
  NEEDED               libR.so
  NEEDED               libgomp.so.1
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  VERNEED              0x0000000000400760
  VERNEEDNUM           0x0000000000000001
However libR.so is now linked with your external OpenBLAS library:
Code:
/usr/lib64/R/lib> ldd libR.so 
        linux-vdso.so.1 (0x00007fff66be7000)
        libopenblas.so.0 => /usr/lib64/libopenblas.so.0 (0x00007f1a81772000)
        libgfortran.so.5 => /usr/lib64/libgfortran.so.5 (0x00007f1a812b6000)
..
..
..
Code:
ls -lA /usr/lib64/libopenblas.so*
lrwxrwxrwx 1 root root 22 Jul 18 11:42 /usr/lib64/libopenblas.so -> libopenblasp-r0.3.6.so
lrwxrwxrwx 1 root root 22 Jul 18 11:42 /usr/lib64/libopenblas.so.0 -> libopenblasp-r0.3.6.so
Addendum:
It seems that you can also just append "--with-blas --with-lapack" to blas_shlib="--enable-BLAS-shlib" and then R is built with a libRblas.so that is linked with libopenblas.
Code:
Package R-3.6.0_icu4c64.2-x86_64-1 upgraded with new package /tmp/R-3.6.0_icu4c64.2_openblas0.3.6-x86_64-1.txz.
/usr/lib64/R/bin/exec> objdump -x R | grep NEED       
  NEEDED               libR.so
  NEEDED               libRblas.so
  NEEDED               libgomp.so.1
  NEEDED               libpthread.so.0
  NEEDED               libc.so.6
  VERNEED              0x0000000000400768
  VERNEEDNUM           0x0000000000000001
/usr/lib64/R/bin/exec> ldd ../../lib/libRblas.so 
        linux-vdso.so.1 (0x00007ffe1f5fe000)
        libopenblas.so.0 => /usr/lib64/libopenblas.so.0 (0x00007f7c91924000)
I think some benchmarks would be required to determine the outcome of the build methods at this point. One thing I don't like about this result is that it links with the older libgfortran.so.4 (I made a compat package from gcc-7.3 because various math libraries as well as Octave link with libgfortran) for some reason instead of linking with libgfortran.so.5 which is what libgfortran.so points to.

Last edited by fskmh; 07-18-2019 at 05:51 AM.
 
2 members found this post helpful.
Old 07-18-2019, 08:15 PM   #4
Geist
Member
 
Registered: Jul 2013
Distribution: Slackware 14 / current
Posts: 442

Original Poster
Rep: Reputation: 196Reputation: 196
Everything came into being just as you laid it out, thank you muchly for this thorough banishment of confusion.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sbopkg installs "original" SlackBuild to /usr/doc/<pkg>/ instead of "local" SlackBuild drumz Slackware 29 01-20-2018 12:12 AM
LFTP - ls can see files but "get: Access failed: 404 filenotfound (.\ReadMe.txt)" occ MatthewSmith Linux - Laptop and Netbook 2 08-02-2012 02:32 PM
Sexing up linux with "unclear" spin re: "Old Computer, New Life" Regosux General 1 09-16-2011 06:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration