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

Fix OpenMP library issues on M1 Macs #166

Merged
merged 2 commits into from
Nov 8, 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
6 changes: 6 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
* Linux users on `x86_64` must have a CPU supporting AVX.
[(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157)

### Bug fixes

* OpenMP built with Intel MacOS CI runners causes failures on M1 Macs. OpenMP is currently
disabled in the built wheels until this can be resolved with Github Actions runners.
[(#166)](https://github.com/PennyLaneAI/pennylane-lightning/pull/166)

### Contributors

This release contains contributions from (in alphabetical order):
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/wheel_macos_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ env:
# MacOS specific build settings
CIBW_BEFORE_ALL_MACOS: |
brew uninstall --force oclint
brew install libomp

# Python build settings
CIBW_BEFORE_BUILD: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wheel_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
run: python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_ARCHS_MACOS: ${{matrix.arch}}
USE_OMP: 1

- uses: actions/upload-artifact@v2
if: github.ref == 'refs/heads/master'
Expand Down
15 changes: 10 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,16 @@ class BuildExt(build_ext):
opts["unix"].remove("-fopenmp")
opts["unix"].remove("-shared")

darwin_opts = [
"-stdlib=libc++",
"-Xpreprocessor",
"-fopenmp",
]
darwin_opts = ["-stdlib=libc++"]

# Used to enable OpenMP only on Intel
# Macs due to CI available of M1
Copy link
Member Author

Choose a reason for hiding this comment

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

Suggested change
# Macs due to CI available of M1
# Macs due to lacking CI availability of M1 hardware.

if os.environ.get("USE_OMP"):
darwin_opts.extend([
"-Xpreprocessor",
"-fopenmp",
])

darwin_opts.append("-mmacosx-version-min=10.14")

c_opts["unix"] += darwin_opts
Expand Down