-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 pennylane-lightning-kokkos recipe. #22360
Merged
carterbox
merged 23 commits into
conda-forge:main
from
vincentmr:pennylane-lightning-kokkos
May 1, 2023
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
c7f150f
Add pennylane-lightning-kokkos recipe.
vincentmr d20a2ad
Build only for linux.
vincentmr ba6b407
Add patch to setup.py for osx.
vincentmr a024a11
Set PLKOKKOS_ENABLE_WARNINGS=OFF for osx build.
vincentmr e84b04f
Update osx script.
vincentmr 868754b
Remove duplicate pip runtime dep.
vincentmr 92f310c
Bound kokkos version.
vincentmr 6b52096
Only build linux packages.
vincentmr cf3e8ab
Update recipes/pennylane-lightning-kokkos/meta.yaml
vincentmr 4b51582
Update recipes/pennylane-lightning-kokkos/meta.yaml
vincentmr 4404ead
Update recipes/pennylane-lightning-kokkos/meta.yaml
vincentmr de3f330
Add back the osx build.
vincentmr 267eb0b
Put osx script back on one line.
vincentmr 224f351
Fix skip condition.
vincentmr 2736d8b
Try defining __APPLE__.
vincentmr 0f6d14a
Revert changes from last commit.
vincentmr 4b4a01a
Try conversion table.
vincentmr 7bc4b3b
Fix patch.
vincentmr 734cdda
Update patch.
vincentmr 2d27e6f
Remove memory header in 0002 patch.
vincentmr 8e953c1
Try patch by leo.
vincentmr d5b9744
Fix patch.
vincentmr 95eb77a
Update recipes/pennylane-lightning-kokkos/meta.yaml
carterbox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
diff --git a/setup.py b/setup.py | ||
index 7429a8e..9a1e2ae 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -108,9 +108,13 @@ if not os.getenv("READTHEDOCS"): | ||
"-DCMAKE_SYSTEM_PROCESSOR=ARM64", | ||
] | ||
else: # X64 arch | ||
- llvmpath = ( | ||
- subprocess.check_output(["brew", "--prefix", "llvm"]).decode().strip() | ||
- ) | ||
+ if shutil.which("brew"): | ||
+ llvmpath = ( | ||
+ subprocess.check_output(["brew", "--prefix", "llvm"]).decode().strip() | ||
+ ) | ||
+ else: | ||
+ llvmpath = shutil.which("clang++") | ||
+ llvmpath = Path(llvmpath).parent.parent | ||
configure_args += [ | ||
f"-DCMAKE_CXX_COMPILER={llvmpath}/bin/clang++", | ||
f"-DCMAKE_LINKER={llvmpath}/bin/lld", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/setup.py b/setup.py | ||
index 9a1e2ae..a2f77f6 100644 | ||
--- a/setup.py | ||
+++ b/setup.py | ||
@@ -65,11 +65,9 @@ if not os.getenv("READTHEDOCS"): | ||
cfg = "Debug" if debug else "Release" | ||
ninja_path = str(shutil.which("ninja")) | ||
|
||
- # Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON | ||
configure_args = [ | ||
"-DCMAKE_CXX_FLAGS=-fno-lto", | ||
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}", | ||
- f"-DPYTHON_EXECUTABLE={sys.executable}", | ||
f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm | ||
*(self.cmake_defines), | ||
] | ||
@@ -100,27 +98,7 @@ if not os.getenv("READTHEDOCS"): | ||
|
||
# Add more platform dependent options | ||
if platform.system() == "Darwin": | ||
- # To support ARM64 | ||
- if os.getenv("ARCHS") == "arm64": | ||
- configure_args += [ | ||
- "-DCMAKE_CXX_COMPILER_TARGET=arm64-apple-macos11", | ||
- "-DCMAKE_SYSTEM_NAME=Darwin", | ||
- "-DCMAKE_SYSTEM_PROCESSOR=ARM64", | ||
- ] | ||
- else: # X64 arch | ||
- if shutil.which("brew"): | ||
- llvmpath = ( | ||
- subprocess.check_output(["brew", "--prefix", "llvm"]).decode().strip() | ||
- ) | ||
- else: | ||
- llvmpath = shutil.which("clang++") | ||
- llvmpath = Path(llvmpath).parent.parent | ||
- configure_args += [ | ||
- f"-DCMAKE_CXX_COMPILER={llvmpath}/bin/clang++", | ||
- f"-DCMAKE_LINKER={llvmpath}/bin/lld", | ||
- ] # Use clang instead of appleclang | ||
- # Disable OpenMP in M1 Macs | ||
- configure_args += ["-DKokkos_ENABLE_OPENMP=OFF"] | ||
+ pass | ||
elif platform.system() == "Windows": | ||
configure_args += [ | ||
"-DKokkos_ENABLE_OPENMP=OFF" | ||
@@ -135,9 +113,18 @@ if not os.getenv("READTHEDOCS"): | ||
os.makedirs(self.build_temp) | ||
|
||
subprocess.check_call( | ||
- ["cmake", str(ext.sourcedir)] + configure_args, cwd=self.build_temp | ||
+ ["cmake"] | ||
+ + os.environ["CMAKE_ARGS"].split(" ") | ||
+ + [str(ext.sourcedir)] | ||
+ + configure_args, | ||
+ cwd=self.build_temp, | ||
+ env=os.environ, | ||
+ ) | ||
+ subprocess.check_call( | ||
+ ["cmake", "--build", ".", "--verbose"] + build_args, | ||
+ cwd=self.build_temp, | ||
+ env=os.environ, | ||
) | ||
- subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=self.build_temp) | ||
|
||
|
||
with open("pennylane_lightning_kokkos/_version.py") as f: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% set name = "pennylane-lightning-kokkos" %} | ||
{% set version = "0.29.1" %} | ||
|
||
|
||
package: | ||
name: {{ name }} | ||
version: {{ version }} | ||
|
||
source: | ||
url: https://github.com/PennyLaneAI/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz | ||
sha256: f51ba7718defc7bb5064f690f381e04b2ec58cb09f22a171ae5f410860716e30 | ||
patches: | ||
- 0001-setup.patch | ||
- 0002-setup.patch # [osx] | ||
|
||
build: | ||
number: 0 | ||
skip: true # [win] | ||
script: | | ||
{{ PYTHON }} setup.py build_ext --define="PLKOKKOS_ENABLE_WARNINGS=OFF" | ||
{{ PYTHON }} setup.py bdist_wheel | ||
{{ PYTHON }} -m pip install . --no-deps -vv | ||
|
||
requirements: | ||
build: | ||
- {{ compiler('c') }} | ||
- {{ compiler('cxx') }} | ||
- cmake | ||
- ninja | ||
host: | ||
- libgomp # [linux] | ||
- llvm-openmp # [osx] | ||
- kokkos =3.7 | ||
- pip | ||
- pybind11 | ||
- python | ||
run: | ||
- pennylane >=0.28 | ||
- python | ||
test: | ||
imports: | ||
- pennylane_lightning_kokkos | ||
commands: | ||
- python -c "import pennylane as qml; qml.about()" | ||
- pl-device-test --device lightning.kokkos --shots None --skip-ops | ||
- pl-device-test --device lightning.kokkos --shots 10000 --skip-ops | ||
- pip check | ||
requires: | ||
- setuptools | ||
- flaky | ||
- pip | ||
- pytest | ||
- pytest-mock | ||
about: | ||
home: https://docs.pennylane.ai/projects/lightning-kokkos | ||
summary: The PennyLane-Lightning-Kokkos plugin extends the Pennylane-Lightning state-vector simulator written in C++, and offloads to the Kokkos library for accelerated circuit simulation. | ||
license: Apache-2.0 | ||
# MIT is pennylane/grouping/graph_colouring.py | ||
license_file: LICENSE | ||
doc_url: https://docs.pennylane.ai/projects/lightning-kokkos/en/latest/devices.html | ||
vincentmr marked this conversation as resolved.
Show resolved
Hide resolved
|
||
dev_url: https://github.com/PennyLaneAI/pennylane-lightning-kokkos | ||
|
||
extra: | ||
recipe-maintainers: | ||
- vincentmr | ||
feedstock-name: {{ name }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This package installs some unused CMake files into site-packages. Open a patch upstream to remove them for the next release, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that. The goal is to ship the header templated library along with the binaries. I'll patch the glob expression to fix this, if that alright.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're asking if modifying
MANIFEST.in
is the correct way to exclude that file. I think it is.