# AppleAccelerate.jl v0.4.0

**URL:** <https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351>\
**Category:** Package Announcements\
**Created:** [May 24, 2023, 9:18pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351 "2023-05-24T21:18:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [May 24, 2023, 9:18pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/1 "2023-05-24T21:18:16Z")

</div>

Hello all,

For the longest time, we haven’t been able to leverage the BLAS and LAPACK in [Apple’s Accelerate](https://developer.apple.com/documentation/accelerate) largely because it was LP64 only and carried a really old version of LAPACK. This didn’t matter much on Intel macs, because one could use OpenBLAS which is quite good and also MKL.

Of course, with Apple Silicon (which is now [Tier-1](https://julialang.org/downloads/#supported_platforms)), everything changed. Accelerate can offer much higher performance than OpenBLAS (at least as of right now). Listening to us (@staticfloat mostly), Apple introduced ILP64 as well as a modern LAPACK in macOS 13.3. @staticfloat updated AppleAccelerate.jl so that it could become a [libblastrampoline](https://github.com/JuliaLinearAlgebra/libblastrampoline) backend. Upon doing that, we found an issue in pivoted Cholesky, which is fixed in macOS 13.4. Interestingly, using LBT’s overlay mechanism, we could actually [override](https://github.com/JuliaMath/AppleAccelerate.jl/pull/58) the buggy Accelerate version with one in LAPACK\_jll.

As a result, [AppleAccelerate.jl](https://github.com/JuliaMath/AppleAccelerate.jl) [0.4.0](https://github.com/JuliaMath/AppleAccelerate.jl/releases/tag/v0.4.0) was finally tagged and released. The performance difference is significant for certain matmuls on Apple Silicon:

```julia
julia> peakflops(4096) # OpenBLAS
3.6024175318268243e11

julia> using AppleAccelerate

julia> peakflops(4096)
5.832806459434183e11

```

It also works on Intel macs giving marginally better performance in some cases. Naturally all of this needs a lot more testing and experimenting, so please try it out.

-viral

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 24, 2023, 9:23pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/2 "2023-05-24T21:23:34Z")

</div>

Should this be the default BLAS backend on mac’s with Apple Silicon?

---

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [May 24, 2023, 9:26pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/3 "2023-05-24T21:26:34Z")

</div>

> [@e3c6](#):
>
> Should this be the default BLAS backend on mac’s with Apple Silicon?

Perhaps eventually. Right now it is only useful on Apple Silicon + macOS 13.4. Making it the default would need extensive testing on the package ecosystem. Certainly possible, but this is a first step.

---

<div class="post-metadata">

**Author:** ![ctkelley](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ctkelley/32/10684_2.png) [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Post date:** [May 25, 2023, 11:59am UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/4 "2023-05-25T11:59:36Z")

</div>

The performance is not uniformly better with Accelerate. The discussion of [42312](https://github.com/JuliaLang/julia/issues/42312) has some details. It seems too early to make it the default.

---

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [May 25, 2023, 12:27pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/5 "2023-05-25T12:27:11Z")

</div>

Of course there is also the issue of splitting our support resources, and there is some value to using the same codebase on all platforms.

---

<div class="post-metadata">

**Author:** ![e3c6](https://avatars.discourse-cdn.com/v4/letter/e/e79b87/32.png) [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Post date:** [May 27, 2023, 11:29am UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/6 "2023-05-27T11:29:57Z")

</div>

> [@viralbshah](#):
>
> ```julia
> julia> using AppleAccelerate
> 
> ```

If I understand currently this triggers `libblastrampoline` to use the Apple Accelerate backend. Can I go back to OpenBLAS without restarting Julia?

---

<div class="post-metadata">

**Author:** ![viralbshah](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/viralbshah/32/54_2.png) [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Post date:** [June 7, 2023, 3:52pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/7 "2023-06-07T15:52:11Z")

</div>

Yes the LBT API will let you do that, since this is essentially just updating a table of pointers. I suppose it would be nice to have an API to do that in LinearAlgebra.jl.

---

<div class="post-metadata">

**Author:** ![carstenbauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/carstenbauer/32/4981_2.png) [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Post date:** [June 7, 2023, 5:07pm UTC](https://discourse.julialang.org/t/appleaccelerate-jl-v0-4-0/99351/8 "2023-06-07T17:07:12Z")

</div>

> [@e3c6](#):
>
> Can I go back to OpenBLAS without restarting Julia?

> [@viralbshah](#):
>
> I suppose it would be nice to have an API to do that in LinearAlgebra.jl.

See also the related issue here: [Switch between MKL and OpenBLAS at runtime · Issue #90 · JuliaLinearAlgebra/MKL.jl · GitHub](https://github.com/JuliaLinearAlgebra/MKL.jl/issues/90)
