Open
Description
It is now possible to install numpy, scipy... with a BLAS implementation that links to the macOS Accelerate library via conda-forge:
But at the moment, threadpoolctl does not recognize this BLAS implementation. I tested the following on a macOS/M1 machines:
mamba create -n accelerate numpy "libblas=*=*accelerate" threadpoolctl
mamba activate accelerate
python -m threadpoolctl -i numpy
[]
Output of mamba list
:
# packages in environment at /Users/ogrisel/mambaforge/envs/accelerate:
#
# Name Version Build Channel
bzip2 1.0.8 h3422bc3_4 conda-forge
ca-certificates 2022.12.7 h4653dfc_0 conda-forge
libblas 3.9.0 16_osxarm64_accelerate conda-forge
libcblas 3.9.0 16_osxarm64_accelerate conda-forge
libcxx 15.0.7 h75e25f2_0 conda-forge
libffi 3.4.2 h3422bc3_5 conda-forge
libgfortran 5.0.0 12_2_0_hd922786_31 conda-forge
libgfortran5 12.2.0 h0eea778_31 conda-forge
liblapack 3.9.0 16_osxarm64_accelerate conda-forge
libsqlite 3.40.0 h76d750c_0 conda-forge
libzlib 1.2.13 h03a7124_4 conda-forge
llvm-openmp 16.0.0 h7cfbb63_0 conda-forge
ncurses 6.3 h07bb92c_1 conda-forge
numpy 1.24.2 py311h60f8152_0 conda-forge
openssl 3.1.0 h03a7124_0 conda-forge
pip 23.0.1 pyhd8ed1ab_0 conda-forge
python 3.11.0 h3ba56d0_1_cpython conda-forge
python_abi 3.11 3_cp311 conda-forge
readline 8.2 h92ec313_1 conda-forge
setuptools 67.6.0 pyhd8ed1ab_0 conda-forge
threadpoolctl 3.1.0 pyh8a188c0_0 conda-forge
tk 8.6.12 he1e0b03_0 conda-forge
tzdata 2023b h71feb2d_0 conda-forge
wheel 0.40.0 pyhd8ed1ab_0 conda-forge
xz 5.2.6 h57fd34a_0 conda-forge
Even if we cannot detect the number of threads it would be helpful to detect that numpy and/or scipy rely on Accelerate.
For CI purposes, we could probably leverage Cirrus CI to gain access to macOS/arm64 machines. Alternatively we could try with the standard macOS/x86_64 CI on Azure.
EDIT: GitHub Actions now also has macOS M1 runners by default.
Metadata
Metadata
Assignees
Labels
No labels
Activity
ogrisel commentedon Mar 27, 2023
For information:
so we would need to both inspect the
libBLAS.dylib
filename and one of its ancestor folders such asvecLib.framework
orAccelerate.framework
to detect this.[-]Detect the Apple Accelerate runtime[/-][+]Detect the Apple Accelerate/vecLib runtime[/+]LibController
#137rgommers commentedon Oct 27, 2023
I'll note that NumPy now defaults to building against the new Accelerate BLAS and LAPACK (not like conda-forge, that's old Accelerate + Netlib BLAS). It would indeed be quite useful. How it's reported by numpy right now:
ogrisel commentedon Feb 9, 2024
@rgommers is this supposed to be the case for a released version of numpy or for the future numpy 2?
I just tried to install numpy from pypi.org in an empty tmp conda env and I got openblas:
EDIT: running on macOS / M1
rgommers commentedon Feb 9, 2024
It's a very recent regression, which got introduced in some CI refactor (the Accelerate wheel build jobs didn't have OpenBLAS installed until last week or so). That will definitely be fixed before 2.0 comes out.
ogrisel commentedon Apr 9, 2024
numpy 2.0.0rc1 is out and ships wheels for macos-14 that no longer vendor openblas but instead link against the system Accelerate:
So I guess the priority of this issue goes up because there will be many more people using Accelerate by default very soon.
rgommers commentedon Apr 10, 2024
Relying on
np.show_config
is partially possible:accelerate
then that means "the NEWLAPACK Accelerate introduced in macOS 13.3", and will be reliable (this will be the case for numpy wheels on PyPI for example).accelerate
then it's still possible that conda-forge is doing its "build against libblas stubs" thing and Accelerate is switched in dynamically. This is currently old-style Accelerate + Netlib LAPACK. Inspecting the output ofotool -L
seems like the only option to deal with that.