GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — BLD: use github to build macos-arm64 wheels with OpenBLAS and update to 0.3.30 by mattip · Pull Request #29069 · numpy/numpy

Conversation

@mattip

@mattip mattip commented May 27, 2025

Copy link
Copy Markdown
Member

Move the macos-arm64 wheel builds with OpenBLAS (targeting MACOSX_DEPLOYMENT_TARGET=11) on github runners instead of cirrus. If this works, maybe it will impact the build failure in #29039. It should simplify CI, and will be less expensive, but does make us more dependent on github.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

rgommers reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@github-actions github-actions Bot added the 36 - Build Build related PR label May 27, 2025
andyfaff
andyfaff reviewed May 27, 2025
View reviewed changes
Comment thread .github/workflows/wheels.yml Resolved

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented May 27, 2025

Copy link
Copy Markdown
Member Author

A single parameterized test is failing for the csingle and cdouble cases:

     @pytest.mark.parametrize('dtype', [single, double, csingle, cdouble])
      def test_types(self, dtype):
          x = np.array([[1, 0.5], [0.5, 1]], dtype=dtype)
  >       assert_equal(np.linalg.det(x).dtype, dtype)
...
RuntimeWarning: divide by zero encountered in det
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip mattip mentioned this pull request May 27, 2025
BLD: bump OpenBLAS version, use OpenBLAS for win-arm64 #29039
Merged
@mattip

mattip commented May 29, 2025

Copy link
Copy Markdown
Member Author

Changing to draft to indicate that this is stuck until we can figure out what is going wrong

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
mattip marked this pull request as draft May 29, 2025 12:34
@mattip

mattip commented Jun 5, 2025

Copy link
Copy Markdown
Member Author

In case the logs go away before this gets revisited: the (failing) meson build here reports

clang 15.0.0 "Apple clang version 15.0.0 (clang-1500.3.9.4)"

while the (successful) cirrus CI one reports clang 16.0.0 "Apple clang version 16.0.0 (clang-1600.0.26.4)"

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip mattip mentioned this pull request Jun 27, 2025
BLD: use newly released OpenBLAS 0.3.30, use ILP64 on win_arm64 #29280
Closed
@mattip
mattip force-pushed the github-macos-arm64-wheels branch from fb3bf2e to 17d0308 Compare June 29, 2025 16:47
@mattip

mattip commented Jun 29, 2025

Copy link
Copy Markdown
Member Author

I hacked the call to zgetrf to reset the FPE registers on macos-arm64, since I couldn't actually fix the problem. In my defense most people with macos-arm64 machines will be using the Accelerate LAPACK wheel and not the OpenBLAS one, since they will have macos-14+ (released Sep 2023).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 29, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

I wonder why scipy does not see this

Edit: scipy, if I am not mistaken, does not check FPE registers?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 29, 2025

Copy link
Copy Markdown
Member Author

The goal of this PR is to build macos-arm64 wheels on github, and with the hacky fix it is passing. The pypy failure is unrelated.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@martin-frbg

martin-frbg commented Jun 29, 2025

Copy link
Copy Markdown

If you can tell me what to look out for, I may find time eventually, but please don't expect me to wade through numpy logs. I take it you are seeing fpe exception registers getting set without an exception actually being raised, i.e. something like an underflow or a quiet NaN that depends on xcode/AppleClang version (so might be an Apple compiler bug) ?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@charris

charris commented Jun 29, 2025

Copy link
Copy Markdown
Member

depends on xcode/AppleClang

IIRC, it is using SME that has that problem, apparently it is part of the spec. See #29223.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jun 30, 2025

Copy link
Copy Markdown
Member Author

@martin-frbg sorry for the noise, I will try to whittle it down to a minimal reproducer in C. The general idea is that this sets FPE error registers in the call to zgetrf when I use a NumPy built locally or with github CI on macOS-arm64, but does not when build on cirrusCI.

x = np.array([[1, 0.5], [0.5, 1]], dtype=np.complex128)
d = np.linalg.det(x)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 2, 2025

Copy link
Copy Markdown
Member Author

I don't know if I should open an issue on OpenBLAS, I am not sure they commit to correct handling of FPE registers. Here is the minimum reproducer I could create, starting in the OpenBLAS repo HEAD on macos-arm64

  • Compile OpenBLAS with

    CFLAGS=' -arch arm64 -fvisibility=protected -Wno-uninitialized' \
    make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 USE_OPENMP=0 NUM_THREADS=64 BINARY=64 INTERFACE64=1 TARGET=VORTEX
    
  • Compile this test.c with clang test.c -L. -lopenblas -lm

    test.c
    #include <stdio.h>
    #include <fenv.h>
    #include <stdint.h>
    
    typedef struct { double r, i; } f2c_doublecomplex;
    typedef int64_t fortran_int;
    
    fortran_int
    zgetrf_(fortran_int *m, fortran_int *n,
                f2c_doublecomplex a[], fortran_int *lda,
                fortran_int ipiv[],
                fortran_int *info);
    
    int main(int argv, const char *argc[]) {
    
      f2c_doublecomplex a[] = {{1, 0}, {0.5, 0}, {0.5, 0}, {1, 0}};
      fortran_int m = 2, n=2, lda=2, info=1, ipiv[] = {0, 0};
      fortran_int ret = zgetrf_(&m, &n, a, &lda, ipiv, &info);
      int fpstatus = fetestexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID);
      printf("zgetrf returned %lld, fpstatus=%d, info=%lld", ret, fpstatus, info);
      return 0;
    }
    
  • Run the test with OPENBLAS_VERBOSE=2 ./a.out. On my macbook m2 it prints

    Core: neoversen1
    zgetrf returned 0, fpstatus=3, info=0
    

    where on x86_64 it prints fpstatus=0. I did try OPENBLAS_CORETYPE=ARMV8 but still got fpstatus=3.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 2, 2025

Copy link
Copy Markdown
Member Author

@seiko2plus pointed out we need to add -ftrapping-math when using clang. Indeed, the reproducer above does not emit FP errors when using that flag 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

mattip added 2 commits July 3, 2025 07:27
@mattip
BLD: use github to build macos-arm64 wheels with OpenBLAS [wheel build]
955dc01
@mattip
update to OpenBLAS 0.3.30
88e865d
@mattip
mattip force-pushed the github-macos-arm64-wheels branch from 17d0308 to 88e865d Compare July 3, 2025 04:30
@mattip mattip changed the title BLD: use github to build macos-arm64 wheels with OpenBLAS BLD: use github to build macos-arm64 wheels with OpenBLAS and update to 0.3.30 Jul 3, 2025
@mattip

mattip commented Jul 3, 2025

Copy link
Copy Markdown
Member Author

rebased and updated to use OpenBLAS 0.3.30 compiled with -ftrapping-math

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip
trigger wheels [wheel build]
0e931be
@mattip
mattip marked this pull request as ready for review July 3, 2025 05:29
@mattip

mattip commented Jul 3, 2025

Copy link
Copy Markdown
Member Author

wheel building on macos is passing, now that OpenBLAS is built with -ftrapping-math. Apparently this is known behaviour, see #19479, #24060.

The PyPy failures are fixed on PyPy-HEAD, the wheel building uses the last release.

seberg reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seberg

seberg commented Jul 3, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Would be nice if this ended up fixing the mac-os matmul warning heisenbug :).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@mattip

mattip commented Jul 13, 2025

Copy link
Copy Markdown
Member Author

Ping

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

seberg
seberg approved these changes Jul 14, 2025
View reviewed changes

@seberg seberg left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Looks right to me thanks. Test failure is just the occasional PyPy issue.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers rgommers added this to the 2.4.0 release milestone Jul 14, 2025
rgommers
rgommers approved these changes Jul 14, 2025
View reviewed changes

@rgommers rgommers left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM too. CI logs are completely clean, everything looks in order. Thanks @mattip & reviewers!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rgommers
rgommers merged commit 81be692 into numpy:main Jul 14, 2025
@charris charris added the 09 - Backport-Candidate PRs tagged should be backported label Jul 23, 2025
@charris

charris commented Jul 23, 2025

Copy link
Copy Markdown
Member

I've marked this for backport, we may want it for the 3.14 build. Updating OpenBLAS is open for discussion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rgommers

rgommers commented Jul 23, 2025

Copy link
Copy Markdown
Member

I've marked this for backport, we may want it for the 3.14 build. Updating OpenBLAS is open for discussion.

I don't think we can do one without the other, because this PR was blocked on failure that was fixed by rebuilding a new version of OpenBLAS with -ftrapping-math.

I think it'd be fine to backport this PR in whole to 2.3.x. Or not and stay with Cirrus CI for 2.3.x, either way should work so I think you should make the call on that @charris.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@charris charris mentioned this pull request Jul 23, 2025
BLD: use github to build macos-arm64 wheels with OpenBLAS and update to 0.3.30 #29430
Merged
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jul 23, 2025
This was referenced Sep 16, 2026
failing tests on Arm for SciPy-bundle v2025.07 w/ lfbf/2025b toolchain easybuilders/easybuild-easyconfigs#24764
Closed
set -ftrapping-math for OpenBLAS 0.3.30 + 0.3.32 with LLVM to fix test failures with NumPy on aarch64 easybuilders/easybuild-easyconfigs#26890
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@andyfaff andyfaff andyfaff left review comments
@seberg seberg seberg approved these changes
@rgommers rgommers rgommers approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

36 - Build Build related PR

Projects

None yet

Milestone

2.4.0 release

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@mattip @martin-frbg @charris @seberg @rgommers @andyfaff
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.