ANN: SugarBLAS.jl

SugarBLAS.jl lets you write BLAS functions in a more aesthetic form. This way anytime someone reads a BLAS call they don’t have to look up for the order of the positional arguments to understand what it does.

julia> macroexpand(:(@blas! Y += X))
:(Base.LinAlg.axpy!(1.0,X,Y))

julia> macroexpand(:(@blas! X = (a+c)*X))
:(scale!(a + c,X))

julia> macroexpand(:(SugarBLAS.@gemm! C -= alpha*A*B))
:(Base.LinAlg.BLAS.gemm!('N','N',-alpha,A,B,1.0,C))

The package only uses Base definitions so you can extend each function however you want.

14 Likes

Looks cool! “Raw” blas is horrible, so I will certainly try this out.

1 Like

This should be in Base!

I think it works just fine as a package. Simple and does the job well. I know it’s used internally in IterativeSolvers.jl. Nice work.