Warn when NumPy links Accelerate; document the OpenBLAS wheel - #574
Open
meandmytram wants to merge 3 commits into
Open
Warn when NumPy links Accelerate; document the OpenBLAS wheel#574meandmytram wants to merge 3 commits into
meandmytram wants to merge 3 commits into
Conversation
…enBLAS wheel On the macOS arm64 NumPy 2.x wheels, which link Apple's Accelerate framework, the decoders' rank-deficient, wide-spectrum matrices made numpy.linalg.qr die with SIGBUS and numpy.linalg.svd trip malloc's heap-corruption check inside dgesdd (five crash reports from the [[72,12,6]] investigation), and a chi_max=400 decode returned wrong verdicts while every unit test passed. The OpenBLAS build of the same NumPy version (the macosx_11_0_arm64 wheel) runs the same reproducers clean. The backend now warns once at import when Accelerate is found behind NumPy (MDOPT_ALLOW_ACCELERATE=1 silences it) and the README gives the two commands that install the OpenBLAS wheel. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S6mbxc9eJDQMVx7tjvYwud
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #574 +/- ##
==========================================
- Coverage 97.29% 97.20% -0.10%
==========================================
Files 26 26
Lines 5259 5336 +77
==========================================
+ Hits 5117 5187 +70
- Misses 142 149 +7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…AS wheels The SVD helpers call SciPy's LAPACK too, and the SciPy macOS arm64 wheels link Accelerate like NumPy's; with only NumPy switched to OpenBLAS the reduced SVD path still returned a wrong factorisation (reconstruction error 0.15) or crashed, and with both switched it passes repeatedly. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S6mbxc9eJDQMVx7tjvYwud
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
SciPy vendor detection uses an incompatible configuration API, preventing its warning from firing.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds runtime warnings and installation guidance to avoid unstable Apple Accelerate LAPACK builds.
Changes:
- Detects Accelerate-backed NumPy and SciPy installations.
- Supports warning suppression via
MDOPT_ALLOW_ACCELERATE. - Documents OpenBLAS wheel installation and thread settings.
File summaries
| File | Description |
|---|---|
mdopt/backend/array.py |
Adds LAPACK vendor detection and warnings. |
tests/backend/test_array.py |
Tests NumPy warning and suppression behavior. |
README.md |
Documents the issue and OpenBLAS alternatives. |
Review details
Suppressed comments (1)
README.md:42
- This likewise overgeneralizes all SciPy macOS wheels even though the next sentence identifies an OpenBLAS arm64 wheel. Name the Accelerate variant explicitly so users on the OpenBLAS wheel are not told their installation is affected.
The SciPy macOS wheels link Accelerate as well, and mdopt's SVD helpers
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…rate
SciPy 1.10 and later report their LAPACK through show_config(mode="dicts"),
but SciPy 1.9, which the dependency floor allows, has show() without a mode
argument, so the SciPy check silently reported an unknown vendor there. The
helper now falls back to __config__.get_info("lapack_opt") in that case, and
two SciPy-shaped test doubles cover both APIs.
The README said the macOS arm64 wheels link Accelerate; only the
macosx_14_0_arm64 wheels do (checked NumPy 2.4.6, SciPy 1.15.3 and 1.18.1),
which pip picks on macOS 14 and later, while the macosx_11_0_arm64 NumPy
and macosx_12_0_arm64 SciPy wheels bundle OpenBLAS.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6mbxc9eJDQMVx7tjvYwud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On the macOS arm64 wheels of NumPy 2.x, which link Apple's Accelerate framework, mdopt's matrices (rank-deficient, singular values spanning many orders of magnitude) made
numpy.linalg.qrdie with SIGBUS andnumpy.linalg.svdtrip malloc's heap-corruption check insidedgesdd(crash reports from the [[72,12,6]] investigation on PR #543), and achi_max=400bivariate-bicycle decode returned wrong verdicts while every unit test and benchmark fingerprint passed. Both the NumPy and the SciPy macOS wheels in that environment link Accelerate.The OpenBLAS build of the same NumPy version (the
macosx_11_0_arm64wheel) runs the same reproducers clean: the 200-call QR loop that died with SIGBUS every time exits normally with zero wrong factorisations, three runs out of three.Changes:
mdopt.backend.arraywarns once at import when Accelerate is found behind NumPy (MDOPT_ALLOW_ACCELERATE=1silences it); a test covers the three cases (Accelerate, another vendor, silenced).🤖 Generated with Claude Code
https://claude.ai/code/session_01S6mbxc9eJDQMVx7tjvYwud