Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 594b1f7

Browse files
thomasjpfanogrisel
andauthored
CI Build macOS arm wheels [cd build gh] (#21827)
Co-authored-by: Olivier Grisel <[email protected]> Co-authored-by: Olivier Grisel <[email protected]>
1 parent 8876439 commit 594b1f7

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

.github/workflows/wheels.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,20 @@ jobs:
173173
python: 310
174174
platform_id: macosx_x86_64
175175

176+
# MacOS arm64
177+
- os: macos-latest
178+
bitness: 64
179+
python: 38
180+
platform_id: macosx_arm64
181+
- os: macos-latest
182+
bitness: 64
183+
python: 39
184+
platform_id: macosx_arm64
185+
- os: macos-latest
186+
bitness: 64
187+
python: 310
188+
platform_id: macosx_arm64
189+
176190
steps:
177191
- name: Checkout scikit-learn
178192
uses: actions/checkout@v1
@@ -190,10 +204,11 @@ jobs:
190204
OPENBLAS_NUM_THREADS=2
191205
SKLEARN_SKIP_NETWORK_TESTS=1
192206
SKLEARN_BUILD_PARALLEL=3
193-
MACOSX_DEPLOYMENT_TARGET=10.13
194207
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
208+
CIBW_ARCHS: all
195209
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
196210
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
211+
CIBW_TEST_SKIP: "*-macosx_arm64"
197212
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }}
198213
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }}
199214
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl

build_tools/github/build_wheels.sh

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,21 @@ if [[ "$RUNNER_OS" == "macOS" ]]; then
88
# Make sure to use a libomp version binary compatible with the oldest
99
# supported version of the macos SDK as libomp will be vendored into the
1010
# scikit-learn wheels for macos. The list of binaries are in
11-
# https://packages.macports.org/libomp/. Currently, the oldest
12-
# supported macos version is: High Sierra / 10.13. When upgrading this, be
13-
# sure to update the MACOSX_DEPLOYMENT_TARGET environment variable in
14-
# wheels.yml accordingly. Note that Darwin_17 == High Sierra / 10.13.
15-
wget https://packages.macports.org/libomp/libomp-11.0.1_0+universal.darwin_17.i386-x86_64.tbz2 -O libomp.tbz2
11+
# https://packages.macports.org/libomp/.
12+
if [[ "$CIBW_BUILD" == *-macosx_arm64 ]]; then
13+
# arm64 builds must cross compile because CI is on x64
14+
export PYTHON_CROSSENV=1
15+
# SciPy requires 12.0 on arm to prevent kernel panics
16+
# https://github.com/scipy/scipy/issues/14688
17+
# We use the same deployment target to match SciPy.
18+
export MACOSX_DEPLOYMENT_TARGET=12.0
19+
wget https://packages.macports.org/libomp/libomp-11.0.1_0.darwin_20.arm64.tbz2 -O libomp.tbz2
20+
else
21+
# Currently, the oldest supported macos version is: High Sierra / 10.13.
22+
# Note that Darwin_17 == High Sierra / 10.13.
23+
export MACOSX_DEPLOYMENT_TARGET=10.13
24+
wget https://packages.macports.org/libomp/libomp-11.0.1_0+universal.darwin_17.i386-x86_64.tbz2 -O libomp.tbz2
25+
fi
1626
sudo tar -C / -xvjf libomp.tbz2 opt
1727

1828
export CC=/usr/bin/clang

sklearn/_build_utils/openmp_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def check_openmp_support():
4949
if "PYODIDE_PACKAGE_ABI" in os.environ:
5050
# Pyodide doesn't support OpenMP
5151
return False
52+
5253
code = textwrap.dedent(
5354
"""\
5455
#include <omp.h>

sklearn/_build_utils/pre_build_helpers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ def basic_check_build():
102102
if "PYODIDE_PACKAGE_ABI" in os.environ:
103103
# The following check won't work in pyodide
104104
return
105+
105106
code = textwrap.dedent(
106107
"""\
107108
#include <stdio.h>

0 commit comments

Comments
 (0)