Skip to content

Commit

Permalink
Add Python CUDA dependencies as Lightning-GPU and Lightning-Tensor wh…
Browse files Browse the repository at this point in the history
…eel dependencies (#1025)

### Before submitting

Please complete the following checklist when submitting a PR:

- [ ] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      [`tests`](../tests) directory!

- [ ] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [ ] Ensure that the test suite passes, by running `make test`.

- [X] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [ ] Ensure that code is properly formatted by running `make format`. 

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


------------------------------------------------------------------------------------------------------------

**Context:**

**Description of the Change:**
Added all [Python CUDA
dependencies](https://github.com/PennyLaneAI/pennylane-lightning/blob/954a6e7d12befc043597769c6357a1003e8d588b/bin/auditwheel)
to `pyproject.toml` for LGPU and LT. `INSTALL_RPATH` updated in CMake
files.

**Benefits:**

**Possible Drawbacks:**

**Related GitHub Issues:**


[sc-79647]

---------

Co-authored-by: ringo-but-quantum <[email protected]>
Co-authored-by: Shuli Shu <[email protected]>
  • Loading branch information
3 people authored Jan 3, 2025
1 parent 87bcd10 commit d8461f3
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
7 changes: 5 additions & 2 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

### Improvements

* Optimize lightning.tensor by adding direct MPS sites data set with `qml.MPSPrep`.
[(#983)](https://github.com/PennyLaneAI/pennylane-lightning/pull/983)
* Add CUDA dependencies to Lightning GPU and Lightning Tensor Python wheels.
[(#1025)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1025/)

* Replace the `dummy_tensor_update` method with the `cutensornetStateCaptureMPS`API to ensure that further gates apply is allowed after the `cutensornetStateCompute` call.
[(#1028)](https://github.com/PennyLaneAI/pennylane-lightning/pull/1028/)
Expand Down Expand Up @@ -85,6 +85,9 @@
* The TOML files for the devices are updated to use the new schema for declaring device capabilities.
[(#988)](https://github.com/PennyLaneAI/pennylane-lightning/pull/988)

* Optimize lightning.tensor by adding direct MPS sites data set with `qml.MPSPrep`.
[(#983)](https://github.com/PennyLaneAI/pennylane-lightning/pull/983)

* Unify excitation gates memory layout to row-major for both LGPU and LT.
[(#959)](https://github.com/PennyLaneAI/pennylane-lightning/pull/959)

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lgpumpi_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
mpilib: ["mpich", "openmpi"]
cuda_version_maj: ["12"]
cuda_version_min: ["2"]
timeout-minutes: 30
timeout-minutes: 35

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.40.0-dev42"
__version__ = "0.40.0-dev43"
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ set_property(TARGET ${PL_BACKEND} PROPERTY POSITION_INDEPENDENT_CODE ON)

# To avoid DSO errors on platforms preferring static linkage, uncomment the following line:
# string(REPLACE "libcudart_static.a" "libcudart.so" CUDA_SHARED_RT "${CUDA_LIBRARIES}")
set_target_properties(${PL_BACKEND} PROPERTIES INSTALL_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/")
set_target_properties(${PL_BACKEND} PROPERTIES INSTALL_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/../nvidia/cublas/lib:$ORIGIN/../nvidia/cusparse/lib:$ORIGIN/../nvidia/nvjitlink/lib:$ORIGIN/../nvidia/cuda_runtime/lib:$ORIGIN/")

if(PL_DISABLE_CUDA_SAFETY)
target_compile_options(${PL_BACKEND} INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-DCUDA_UNSAFE>)
Expand All @@ -87,4 +87,4 @@ endforeach()
if (BUILD_TESTS)
enable_testing()
add_subdirectory("tests")
endif()
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set_property(TARGET ${PL_BACKEND} PROPERTY POSITION_INDEPENDENT_CODE ON)

# To avoid DSO errors on platforms preferring static linkage, uncomment the following line:
# string(REPLACE "libcudart_static.a" "libcudart.so" CUDA_SHARED_RT "${CUDA_LIBRARIES}")
set_target_properties(${PL_BACKEND} PROPERTIES INSTALL_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/")
set_target_properties(${PL_BACKEND} PROPERTIES INSTALL_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/../nvidia/cublas/lib:$ORIGIN/../nvidia/cusparse/lib:$ORIGIN/../cutensor/lib:$ORIGIN/../nvidia/nvjitlink/lib:$ORIGIN/../nvidia/cusolver/lib:$ORIGIN/../nvidia/cuda_runtime/lib:$ORIGIN/")

if(PL_DISABLE_CUDA_SAFETY)
target_compile_options(${PL_BACKEND} INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-DCUDA_UNSAFE>)
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ isort==5.13.2
click==8.0.4
cmake
jax[cpu]==0.4.28
custatevec-cu12
cutensornet-cu12
custatevec-cu12; sys_platform == "linux"
cutensornet-cu12; sys_platform == "linux"
pylint==2.7.4
scipy-openblas32>=0.3.26
git+https://github.com/PennyLaneAI/pennylane.git@master
14 changes: 14 additions & 0 deletions scripts/configure_pyproject_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,20 @@ def parse_args():
"scipy-openblas32>=0.3.26",
]

if backend == "lightning_gpu":
dependencies += ["custatevec-cu12"]

if backend == "lightning_tensor":
dependencies += ["cutensornet-cu12", "nvidia-cusolver-cu12"]

if backend in ("lightning_gpu", "lightning_tensor"):
dependencies += [
"nvidia-nvjitlink-cu12",
"nvidia-cusparse-cu12",
"nvidia-cublas-cu12",
"nvidia-cuda-runtime-cu12",
]

if backend != "lightning_qubit":
dependencies += ["pennylane_lightning==" + version]

Expand Down

0 comments on commit d8461f3

Please sign in to comment.