[R-SIG-Mac] BLAS/LAPACK/Accelerate on Leopard with R 2.6.2
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Mar 27 11:02:03 CET 2008
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)
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
More information about the R-SIG-Mac
mailing list