[R-SIG-Mac] building R with external Lapack
Thibault Vatter
thibault.vatter at gmail.com
Fri Jul 14 16:06:21 CEST 2017
I wonder whether this is actually needed, see
https://gist.github.com/nicebread/6920c8287d7bffb03007
If you have found a solution in the meantime, I would be interested.
On Sunday, March 6, 2016 at 1:27:52 AM UTC-5, Baptiste Auguie wrote:
>
> Hi again,
>
> Following my previous message, I've made some progress after finding hints
> on the list archives that the flag CPPFLAGS="-D__ACCELERATE__" should help
> direct R to use the Accelerate framework. It does help in this regard, as
> ./configure now confirms,
>
> External libraries: readline, BLAS(Accelerate), LAPACK(in blas),
> zlib, bzlib, PCRE, curl
>
> Unfortunately, make fails because of a missing lzma.h, even though it
> exists and lives in /usr/local/include/lzma.h. I have xz installed via
> brew.
>
> Ideally I would like to be able to build R from source on my mac, but that
> has proved harder than I anticipated. Alternatively,
>
> - is there a way to redirect R's Lapack after installation, the same way as
> for BLAS?
> ( as in
> cd /Library/Frameworks/R.framework/Resources/lib
> ln -sf
>
> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib
> libRblas.dylib)
>
> - could I somehow silence RcppArmadillo's solve() warning? (this is more of
> a Rcpp-dev question, I'll ask there if it comes to that)
>
> Thanks,
>
> baptiste
>
>
> On 5 March 2016 at 18:24, Baptiste Auguie <baptist... at gmail.com
> <javascript:>> wrote:
>
> > Dear list,
> >
> > I have a package using RcppArmadillo for linear algebra; at some point in
> > the calculation it solves a linear system. I understand the c++ Armadillo
> > library hands this operation over to Lapack Unfortunately, somewhere in
> my
> > toolchain Armadillo has been configured to use R's internal subset
> > of Lapack, which triggers the following warning every time I call the R
> > function,
> >
> > warning: solve(): refinement and/or equilibration not done due to
> crippled
> > LAPACK
> >
> > This doesn't sound very good, and is also a real nuisance in the terminal
> > as I'm calling the function hundreds of times in a loop. I've installed
> the
> > latest build from https://r.research.att.com, built and installed the
> > latest version of RcppArmadillo, but the problem persists.
> >
> > I'm not sure if it's relevant to this question, but I've had some success
> > with the related issue of switching from R's internal BLAS to the vecLib
> > one,
> >
> > cd /Library/Frameworks/R.framework/Resources/lib
> > ln -sf
> >
> /System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/libBLAS.dylib
> > libRblas.dylib
> >
> > giving me a considerable boost in performance. I'm not sure if something
> > similar can be done for Lapack.
> >
> > The next step I've taken was to try and build R myself, with explicit
> > flags telling R to use an external Lapack from Apple's Accelerate
> (vecLib?)
> > framework. I have not had any luck with that, every time some kind of
> error
> > appears, and I could not find a recent tutorial with step-by-step
> > instructions to build R on a Mac.
> >
> > I've downloaded the R source, followed by
> >
> > ./configure SHELL='/bin/bash' r_arch=x86_64 CC="gcc -arch x86_64
> > -std=gnu99" CXX="g++ -arch x86_64" OBJC="gcc -arch x86_64" F77="gfortran
> > -arch x86_64" FC="gfortran -arch x86_64" --with-system-zlib
> > --with-blas='-framework vecLib' --with-lapack
> >
> > with this summary at the end:
> >
> > R is now configured for x86_64-apple-darwin15.3.0
> >
> > Source directory: .
> > Installation directory: /Library/Frameworks
> >
> > C compiler: gcc -arch x86_64 -std=gnu99
> > -I/usr/local/include
> > Fortran 77 compiler: gfortran -arch x86_64 -g -O2
> >
> > C++ compiler: g++ -arch x86_64 -g -O2
> > C++ 11 compiler: g++ -arch x86_64 -std=c++11 -g -O2
> > Fortran 90/95 compiler: gfortran -arch x86_64 -g -O2
> > Obj-C compiler: gcc -arch x86_64 -g -O2 -fobjc-exceptions
> >
> > Interfaces supported: X11, aqua, tcltk
> > External libraries: readline, zlib, bzlib, lzma, PCRE, curl
> > Additional capabilities: NLS, ICU
> > Options enabled: framework, shared BLAS, R profiling
> >
> > Capabilities skipped: PNG, JPEG, TIFF, cairo
> > Options not enabled: memory profiling
> >
> > Recommended packages: yes
> >
> > make
> >
> > gives me this error:
> >
> > byte-compiling package 'grDevices'
> > Warning in solve.default(rgb) :
> > unable to load shared object
> > '/Users/baptiste/Downloads/R-rc/modules/x86_64/lapack.so':
> > dlopen(/Users/baptiste/Downloads/R-rc/modules/x86_64/lapack.so, 6):
> > Symbol not found: __gfortran_compare_string
> >
> > I've tried quite a few variations, but I'm shooting in the dark since I
> > don't understand the issue. If I've missed a standard tutorial, please
> let
> > me know.
> >
> > Best regards,
> >
> > baptiste
> >
> > PS: my sessionInfo() using CRAN's R-devel
> > R Under development (unstable) (2016-03-02 r70268)
> > Platform: x86_64-apple-darwin13.4.0 (64-bit)
> > Running under: OS X 10.11.3 (El Capitan)
> > locale:
> > [1] en_NZ.UTF-8/en_NZ.UTF-8/en_NZ.UTF-8/C/en_NZ.UTF-8/en_NZ.UTF-8
> >
> > gfortran -v
> > gfortran: warning: couldn’t understand kern.osversion ‘15.3.0
> > Using built-in specs.
> > COLLECT_GCC=gfortran
> >
> >
> COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin13.0.0/4.8.2/lto-wrapper
> > Target: x86_64-apple-darwin13.0.0
> > Configured with: /Builds/gcc-4.8/gcc-4.8.2/configure CC=clang CXX=clang++
> > --enable-languages=fortran
> > Thread model: posix
> > gcc version 4.8.2 (GCC)
> >
> >
> >
> >
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SI... at r-project.org <javascript:>
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-mac/attachments/20170714/964d30ab/attachment.html>
More information about the R-SIG-Mac
mailing list