10000 ENH: build wheels with Accelerate on macOS >=14 on Cirrus CI · rgommers/numpy@01c8ef2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 01c8ef2

Browse files
committed
ENH: build wheels with Accelerate on macOS >=14 on Cirrus CI
Addresses the arm64 part of numpygh-24905.
1 parent 034f560 commit 01c8ef2

File tree

4 files changed

+28
-19
lines changed

4 files changed

+28
-19
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ tracker = "https://github.com/numpy/numpy/issues"
143143
skip = "cp36-* cp37-* cp-38* pp37-* *-manylinux_i686 *_ppc64le *_s390x"
144144
build-verbosity = "3"
145145
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
146-
config-settings = "setup-args=-Duse-ilp64=true setup-args=-Dblas=openblas setup-args=-Dlapack=openblas setup-args=-Dblas-symbol-suffix=64_"
146+
# The build will use openblas64 everywhere, except on arm64 macOS >=14.0 (uses Accelerate)
147+
config-settings = "setup-args=-Duse-ilp64=true"
147148
# meson has a hard dependency on ninja, and we need meson to build
148149
# c-extensions in tests. There is a ninja PyPI package used in
149150
# build_requirements.txt for macOS, windows, linux but it cannot be in

tools/ci/cirrus_wheels.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,30 +55,19 @@ linux_aarch64_task:
5555
macosx_arm64_task:
5656
use_compute_credits: $CIRRUS_USER_COLLABORATOR == 'true'
5757
macos_instance:
58-
image: ghcr.io/cirruslabs/macos-monterey-xcode:14
58+
matrix:
59+
- image: ghcr.io/cirruslabs/macos-monterey-xcode:14
60+
- image: ghcr.io/cirruslabs/macos-sonoma-xcode:15
5961
matrix:
6062
- env:
6163
CIRRUS_CLONE_SUBMODULES: true
62-
CIBW_BUILD: cp39-*
63-
- env:
64-
CIRRUS_CLONE_SUBMODULES: true
65-
CIBW_BUILD: cp310-* cp311-*
64+
CIBW_BUILD: cp39-* cp310-*
6665
- env:
6766
CIRRUS_CLONE_SUBMODULES: true
68-
CIBW_PRERELEASE_PYTHONS: True
69-
CIBW_BUILD: cp312-*
67+
CIBW_BUILD: cp311-* cp312-*
7068
env:
7169
PATH: /opt/homebrew/opt/python@3.10/bin:/usr/local/lib:/usr/local/include:$PATH
7270
CIBW_ARCHS: arm64
73-
# Specifying CIBW_ENVIRONMENT_MACOS overrides pyproject.toml, so include
74-
# all the settings from there, otherwise they're lost.
75-
# SDKROOT needs to be set for repackaged conda-forge gfortran compilers
76-
# supplied by isuruf.
77-
# Find out SDKROOT via `xcrun --sdk macosx --show-sdk-path`
78-
CIBW_ENVIRONMENT_MACOS: >
79-
RUNNER_OS=macOS
80-
SDKROOT=/Applications/Xcode-14.0.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
81-
LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
8271

8372
build_script:
8473
- brew install python@3.10

tools/wheels/cibw_before_build.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,20 @@ elif [[ $RUNNER_OS == "Windows" ]]; then
1313
cat $PROJECT_DIR/tools/wheels/LICENSE_win32.txt >> $PROJECT_DIR/LICENSE.txt
1414
fi
1515

16+
install_openblas=true
17+
if [[ $RUNNER_OS == "macOS" ]]; then
18+
if [[ $(sw_vers --productVersion) == 14.* ]]; then
19+
# This is the wheel build with Accelerate
20+
export MACOSX_DEPLOYMENT_TARGET=14.0
21+
install_openblas=false
22+
else
23+
# Done in gfortran_utils.sh
24+
echo "deployment target determined from Python interpreter"
25+
fi
26+
fi
27+
1628
# Install Openblas
17-
if [[ $RUNNER_OS == "Linux" || $RUNNER_OS == "macOS" ]] ; then
29+
if [[ $RUNNER_OS == "Linux" || $RUNNER_OS == "macOS" && install_openblas ]] ; then
1830
basedir=$(python tools/openblas_support.py --use-ilp64)
1931
if [[ $RUNNER_OS == "macOS" && $PLATFORM == "macosx-arm64" ]]; then
2032
# /usr/local/lib doesn't exist on cirrus-ci runners
@@ -49,6 +61,10 @@ if [[ $RUNNER_OS == "macOS" ]]; then
4961
if [[ $PLATFORM == "macosx-arm64" ]]; then
5062
PLAT="arm64"
5163
fi
64+
65+
# Needed for OpenBLAS and gfortran
66+
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
67+
5268
source $PROJECT_DIR/tools/wheels/gfortran_utils.sh
5369
install_gfortran
5470
pip install "delocate==0.10.4"

tools/wheels/gfortran_utils.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,15 @@ function get_gf_lib_for_suf {
109109
}
110110

111111
if [ "$(uname)" == "Darwin" ]; then
112+
# Set deployment target to match the one Python was built for, if the env
113+
# var wasn't explcitly set already.
112114
mac_target=${MACOSX_DEPLOYMENT_TARGET:-$(get_macosx_target)}
113115
export MACOSX_DEPLOYMENT_TARGET=$mac_target
114116
# Keep this for now as some builds might depend on this being
115117
# available before install_gfortran is called
116118
export GFORTRAN_SHA=c469a420d2d003112749dcdcbe3c684eef42127e
117-
# Set SDKROOT env variable if not set
119+
# SDKROOT needs to be set for repackaged conda-forge gfortran compilers
120+
# supplied by isuruf. So set it if it's not already set.
118121
export SDKROOT=${SDKROOT:-$(xcrun --show-sdk-path)}
119122

120123
function download_and_unpack_gfortran {

0 commit comments

Comments
 (0)
0