Skip to content

Commit 6b570ed

Browse files
authored
Fix OpenMP library issues on M1 Macs (#166)
* Fix OMP issue on M1 macs * Update changelog
1 parent 2b15d02 commit 6b570ed

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

.github/CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@
1818
* Linux users on `x86_64` must have a CPU supporting AVX.
1919
[(#157)](https://github.com/PennyLaneAI/pennylane-lightning/pull/157)
2020

21+
### Bug fixes
22+
23+
* OpenMP built with Intel MacOS CI runners causes failures on M1 Macs. OpenMP is currently
24+
disabled in the built wheels until this can be resolved with Github Actions runners.
25+
[(#166)](https://github.com/PennyLaneAI/pennylane-lightning/pull/166)
26+
2127
### Contributors
2228

2329
This release contains contributions from (in alphabetical order):

.github/workflows/wheel_macos_arm64.yml

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ env:
1010
# MacOS specific build settings
1111
CIBW_BEFORE_ALL_MACOS: |
1212
brew uninstall --force oclint
13-
brew install libomp
1413
1514
# Python build settings
1615
CIBW_BEFORE_BUILD: |

.github/workflows/wheel_macos_x86_64.yml

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ jobs:
5757
run: python -m cibuildwheel --output-dir wheelhouse
5858
env:
5959
CIBW_ARCHS_MACOS: ${{matrix.arch}}
60+
USE_OMP: 1
6061

6162
- uses: actions/upload-artifact@v2
6263
if: github.ref == 'refs/heads/master'

setup.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,16 @@ class BuildExt(build_ext):
9191
opts["unix"].remove("-fopenmp")
9292
opts["unix"].remove("-shared")
9393

94-
darwin_opts = [
95-
"-stdlib=libc++",
96-
"-Xpreprocessor",
97-
"-fopenmp",
98-
]
94+
darwin_opts = ["-stdlib=libc++"]
95+
96+
# Used to enable OpenMP only on Intel
97+
# Macs due to CI available of M1
98+
if os.environ.get("USE_OMP"):
99+
darwin_opts.extend([
100+
"-Xpreprocessor",
101+
"-fopenmp",
102+
])
103+
99104
darwin_opts.append("-mmacosx-version-min=10.14")
100105

101106
c_opts["unix"] += darwin_opts

0 commit comments

Comments
 (0)