Skip to content
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

Allow Accelerate linkage, deny veclibfort & lapack #6168

Merged

Conversation

zbeekman
Copy link
Contributor

@zbeekman zbeekman commented May 23, 2019

  • Accelerate provides more than just BLAS and LAPACK functionality, see
    https://developer.apple.com/documentation/accelerate

  • Veclibfort exists only to wrap Accelerate's BLAS/LAPACK

  • LAPACK is a slow, seldom updated reference implementation

  • Encourage usage of OpenBLAS

  • Reverts PR audit: check Accelerate linkage for core formulae #6130

  • Have you followed the guidelines in our Contributing document?

  • Have you checked to ensure there aren't other open Pull Requests for the same change?

  • Have you added an explanation of what your changes do and why you'd like us to include them?

  • Have you written new tests for your changes? Here's an example.

  • Have you successfully run brew style with your changes locally?

  • Have you successfully run brew tests with your changes locally?


 - Accelerate provides more than just BLAS and LAPACK functionality, see
   https://developer.apple.com/documentation/accelerate
 - Veclibfort exists only to wrap Accelerate's BLAS/LAPACK
 - LAPACK is a slow, seldom updated reference implementation
 - Encourage usage of OpenBLAS
 - Reverts PR Homebrew#6130
@zbeekman
Copy link
Contributor Author

LMK if we want/need a unit test.

CC: @jonchang

Also, I'm really tempted to add -DBLA_VENDOR=OpenBLAS to std_cmake_args. There are some cases where formulae may want to remove this though, like if they depend on scalapack or similar. If the formula never calls find_package(BLAS) or find_package(LAPACK) (or they provide their own versions of these intrinsic CMake find modules) then a developer warning will be triggered, but which should be silenced because, IIRC, we pass -Wno-dev.

@zbeekman
Copy link
Contributor Author

Could also set BLAS_ROOT and LAPACK_ROOT in the environment to point to OpenBLAS.

@jonchang
Copy link
Contributor

I didn’t know that Accelerate did all of that, so agree with the PR in principle. Though, are there separate dylibs for BLAS vs other functionality? On mobile so can’t check. If so we could narrow it to only warn links against Accelerate’s BLAS while permitting other uses.

My concern with setting the default BLAS vendor in std_cmake_args is that formula authors wont know to edit that if they want to use a different BLAS implementation. Perhaps an audit if eg someone depends on veclibfort on a cmake build?

@zbeekman
Copy link
Contributor Author

This PR triggers audit failures whenever depends_on “veclibfort” || depends_on “lapack” for all formula.

I agree with your concerns about -DBLA_VENDOR=..., probably a bad idea, but it would be nice to try to force uniformity. ¯\_(ツ)_/¯

I can see if it’s possible to detect if packages are using Accelerate specifically for BLAS/LAPACK

@zbeekman
Copy link
Contributor Author

Does anyone know how to find out which dylibs within a framework are linked against?

@jonchang @MikeMcQuaid I can see within the Accelerate Framework there are BLAS and LAPACK specific dylibs, but I'm not sure how to figure out what a dylib (e.g. from veclibfort) links to within a Framework. Any ideas?

@jonchang
Copy link
Contributor

Does brew linkage provide this information? I recall seeing specific libBLAS links but can’t confirm right now.

@zbeekman
Copy link
Contributor Author

zbeekman commented May 24, 2019

No, if something links w/ accelerate it just shows the framework.

EDIT

$ brew linkage --verbose veclibfort
System libraries:
  /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
  /usr/lib/libSystem.B.dylib

Copy link
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, thanks. A much simpler approach seems better and we can always dig into individual errors where need be.

@MikeMcQuaid
Copy link
Member

I don’t think we should change the general CMake behaviour. Otherwise 👍🏻

@MikeMcQuaid
Copy link
Member

Thanks both!

@MikeMcQuaid MikeMcQuaid merged commit 6806887 into Homebrew:master May 24, 2019
@lock lock bot added the outdated PR was locked due to age label Jan 1, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants