8000 [CI] Add circleci build and test for arm64. by cmarmo · Pull Request #20460 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

[CI] Add circleci build and test for arm64. #20460

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 13 commits into from
Aug 4, 2021
34 changes: 33 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: 2
version: 2.1

jobs:
doc-min-dependencies:
Expand Down Expand Up @@ -130,6 +130,35 @@ jobs:
- ~/.ccache
- ~/.cache/pip

linux-arm64:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
environment:
- OMP_NUM_THREADS: 2
- OPENBLAS_NUM_THREADS: 2
- CYTHON_VERSION: 'latest'
- JOBLIB_VERSION: 'latest'
- THREADPOOLCTL_VERSION: 'latest'
- PYTEST_VERSION: 'latest'
- PYTEST_XDIST_VERSION: 'latest'
- TEST_DOCSTRINGS: 'true'
steps:
- checkout
- run: ./build_tools/circle/checkout_merge_commit.sh
- restore_cache:
key: v1-datasets-{{ .Branch }}
- run: ./build_tools/circle/build_test_arm.sh
- save_cache:
key: doc-ccache-{{ .Branch }}-{{ .BuildNum }}
paths:
- ~/.ccache
- ~/.cache/pip
- save_cache:
key: v1-datasets-{{ .Branch }}
paths:
- ~/scikit_learn_data

deploy:
docker:
- image: circleci/python:3.7
Expand Down Expand Up @@ -176,3 +205,6 @@ workflows:
- main
jobs:
- pypy3
linux-arm64:
jobs:
- linux-arm64
9 changes: 0 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ env:

jobs:
include:
# Manual trigger of linux/arm64 tests in PR without triggering the full
# wheel building process for all the Python versions.
- python: 3.9
os: linux
arch: arm64
if: commit_message =~ /\[arm64\]/
env:
- CPU_COUNT=4

# Linux environments to build the scikit-learn wheels for the ARM64
# architecture and Python 3.7 and newer. This is used both at release time
# with the manual trigger in the commit message in the release branch and as
Expand Down
60 changes: 60 additions & 0 deletions build_tools/circle/build_test_arm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/bash

set -e
set -x

UNAMESTR=`uname`

setup_ccache() {
echo "Setting up ccache"
mkdir /tmp/ccache/
which ccache
for name in gcc g++ cc c++ x86_64-linux-gnu-gcc x86_64-linux-gnu-c++; do
ln -s $(which ccache) "/tmp/ccache/${name}"
done
export PATH="/tmp/ccache/:${PATH}"
ccache -M 256M
}

# imports get_dep
source build_tools/shared.sh

sudo add-apt-repository --remove ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install python3-virtualenv ccache
python3 -m virtualenv --system-site-packages --python=python3 testenv
source testenv/bin/activate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case pip fix bugs in the future, let's use the latest version in the venv:

Suggested change
source testenv/bin/activate
source testenv/bin/activate
pip install --upgrade pip

pip install --upgrade pip
setup_ccache
python -m pip install $(get_dep cython $CYTHON_VERSION) \
$(get_dep joblib $JOBLIB_VERSION)
python -m pip install $(get_dep threadpoolctl $THREADPOOLCTL_VERSION) \
$(get_dep pytest $PYTEST_VERSION) \
$(get_dep pytest-xdist $PYTEST_XDIST_VERSION)

if [[ "$COVERAGE" == "true" ]]; then
python -m pip install codecov pytest-cov
fi

if [[ "$PYTEST_XDIST_VERSION" != "none" ]]; then
python -m pip install pytest-xdist
fi

if [[ "$TEST_DOCSTRINGS" == "true" ]]; then
# numpydoc requires sphinx
python -m pip install sphinx
python -m pip install numpydoc
fi

python --version

# Set parallelism to 3 to overlap IO bound tasks with CPU bound tasks on CI
# workers with 2 cores when building the compiled extensions of scikit-learn.
export SKLEARN_BUILD_PARALLEL=3

python -m pip list
pip install --verbose --editable .
ccache -s
python -c "import sklearn; sklearn.show_versions()"
python -m threadpoolctl --import sklearn
python -m pytest sklearn
3 changes: 1 addition & 2 deletions doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ Continuous Integration (CI)
* Azure pipelines are used for testing scikit-learn on Linux, Mac and Windows,
with different dependencies and settings.
* CircleCI is used to build the docs for viewing, for linting with flake8, and
for testing with PyPy on Linux
for testing with PyPy and ARM64 / aarch64 on Linux

Please note that if one of the following markers appear in the latest commit
message, the following actions are taken.
Expand All @@ -560,7 +560,6 @@ message, the following actions are taken.
[lint skip] Azure pipeline skips linting
[scipy-dev] Add a Travis build with our dependencies (numpy, scipy, etc ...) development builds
[icc-build] Add a Travis build with the Intel C compiler (ICC)
[arm64] Add a Travis build for the ARM64 / aarch64 little endian architecture
[doc skip] Docs are not built
[doc quick] Docs built, but excludes example gallery plots
[doc build] Docs built including example gallery plots (very long)
Expand Down
7 changes: 5 additions & 2 deletions sklearn/manifold/tests/test_locally_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ def test_barycenter_kneighbors_graph():

def test_lle_simple_grid():
# note: ARPACK is numerically unstable, so this test will fail for
# some random seeds. We choose 2 because the tests pass.
rng = np.random.RandomState(2)
# some random seeds. We choose 42 because the tests pass.
# for arm64 platforms 2 makes the test fail.
# TODO: rewrite this test to make less sensitive to the random seed,
# irrespective of the platform.
rng = np.random.RandomState(42)

# grid of equidistant points in 2D, n_components = n_dim
X = np.array(list(product(range(5), repeat=2)))
3B5D Expand Down
0