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

Use new Accelerate from OSX>=13.3 #105

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

isuruf
Copy link
Member

@isuruf isuruf commented Oct 17, 2023

Checklist

  • Used a personal fork of the feedstock to propose changes
  • Bumped the build number (if the version is unchanged)
  • Reset the build number to 0 (if the version changed)
  • Re-rendered with the latest conda-smithy (Use the phrase @conda-forge-admin, please rerender in a comment in this PR for automated rerendering)
  • Ensured the license file is being packaged.

Closes #103

@conda-forge-webservices
Copy link

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe) and found it was in an excellent condition.

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

This is amazing!

I only get the broad strokes, but AFAICT:

  • Apple's implementation has a $NEWLAPACK suffix for all the BLAS/LAPACK symbols
  • We create a mapping from the normal expected names to the Apple ones and register them in an alias layer, together with re-exporting the libraries that actually contain those symbols.
  • For the legacy accelerate we could take BLAS but needed to replace LAPACK wholesale (hence both liblapack & liblapacke)
  • Apparently we still need to re-export liblapacke even in the new setup
  • There are some missing/incompatible symbols and you're providing a wrapper layer
  • All that (wrapper layer, aliases, re-exported symbols) is bundled into one new shared library

Probably still missing a bunch of details, perhaps we could add some comments in build.sh and document the intent a bit?

recipe/meta.yaml Outdated Show resolved Hide resolved
@isuruf isuruf marked this pull request as ready for review October 27, 2023 13:33
@isuruf
Copy link
Member Author

isuruf commented Oct 27, 2023

Okay, this is ready. I'll build these locally and upload when this PR is merged.

Copy link
Member

@h-vetinari h-vetinari left a comment

Choose a reason for hiding this comment

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

Okay, this is ready. I'll build these locally and upload when this PR is merged.

Not sure if you were waiting for review or anything, but basically this LGTM. I mostly have some nits and suggestions for clarification.

recipe/build.sh Outdated Show resolved Hide resolved
recipe/build.sh Outdated Show resolved Hide resolved
recipe/build.sh Outdated Show resolved Hide resolved
recipe/build.sh Show resolved Hide resolved
recipe/meta.yaml Outdated Show resolved Hide resolved
@h-vetinari
Copy link
Member

The reported errors are:
- Encountered problems while solving:
-   - nothing provides __osx >=13.3 needed by libblas-3.9.0-20_osx64_newaccelerate

You said above you'll build these locally, so I'm assuming there's a reason why we cannot just set MACOSX_SDK_VERSION to 13.3 for the new_accelerate builds? AFAICT that should be possible since conda-forge/conda-forge-ci-setup-feedstock#281.

@isuruf
Copy link
Member Author

isuruf commented Dec 19, 2023

We only allow users to install newaccelerate builds for 13.3 and therefore we use the __osx>=13.3 virtual package. Since the runners are not on 13.3, the package is not installable there.

@@ -3,6 +3,7 @@ blas_impl:
- mkl # [x86 or x86_64]
- blis # [x86 or x86_64]
- accelerate # [osx]
- newaccelerate # [osx]
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to version this somehow (maybe OS or library version if specified)?

Just thinking about whether we might wind up with newnewaccelerate in a future update 😉

Copy link
Member Author

Choose a reason for hiding this comment

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

Apple calls it NEWLAPACK, so if they call a newer one NEWNEWLAPACK then we can call it newnewaccelerate. :D

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough :)

@h-vetinari
Copy link
Member

h-vetinari commented Dec 19, 2023

Since the runners are not on 13.3, the package is not installable there.

I was surprised that the runners don't offer 13.x yet, and actually they've been added a while ago -- though for some reason they recently got marked as in preview months later 🤷. The readme link from the azure pipeline docs goes to here - I guess the separation between Azure Pipelines and GHA is pretty thin, since it's all MSFT in the end.

In any case, we could probably build & test this in CI if we upgrade the runners.

@h-vetinari h-vetinari mentioned this pull request Dec 19, 2023
@h-vetinari
Copy link
Member

In any case, we could probably build & test this in CI if we upgrade the runners.

I tested this in #112. The good news is that the image can be used and the resolution for __osx>=13.3 passes, the bad news is that there are segfaults in the wrappers still:

103/107 Test #103: BLAS-xblat3z .....................***Failed    0.04 sec
Running: /Users/runner/miniforge3/conda-bld/blas-split_1702968007651/work/build/bin/xblat3z
ARGS= INPUT_FILE;/Users/runner/miniforge3/conda-bld/blas-split_1702968007651/work/BLAS/TESTING/zblat3.in
M cannot be less than zero 0, but has value -1. BLAS error: Parameter number 4 passed to cblas_zgemm had an invalid value
** On entry to ZGEMM , parameter number  1 had an illegal value
** On entry to ZGEMM , parameter number  1 had an illegal value
** On entry to ZGEMM , parameter number  1 had an illegal value
** On entry to ZGEMM , parameter number  2 had an illegal value
** On entry to ZGEMM , parameter number  2 had an illegal value
** On entry to ZGEMM , parameter number  2 had an illegal value
CMake Error at /Users/runner/miniforge3/conda-bld/blas-split_1702968007651/work/TESTING/runtest.cmake:36 (message):
  Test
  /Users/runner/miniforge3/conda-bld/blas-split_1702968007651/work/build/bin/xblat3z
  returned 255

@h-vetinari
Copy link
Member

Unfortunately, we're (still) getting

Test ERROR:
dyld[15784]: missing symbol called

everywhere....

@h-vetinari
Copy link
Member

FWIW, there's a PR in scipy that does something very similar, and which is nearing completion. Perhaps that can provide some inspiration or at least clues.

@isuruf isuruf closed this Mar 25, 2024
@isuruf isuruf reopened this Mar 25, 2024
@isuruf
Copy link
Member Author

isuruf commented Mar 25, 2024

Clues as to why the two tests fail?

@h-vetinari
Copy link
Member

Perhaps? @thalassemia dug in pretty deeply into the topic, and fixed a couple of long-standing issues around this in scipy.

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.

Provide MacOS 13.3+ LAPACK implementation for libblas=*=*accelerate
4 participants