Skip to content
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

Add CI jobs to cross-build arm64 macOS wheels #1362

Merged
merged 19 commits into from
Jan 19, 2022

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Sep 28, 2021

Summary

This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Details and comments

Fixes #1286
Fixes #1397

CMakeLists.txt Outdated
Comment on lines 229 to 230
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64")
if(APPLE OR UNIX)
if(NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64" AND (APPLE OR UNIX))
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the problem is that CMAKE_OSX_ARCHITECTURES is not really set and that we are using CMAKE_HOST_SYSTEM_PROCESSOR instead of CMAKE_SYSTEM_PROCESSOR, so it incorrectly assumes is in x86_64.
I would try with:

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64")
    if(APPLE OR UNIX)

CMakeLists.txt Outdated Show resolved Hide resolved
@mtreinish mtreinish force-pushed the vvilpas-vv_update_openmp branch from ecd70ba to 86fd342 Compare December 7, 2021 15:28
@mtreinish mtreinish changed the title DNM: Test #1348 with cibuildwheel [WIP] Add CI jobs to cross-build arm64 macOS wheels Dec 7, 2021
…ing used"

This isn't needed I found the other location in a cmakefile triggering
the compilation of the avx2 file so we don't need to print this anymore
(it also wouldn't have shown what I was looking for).

This reverts commit 9a6883c.
There was a second cmake file embedded in the source tree triggering the
avx2 file compilation. This commit adds an if condition to that location
as well to avoid trying to build avx2 on arm64.
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

Looks solid, and not too much of a change, which is nice!

if (NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
# We build SIMD filed separately, because they will be reached only if the
# machine running the code has SIMD support
set(SIMD_SOURCE_FILE "../../../../../src/simulators/statevector/qv_avx2.cpp")
Copy link
Member

Choose a reason for hiding this comment

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

../../../../../ lol. I know it's pre-existing, but is it worth quickly swapping it to ${PROJECT_SOURCE_DIR}?

Copy link
Member Author

Choose a reason for hiding this comment

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

Heh, sure I'll update this now to make this ready for merge and do that change as part of it

@nonhermitian
Copy link
Contributor

The wheels work for me (well Py3.9 one did).

This commit finalizes the iterative process in earlier commits to
prepare this PR for merging. It makes 3 primary changes, the first is to
add the proper release wheel publish job. This is a dual of the job
added in the previous commits that runs in the build ci workflow. That
job but will run on tags and publish the built wheels to pypi. The build
job that runs on every commit will still stay around to ensure we don't
regress and break macOS arm64 builds since testing of it will be
limited. The second change is a small update to the cmake files to
clean them up slightly based on review comments. The last change here
is adding a release note to document the addition of support for arm64
macOS.
@mtreinish mtreinish changed the title [WIP] Add CI jobs to cross-build arm64 macOS wheels Add CI jobs to cross-build arm64 macOS wheels Jan 18, 2022
@mtreinish mtreinish added Changelog: New Feature Include in the Added section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable and removed on hold Can not fix yet labels Jan 18, 2022
Copy link
Member

@jakelishman jakelishman left a comment

Choose a reason for hiding this comment

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

🎉 🎉 🎉

run: python -m pip install -U cibuildwheel==2.1.2
- name: Build Wheels
env:
CIBW_SKIP: "cp310-* pp*"
Copy link
Member

Choose a reason for hiding this comment

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

This line will need updating in #1430 after merge, and similar in deploy.yml.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, I'll update it here or in #1430 depending on which merges first

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually on second thought it's not strictly needed as the cibuildwheel configuration already filters arm64 macOS wheels to >= 3.8 as those are the only python versions which officialy support arm64 macOS. So we don't strictly need to change anything here because it'll already skip 3.6 and 3.7

@mtreinish mtreinish merged commit f778f4b into Qiskit:main Jan 19, 2022
@mtreinish mtreinish deleted the vvilpas-vv_update_openmp branch January 19, 2022 19:51
hhorii pushed a commit to hhorii/qiskit-aer that referenced this pull request Jan 21, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes Qiskit#1286
Fixes Qiskit#1397
mtreinish added a commit to mtreinish/qiskit that referenced this pull request Jan 21, 2022
The supported platform list in the install documentation wasn't quite up
to date. The supported platforms are also a bit more nuanced than that
list made it appear. This commit expands the platform support section
and documents the different levels of support for platforms and the
details about each level. This should hopefully make it clearer to users
which platforms are expected to work and what guarantees are made for
each platform.

This is related to Qiskit/qiskit#7553, Qiskit/qiskit#7549,
and Qiskit/qiskit-aer#1362 which are expanding (or just changing the
level of support) the supported platforms but each have a different set
of tradeoffs that we should be documenting.
jakelishman added a commit to Qiskit/qiskit-metapackage that referenced this pull request Jan 21, 2022
* Expand platform support section to install doc

The supported platform list in the install documentation wasn't quite up
to date. The supported platforms are also a bit more nuanced than that
list made it appear. This commit expands the platform support section
and documents the different levels of support for platforms and the
details about each level. This should hopefully make it clearer to users
which platforms are expected to work and what guarantees are made for
each platform.

This is related to Qiskit/qiskit#7553, Qiskit/qiskit#7549,
and Qiskit/qiskit-aer#1362 which are expanding (or just changing the
level of support) the supported platforms but each have a different set
of tradeoffs that we should be documenting.

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

Co-authored-by: Jake Lishman <jake@binhbar.com>
hhorii pushed a commit that referenced this pull request Feb 9, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes #1286
Fixes #1397
hhorii pushed a commit to hhorii/qiskit-aer that referenced this pull request Feb 9, 2022
This PR adds CI jobs to build qiskit-aer wheels on arm64 macOS wheels. Since no CI system provides native arm64
macOS environments these CI jobs are configured to cross compile arm64 binaries from an x86_64 macOS
environment. This has the limitation of not letting us execute the binaries but we can at least test building them in
PR CI and publish the built binaries at release time. The two jobs added here do just that, the first is run as part
of the Build workflow that runs on every proposed commit to test that we can at least compile on arm64 macOS
(for supported python versions). The second job is a release publishing job that will build and publish arm64
macOS wheels to PyPI whenever there is a release.

Fixes Qiskit#1286
Fixes Qiskit#1397
jakelishman added a commit to jakelishman/qiskit-terra that referenced this pull request Aug 11, 2023
…kage#1402)

* Expand platform support section to install doc

The supported platform list in the install documentation wasn't quite up
to date. The supported platforms are also a bit more nuanced than that
list made it appear. This commit expands the platform support section
and documents the different levels of support for platforms and the
details about each level. This should hopefully make it clearer to users
which platforms are expected to work and what guarantees are made for
each platform.

This is related to Qiskit#7553, Qiskit#7549,
and Qiskit/qiskit-aer#1362 which are expanding (or just changing the
level of support) the supported platforms but each have a different set
of tradeoffs that we should be documenting.

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

Co-authored-by: Jake Lishman <jake@binhbar.com>
SamD-1998 pushed a commit to SamD-1998/qiskit-terra that referenced this pull request Sep 7, 2023
…kage#1402)

* Expand platform support section to install doc

The supported platform list in the install documentation wasn't quite up
to date. The supported platforms are also a bit more nuanced than that
list made it appear. This commit expands the platform support section
and documents the different levels of support for platforms and the
details about each level. This should hopefully make it clearer to users
which platforms are expected to work and what guarantees are made for
each platform.

This is related to Qiskit#7553, Qiskit#7549,
and Qiskit/qiskit-aer#1362 which are expanding (or just changing the
level of support) the supported platforms but each have a different set
of tradeoffs that we should be documenting.

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

Co-authored-by: Jake Lishman <jake@binhbar.com>
Eric-Arellano pushed a commit to Qiskit/documentation that referenced this pull request Oct 12, 2023
…kage#1402)

* Expand platform support section to install doc

The supported platform list in the install documentation wasn't quite up
to date. The supported platforms are also a bit more nuanced than that
list made it appear. This commit expands the platform support section
and documents the different levels of support for platforms and the
details about each level. This should hopefully make it clearer to users
which platforms are expected to work and what guarantees are made for
each platform.

This is related to Qiskit/qiskit#7553, Qiskit/qiskit#7549,
and Qiskit/qiskit-aer#1362 which are expanding (or just changing the
level of support) the supported platforms but each have a different set
of tradeoffs that we should be documenting.

* Apply suggestions from code review

Co-authored-by: Jake Lishman <jake@binhbar.com>

Co-authored-by: Jake Lishman <jake@binhbar.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the Added section of the changelog stable-backport-potential The issue or PR might be minimal and/or import enough to backport to stable
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip install fails on Mac M1 arm64 ImportError for Qiskit Aer built from source for MacOS arm64
4 participants