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 LK build path for catalyst shared library #968

Merged
merged 8 commits into from
Oct 30, 2024
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
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@

### Bug fixes

* Fix `liblightning_kokkos_catalyst.so` not copied to correct build path for editable installation.
[(#968)](https://github.com/PennyLaneAI/pennylane-lightning/pull/968)

* Fix PTM stable latest related to `default.qubit.legacy`.
[(#966)](https://github.com/PennyLaneAI/pennylane-lightning/pull/966)

Expand All @@ -156,7 +159,7 @@

This release contains contributions from (in alphabetical order):

Ali Asadi, Amintor Dusko, Luis Alfredo Nuñez Meneses, Vincent Michaud-Rioux, Lee J. O'Riordan, Mudit Pandey, Shuli Shu, Haochen Paul Wang
Ali Asadi, Amintor Dusko, Joseph Lee, Luis Alfredo Nuñez Meneses, Vincent Michaud-Rioux, Lee J. O'Riordan, Mudit Pandey, Shuli Shu, Haochen Paul Wang

---

Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/tests_lkcpu_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,17 @@ jobs:
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
mv .coverage ${{ github.workspace }}/.coverage-${{ github.job }}-${{ matrix.pl_backend }}-${{ matrix.group }}

- name: Test editable install
run: |
rm -r build
pip uninstall pennylane-lightning pennylane-lightning-kokkos -y
python scripts/configure_pyproject_toml.py
SKIP_COMPILATION=True python -m pip install -e . --config-settings editable_mode=compat
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_BACKEND=${DEVICENAME} python scripts/configure_pyproject_toml.py
python -m pip install -e . --config-settings editable_mode=compat -vv
PL_DEVICE=${DEVICENAME} python -m pytest tests/test_device.py $COVERAGE_FLAGS

- name: Upload test durations
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/lightning_kokkos/lightning_kokkos.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@
# lib.<system>-<architecture>-<python-id>"
# To avoid mismatching the folder name, we search for the shared object instead.
# TODO: locate where the naming convention of the folder is decided and replicate it here.
editable_mode_path = package_root.parent.parent / "build"
editable_mode_path = package_root.parent.parent / "build_lightning_kokkos"

Check warning on line 537 in pennylane_lightning/lightning_kokkos/lightning_kokkos.py

View check run for this annotation

Codecov / codecov/patch

pennylane_lightning/lightning_kokkos/lightning_kokkos.py#L537

Added line #L537 was not covered by tests
josephleekl marked this conversation as resolved.
Show resolved Hide resolved
for path, _, files in os.walk(editable_mode_path):
if lib_name in files:
lib_location = (Path(path) / lib_name).as_posix()
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def build_extension(self, ext: CMakeExtension):
if platform.system() in ["Linux", "Darwin"]:
shared_lib_ext = {"Linux": ".so", "Darwin": ".dylib"}[platform.system()]
source = os.path.join(f"{extdir}", f"lib{backend}_catalyst{shared_lib_ext}")
destination = os.path.join(os.getcwd(), "build")
destination = os.path.join(os.getcwd(), self.build_temp)
josephleekl marked this conversation as resolved.
Show resolved Hide resolved
shutil.copy(source, destination)

with open(os.path.join("pennylane_lightning", "core", "_version.py"), encoding="utf-8") as f:
Expand Down
Loading