[R-SIG-Mac] BLAS/LAPACK/Accelerate on Leopard with R 2.6.2

Simon Urbanek simon.urbanek at r-project.org
Thu Mar 27 14:49:56 CET 2008


On Mar 27, 2008, at 6:02 AM, Prof Brian Ripley wrote:

> On Thu, 27 Mar 2008, Alexy Khrabrov wrote:
>
>> Greetings -- which BLAS/LAPACk are used by R 2.6.2 with gfortran 4.2
>> on Leopard?
>
> Whatever you compile it against!  It looks like you didn't consult the
> R-admin manual before posting, so please do study it now.
>
> I believe that the binary versions distributed from CRAN are compiled
> against vecLib:
>
> blacklark% otool -L libRblas.dylib
> libRblas.dylib:
>
> /Library/Frameworks/R.framework/Versions/2.6/Resources/lib/ 
> libRblas.dylib
> (compatibility version 0.0.0, current version 0.0.0)
>         /System/Library/Frameworks/vecLib.framework/Versions/A/vecLib
> (compatibility version 1.0.0, current version 192.15.0)
>         /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0,  
> current
> version 1.0.0)
>         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0,  
> current
> version 88.3.9)
>

Only for completeness, the CRAN binary currently ships with both  
vecLib-based Rblas (libRblas.veclib.dylib) and reference Rblas  
(libRblas.0.dylib) libraries. Which one is used can be influenced by  
setting libRblas.dylib symbolic link to one or the other (thanks to -- 
enable-BLAS-shlib option):

cd /Library/Frameworks/R.framework/Resources/lib

# for vecLib use
ln -sf libRblas.vecLib.dylib libRblas.dylib

# for R reference BLAS use
ln -sf libRblas.0.dylib libRblas.dylib

(I have added this info to the R for Mac FAQ).

Cheers,
Simon


> since the recommended configure sequence is
>
> ./configure --with-blas='-framework vecLib' --with-lapack \
>   --with-aqua --enable-R-framework
>
> (see the R-admin manual).
>
> Note that we prefer to have correct answers rather than fast ones,  
> and the
> reference BLAS given by the default options is often more accurate and
> more reliable (and so is the LAPACK distributed -- is is 3.1 so has
> bugfixes against 3.0, but not the several incorrect bugfixes that some
> Linux distributions have). So personally I only recommend using an
> optimized BLAS when you need the performance (and few R sessions use
> enough matrix algebra to do so).
>
> I've checked that --with-blas='-framework Accelerate' also works,  
> but I
> see no real performance difference (and small differences can be  
> hard to
> detect).  (I tested i386, but x86_64 seems also to work.)
>
>> Macresearch.org instructs to use Accelerate, effectively switching  
>> from
>
> Hmm, actually it tells you Accelerate uses vecLib for BLAS/LAPACK.
>
>
>> # LIBPATH =  -L$/usr/local/lib
>> # BLAS = -llapack -lf77blas -latlas
>
> That's always wrong: lapack should never be part of the BLAS.
>
>> to
>>
>> BLAS = -Wl,-framework -Wl,Accelerate
>>
>> -- per:
>>
>> http://macresearch.org/performance_tutorial_part_i_introducing_accelerate
>>
>> -- is this compatible with that packaged gfortran?
>
> Ultimately, we don't know.  Different compilers can have different
> argument-passing conventions on the same platform, so we would have to
> look at every call (in vecLib, which is not AFAIK Open Source) on each
> MacOS X architecture to *know*.
>
> This is not idle speculation: gcc3 and gcc4 ('Gnu Compiler  
> Collection')
> have used different calling conventions on x86_64 on Linux and  
> Solaris, so
> it is likely that not all Fortran compilers on x86_64 on MacOS are
> compatible.  (And AFAIR that is why there are vecLibg95c.c and
> vecLibg95f.f in the R sources, and why there are configure tests in  
> R for
> this.)
>
>
>> Also -- if I want to try out xlf from IBM, how does that affect the
>> choices of BLAS/LAPACK/Accelerate -- are they compatible or does xlf
>> come with its own?  (And why I can download trial versions of xlf for
>> AIX/Linux but not for Mac?...)
>
> Ask IBM.
>
> -- 
> Brian D. Ripley,                  ripley at stats.ox.ac.uk
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865 272861 (self)
> 1 South Parks Road,                     +44 1865 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>



More information about the R-SIG-Mac mailing list