Skip to content

CI Build macOS arm wheels [cd build gh] #21827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ jobs:
python: 39
platform_id: macosx_x86_64

# MacOS arm64
- os: macos-latest
bitness: 64
python: 38
platform_id: macosx_arm64
- os: macos-latest
bitness: 64
python: 39
platform_id: macosx_arm64
- os: macos-latest
bitness: 64
python: 310
platform_id: macosx_arm64

steps:
- name: Checkout scikit-learn
uses: actions/checkout@v1
Expand All @@ -175,10 +189,11 @@ jobs:
OPENBLAS_NUM_THREADS=2
SKLEARN_SKIP_NETWORK_TESTS=1
SKLEARN_BUILD_PARALLEL=3
MACOSX_DEPLOYMENT_TARGET=10.13
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
CIBW_ARCHS: all
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }}
CIBW_MANYLINUX_I686_IMAGE: ${{ matrix.manylinux_image }}
CIBW_TEST_SKIP: "*-macosx_arm64"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: bash build_tools/github/repair_windows_wheels.sh {wheel} {dest_dir} ${{ matrix.bitness }}
CIBW_BEFORE_TEST_WINDOWS: bash build_tools/github/build_minimal_windows_image.sh ${{ matrix.python }} ${{ matrix.bitness }}
CIBW_TEST_REQUIRES: pytest pandas threadpoolctl
Expand Down
20 changes: 15 additions & 5 deletions build_tools/github/build_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ if [[ "$RUNNER_OS" == "macOS" ]]; then
# Make sure to use a libomp version binary compatible with the oldest
# supported version of the macos SDK as libomp will be vendored into the
# scikit-learn wheels for macos. The list of binaries are in
# https://packages.macports.org/libomp/. Currently, the oldest
# supported macos version is: High Sierra / 10.13. When upgrading this, be
# sure to update the MACOSX_DEPLOYMENT_TARGET environment variable in
# wheels.yml accordingly. Note that Darwin_17 == High Sierra / 10.13.
wget https://packages.macports.org/libomp/libomp-11.0.1_0+universal.darwin_17.i386-x86_64.tbz2 -O libomp.tbz2
# https://packages.macports.org/libomp/.
if [[ "$CIBW_BUILD" == *-macosx_arm64 ]]; then
# arm64 builds must cross compile because CI is on x64
export PYTHON_CROSSENV=1
# SciPy requires 12.0 on arm to prevent kernel panics
# https://github.com/scipy/scipy/issues/14688
# We use the same deployment target to match SciPy.
export MACOSX_DEPLOYMENT_TARGET=12.0
wget https://packages.macports.org/libomp/libomp-11.0.1_0.darwin_20.arm64.tbz2 -O libomp.tbz2
else
# Currently, the oldest supported macos version is: High Sierra / 10.13.
# Note that Darwin_17 == High Sierra / 10.13.
export MACOSX_DEPLOYMENT_TARGET=10.13
wget https://packages.macports.org/libomp/libomp-11.0.1_0+universal.darwin_17.i386-x86_64.tbz2 -O libomp.tbz2
fi
sudo tar -C / -xvjf libomp.tbz2 opt

export CC=/usr/bin/clang
Expand Down
1 change: 1 addition & 0 deletions sklearn/_build_utils/openmp_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def check_openmp_support():
if "PYODIDE_PACKAGE_ABI" in os.environ:
# Pyodide doesn't support OpenMP
return False

code = textwrap.dedent(
"""\
#include <omp.h>
Expand Down
1 change: 1 addition & 0 deletions sklearn/_build_utils/pre_build_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def basic_check_build():
if "PYODIDE_PACKAGE_ABI" in os.environ:
# The following check won't work in pyodide
return

code = textwrap.dedent(
"""\
#include <stdio.h>
Expand Down