[R-SIG-Mac] Compiling BLAS with Accelerate

Simon Urbanek @|mon@urb@nek @end|ng |rom R-project@org
Sat Nov 30 23:23:02 CET 2024


Tomek,

Fortran symbols are not included C headers (even though they are part of the library) so probably the easiest is to add -Wno-error=implicit-function-declaration.

However, if you just want to test Accelerate BLAS, use libRblas.vecLib.dylib, because that is a simple re-export of the Accelerate framework - it doesn't include any actual code:

$ otool -l /Library/Frameworks/R.framework/Resources/lib/libRblas.vecLib.dylib | grep -A2 REEXPORT
          cmd LC_REEXPORT_DYLIB
      cmdsize 96
         name /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate (offset 24)

The blas00.c is just a dummy file to test the symbols R is using (without their prototypes), but on macOS that doesn't even matter as we don't bind them at compile time anyway so all symbols are re-exported instead.

Cheers,
Simon



> On Dec 1, 2024, at 10:29 AM, Tomek Gieorgijewski <cybergeorge2020 using gmail.com> wrote:
> 
> Thank you Simon!
> configure with this option seems to work fine and produce:
> "External libraries:          pcre2, readline, BLAS(Accelerate), curl
>  Additional capabilities:     PNG, JPEG, TIFF, NLS, cairo, ICU
>  Options enabled:             framework, shared BLAS, R profiling"
> 
> However after starting compilation I get a lot of errors mainly in the gist:
> sources/src/extra/blas/blas00.c:6:5: error: implicit declaration of function 'dasum_' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
>     F77_CALL(dasum)();
>     ^
> /[...]/sources/src/include/R_ext/RS.h:104:22: note: expanded from macro 'F77_CALL'
> # define F77_CALL(x)    x ## _
> <scratch space>:69:1: note: expanded from here
> dasum_
> ^
> my arch is x86-64.
> I tried to find something on the Internet or R admin but with no luck.
> I guess some includes or other configuration is missing but I have no experience with such huge build system.
> 
> I am generally aiming at testing different BLASes or own implementations of matrix operations (matmul mainly),
> perf and correctness wise.
> 
> T.
> 
> sob., 30 lis 2024 o 09:14 Simon Urbanek <simon.urbanek using r-project.org> napisał(a):
> Tomek,
> 
> see R-admin C.3.5.1: https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Accelerate
> so essentially just add the following to the regular flags:
> --enable-BLAS-shlib --with-blas='-framework Accelerate'
> 
> Cheers,
> Simon
> 
> 
> 
> 
> > On Nov 30, 2024, at 2:10 AM, Tomek Gieorgijewski <cybergeorge2020 using gmail.com> wrote:
> > 
> > Hi!
> > 
> > I can compile R on macOS with standard BLAS but how can I compile R myself to get this vecLib BLAS which is added in binary distribution for Mac on CRAN?
> > 
> > regards,
> > Tomek.
> > 
> >       [[alternative HTML version deleted]]
> > 
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> > 
> 



More information about the R-SIG-Mac mailing list