Skip to content

macOS: allow to use Accelerate framework instead of OpenBLAS #40397

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

dimpase
Copy link
Member

@dimpase dimpase commented Jul 10, 2025

a draft of such functionality.

To test it with Homebrew. Get on this branch; have all the needed Homebrew packages installed, follow the usual instructions
at https://doc.sagemath.org/html/en/installation/source.html#macos-package-installation
then before ./configure and make, run

 export PKG_CONFIG_PATH=`pwd`/build/platform/macos/pkgconfig:$PKG_CONFIG_PATH

to point pkg-config to a "fake" openblas.pc files.

Make sure you don't have openblas (and its downstream: linbox, etc)
already installed by Sage; (e.g. make distclean will surely suffice). Run ./configure
and check its output near the end, where it reports the list of packages to be installed or used from the system.
Openblas should be marked as not being installed.
Finally, run make etc.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@dimpase dimpase requested a review from roed314 July 10, 2025 17:35
@dimpase dimpase marked this pull request as draft July 10, 2025 17:36
@dimpase
Copy link
Member Author

dimpase commented Jul 10, 2025

currently it's not tested on CI, as one needs export PKG_CONFIG_PATH=pwd/build/platform/macos/pkgconfig:$PKG_CONFIG_PATH

@dimpase dimpase self-assigned this Jul 10, 2025
@dimpase dimpase requested a review from tobiasdiez July 11, 2025 16:37
@dimpase
Copy link
Member Author

dimpase commented Jul 11, 2025

@tobiasdiez - can you think of testing this on the CI? Also, perhaps this can be tried on top of the meson for sagelib build PR.

I can't find where in CI I should add export PKG_CONFIG_PATH=pwd/build/platform/macos/pkgconfig:$PKG_CONFIG_PATH
as neither ./bootstrap nor ./configure are explicitly called anywhere

@tobiasdiez
Copy link
Contributor

Since Accelerate is declared the top priority on macos, the current CI is already using it:

Run-time dependency accelerate found: YES (/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework)
https://github.com/sagemath/sage/actions/runs/16202001633/job/45743099258?pr=40397#step:12:45

Otherwise, we could use the same strategy as numpy (https://github.com/numpy/numpy/blob/82bd6ef31ce57859280be7591c3a20f562e69d34/.github/workflows/macos.yml#L107):

@dimpase
Copy link
Member Author

dimpase commented Jul 11, 2025

Since Accelerate is declared the top priority on macos, the current CI is already using it:

Run-time dependency accelerate found: YES (/Applications/Xcode_15.4.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Accelerate.framework)
https://github.com/sagemath/sage/actions/runs/16202001633/job/45743099258?pr=40397#step:12:45

Otherwise, we could use the same strategy as numpy (https://github.com/numpy/numpy/blob/82bd6ef31ce57859280be7591c3a20f562e69d34/.github/workflows/macos.yml#L107):

I'm surprised the CI works this way, as my experience is that linbox and fflas_ffpack need extra settings as in this branch to work with Accelerate. (This works with Conda-supplied libraries I suppose)

@tobiasdiez
Copy link
Contributor

At the moment, the conda env installs openblas as well (which should then be used by linbox etc). Might be worth a try to force Accelerate via libblas=*=*accelerate.

@dimpase
Copy link
Member Author

dimpase commented Jul 12, 2025

I suppose Conda has Accelerate-using Linbox and fflas_ffpack, the question is why you need openblas at all in macos Conda.

@tobiasdiez
Copy link
Contributor

I don't know how conda determines what flavor of blas to install. @isuruf probably is a better person to ask.

@dimpase
Copy link
Member Author

dimpase commented Jul 12, 2025

there is no blas to install in Accelerate case - it's in the OS. it's another bunch of downstream packages to install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy