Skip to content

CI Build wheels for the ARM64 architecture #18782

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 35 commits into from
Dec 15, 2020

Conversation

alfaro96
Copy link
Member

@alfaro96 alfaro96 commented Nov 7, 2020

Reference Issues/PRs

Closes MacPython/scikit-learn-wheels#66

What does this implement/fix? Explain your changes.

This PR build the wheels for the ARM64 architecture using the cibuildwheel package.

@alfaro96 alfaro96 marked this pull request as draft November 7, 2020 09:00
@thomasjpfan
Copy link
Member

I have recently tried doing this. I found that I had to update pyproject.toml because numpy only has arm wheels for 1.19. If we go lower, pip wheel will spend time building numpy. Here is how I updated the pyproject.toml

I also had a travis-ci build that can builld the wheel but stalls during pytest. link here

@janaknat
Copy link

janaknat commented Nov 9, 2020

Is it possible to use arm64-gravtion2 to build and test the wheels? It will go much faster.

Travis-CI Graviton2 support: https://blog.travis-ci.com/2020-09-11-arm-on-aws

Travis-CI config to use Graviton2 instances:

arch: arm64-graviton2
dist: focal
virt: vm
group: edge

@alfaro96
Copy link
Member Author

Is it possible to use arm64-gravtion2 to build and test the wheels? It will go much faster.

Travis-CI Graviton2 support: https://blog.travis-ci.com/2020-09-11-arm-on-aws

Travis-CI config to use Graviton2 instances:

arch: arm64-graviton2
dist: focal
virt: vm
group: edge

Thank you @janaknat for the suggestion.

I will have a look as soon as #18761 gets merged 😉.

@alfaro96
Copy link
Member Author

alfaro96 commented Nov 10, 2020

I have recently tried doing this. I found that I had to update pyproject.toml because numpy only has arm wheels for 1.19. If we go lower, pip wheel will spend time building numpy. Here is how I updated the pyproject.toml

I will wait for #18761 to get merged before continuing working on this PR to use the NumPy ARM wheels.

I also had a travis-ci build that can builld the wheel but stalls during pytest. link here

Same for me. We need to extend the waiting time with travis_wait before executing pytest (30 minutes approximately?).

@ogrisel
Copy link
Member

ogrisel commented Nov 12, 2020

You might want to try to set the environment variables of #18807 and increase the verbosity of cibuildwheel to see how far it could make progress.

@ogrisel
Copy link
Member

ogrisel commented Nov 12, 2020

I think it's time to re-explore using the graviton2 processors which might be significantly faster as suggested in #18782 (comment) .

@alfaro96
Copy link
Member Author

I think it's time to re-explore using the graviton2 processors which might be significantly faster as suggested in #18782 (comment) .

Let us try ;)

@alfaro96
Copy link
Member Author

The suggestion of @janaknat allows the Travis jobs to finish (thank you for the suggestion), but some tests are failing:

  • test_explained_variance[randomized-20-dense]
  • test_explained_variance_components_10_20[randomized-dense]
  • test_lle_simple_grid
  • test_fit
  • test_partial_fit
  • test_small_sparse_partial_fit
  • test_sample_hiddens
  • test_gibbs_smoke
  • test_score_samples
  • test_rbm_verbose
  • test_convergence_dtype_consistency
  • test_randomized_svd_power_iteration_normalizer
  • test_svd_flip

@ogrisel
Copy link
Member

ogrisel commented Nov 12, 2020

This are probably the same failures than those reported by @janaknat in MacPython/scikit-learn-wheels#66. It seems that they are all happening on models that use BLAS / LAPACK operations which makes me suspect a bug on the BLAS implementation for ARM64 on graviton2 processors...

@ogrisel
Copy link
Member

ogrisel commented Nov 12, 2020

The suggestion of @janaknat allows the Travis jobs to finish

We still get a timeout after 10min without any output on the Python 3.9 job though...

@ogrisel
Copy link
Member

ogrisel commented Nov 12, 2020

I pushed a change to print the implementation and version of BLAS used by numpy and scipy in those wheels.

I am afraid that we will have to start interactive debugging sessions to craft minimal reproduction cases that only depend on numpy and/or scipy to be able to report the issues upstream for that platform.

@sebpop
Copy link

sebpop commented Nov 12, 2020

Check to see if the bugs disappear with different implementations of BLAS and LAPACK.

Alternatives:
You can use OpenBLAS (it's the default when using pip install numpy scipy.)
You can replace BLIS for BLAS, and you will still need OpenBLAS for LAPACK. Instructions on how to install numpy and scipy with BLIS: https://github.com/aws/aws-graviton-getting-started/blob/master/python.md#22-install-numpy-and-scipy-with-blis-on-ubuntu-and-debian
You also can use ArmPL instead of BLAS and LAPACK.
ArmPL can be freely downloaded from:
https://developer.arm.com/tools-and-software/server-and-hpc/downloads/arm-performance-libraries

@ogrisel
Copy link
Member

ogrisel commented Dec 18, 2020

We have enough to build around ~ 17 times, which means we can not run it every day as a cron job. We can conservatively have it run once or twice a week.

I think we do it only manually for ARM64 wheels.

@ogrisel
Copy link
Member

ogrisel commented Dec 18, 2020

And we should move the ICC and scipy-dev builds out of travis (e.g. to github actions or Azure). If someone wants to volunteer :)

@alfaro96
Copy link
Member Author

We have enough to build around ~ 17 times, which means we can not run it every day as a cron job. We can conservatively have it run once or twice a week.

I think we do it only manually for ARM64 wheels.

Indeed, I will try to move the wheel builder for ARM64 to GitHub Actions: #19027.

@alfaro96
Copy link
Member Author

And we should move the ICC and scipy-dev builds out of travis (e.g. to github actions or Azure). If someone wants to volunteer :)

I think that the scipy-dev job is already in Azure with Linux_Nightly pylatest_pip_scipy_dev.

Am I wrong?

@thomasjpfan
Copy link
Member

I think that the scipy-dev job is already in Azure with Linux_Nightly pylatest_pip_scipy_dev.

Am I wrong?

It is. I moved it to azure-pipelines a few months ago to get the ball rolling.

I opened #19036 to remove scipy-dev from travis.

glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Dec 22, 2020
@glemaitre glemaitre mentioned this pull request Dec 22, 2020
14 tasks
@alfaro96
Copy link
Member Author

FYI, the ARM64 wheels are available online: https://anaconda.org/scikit-learn-wheels-staging/scikit-learn/files.

@janaknat
Copy link

@alfaro96 The latest version doesn't have the aarch64 wheels.

@henryiii
Copy link

cibuildwheel 1.8.0 now supports building ARM via emulation on GHA and others. :)

@alfaro96
Copy link
Member Author

@alfaro96 The latest version doesn't have the aarch64 wheels.

Hey @janaknat,

We are out of travis credits and we were not able to build the wheels for the latest version.

@henryiii
Copy link

@alfaro96 I highly recommend asking Travis, they may have the ability to increase the free allotment for special cases. They have done that for at least one group here.

@alfaro96
Copy link
Member Author

@alfaro96 I highly recommend asking Travis, they may have the ability to increase the free allotment for special cases. They have done that for at least one group here.

CC @thomasjpfan and @ogrisel.

@thomasjpfan
Copy link
Member

I think @adrinjalali has already emailed travis about this.

@adrinjalali
Copy link
Member

Yes. I have sent two emails, no luck so far!

@janaknat
Copy link

janaknat commented Feb 3, 2021

@alfaro96 Did Travis get in contact wrt credits?

@alfaro96
Copy link
Member Author

alfaro96 commented Feb 3, 2021

@alfaro96 Did Travis get in contact wrt credits?

We already have some travis credits and, although the wheels are not available in pypi, you can install from the anaconda repository with:

pip install -i https://pypi.anaconda.org/scikit-learn-wheels-staging/simple scikit-learn

CC @ogrisel.

@janaknat
Copy link

janaknat commented Feb 3, 2021

Any idea on when the wheels will show up in PyPI?

@janaknat
Copy link

@alfaro96 Will the aarch64 wheels show up in pypi?

@alfaro96
Copy link
Member Author

alfaro96 commented Mar 15, 2021

Since the aarch64 wheels are already available in the anaconda repository, I think that we can run the Publish to Pypi workflow to upload these wheels to the pypi repository.

WDYT @ogrisel and @thomasjpfan.

@thomasjpfan
Copy link
Member

I think we are waiting for the 0.24.2 release. I do not think the script would work now because it will try to upload all the wheels and fail because pypi does not allow one to reload a wheel with the same version. (unless we give it a "post1" tag)

Technically, we can run build-wheel on the 0.24.X branch and then upload the few arm wheels ourselves. (I do not have access to pypi)

@adrinjalali
Copy link
Member

adrinjalali commented Mar 21, 2021

@thomasjpfan Is your user name on pypi the same as your github's?

@thomasjpfan
Copy link
Member

@adrinjalali It is the same as my github handle.

@adrinjalali
Copy link
Member

Sent you an invite.

@thomasjpfan
Copy link
Member

Thank you @adrinjalali! I have uploaded the wheels aarch64 files onto pypi.

@ogrisel
Copy link
Member

ogrisel commented Mar 30, 2021

Thanks @thomasjpfan and sorry @alfaro96 for not replying to your pings, I had too many notifications in my inbox.

@glemaitre glemaitre mentioned this pull request Apr 22, 2021
12 tasks
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Apr 22, 2021
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build / CI To backport PR merged in master that need a backport to a release branch defined based on the milestone. Waiting for Reviewer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for aarch64/ARM64 wheels