Skip to content

Commit

Permalink
Fix RPATH in pybind11 module for 0.33 (#543)
Browse files Browse the repository at this point in the history
* Ensure RPATH isn't stripped away from python module for L-GPU

* Move RPATH settings to pybind11 module level definition

* Update changelog

* Enable CI for RC PR

* Lower PL version to 0.33 from master in req

* Remove CUQUANTUM_SDK env var to validate RPATH in LGPU builds

* Migrate PL 0.33.0-rc to 0.33 in tests

* Revert wheel cache for validation
  • Loading branch information
mlxd authored Nov 1, 2023
1 parent 6c6d29c commit 7e5c3d0
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 17 deletions.
20 changes: 20 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Release 0.33.1

### New features since last release

* pip-installed CUDA runtime libraries can now be accessed from a virtualenv.
[(#543)](https://github.com/PennyLaneAI/pennylane-lightning/pull/543)

### Bug fixes

* The pybind11 compiled module RPATH linkage has been restored to pre-0.33 behaviour.
[(#543)](https://github.com/PennyLaneAI/pennylane-lightning/pull/543)

### Contributors

This release contains contributions from (in alphabetical order):

Lee J. O'Riordan

---

# Release 0.33.0

### New features since last release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: |
python -m pip install git+https://github.com/PennyLaneAI/[email protected]-rc0
python -m pip install git+https://github.com/PennyLaneAI/[email protected]
if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv; fi
CIBW_TEST_COMMAND: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: |
python -m pip install git+https://github.com/PennyLaneAI/[email protected]-rc0
python -m pip install git+https://github.com/PennyLaneAI/[email protected]
if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv; fi
CIBW_TEST_COMMAND: |
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/wheel_linux_x86_64_cu11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ jobs:
# ensure nvcc is available
CIBW_ENVIRONMENT: |
PATH=$PATH:/usr/local/cuda/bin \
CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')") \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:$CUQUANTUM_SDK \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 \
PL_BACKEND="${{ matrix.pl_backend }}"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "./bin/auditwheel repair -w {dest_dir} {wheel}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel_macos_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: |
python -m pip install git+https://github.com/PennyLaneAI/[email protected]-rc0
python -m pip install git+https://github.com/PennyLaneAI/[email protected]
if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv; fi
CIBW_TEST_COMMAND: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: |
python -m pip install git+https://github.com/PennyLaneAI/[email protected]-rc0
python -m pip install git+https://github.com/PennyLaneAI/[email protected]
if ${{ matrix.pl_backend == 'lightning_kokkos'}}; then SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" pip install -e . -vv; fi
CIBW_TEST_COMMAND: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheel_win_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ jobs:
CIBW_TEST_REQUIRES: pytest pytest-cov pytest-mock flaky

CIBW_BEFORE_TEST: |
python -m pip install git+https://github.com/PennyLaneAI/[email protected]-rc0
python -m pip install git+https://github.com/PennyLaneAI/[email protected]
CIBW_TEST_COMMAND: |
pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ if(ENABLE_PYTHON)
message(STATUS "ENABLE_PYTHON is ON.")
pybind11_add_module("${PL_BACKEND}_ops" "pennylane_lightning/core/src/bindings/Bindings.cpp")

# Allow pip installation of cuQuantum & CUDA 11 libs to be accessible without setting LD_LIBRARY_PATH for lightning_gpu
if("${PL_BACKEND}" STREQUAL "lightning_gpu")
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
set_target_properties("${PL_BACKEND}_ops" PROPERTIES BUILD_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../nvidia/cuda_runtime/lib:$ORIGIN/../nvidia/cublas/lib:$ORIGIN/../nvidia/cusparse/lib:$ORIGIN")
endif()

target_link_libraries("${PL_BACKEND}_ops" PRIVATE lightning_compile_options
lightning_external_libs
)
Expand All @@ -138,7 +144,6 @@ if(ENABLE_PYTHON)
)

set_target_properties("${PL_BACKEND}_ops" PROPERTIES CXX_VISIBILITY_PRESET hidden)

target_compile_definitions("${PL_BACKEND}_ops" PRIVATE VERSION_INFO=${VERSION_STRING})
endif()

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.33.0"
__version__ = "0.33.1-rc0"
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Ensure the libraries can see additional libs at same level;
# Required for external deps when loading in Python
set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/")
set(CMAKE_INSTALL_RPATH "$ORIGIN/../cuquantum/lib:$ORIGIN/../cuquantum/lib64:$ORIGIN/")

#########################
## Set Default Options ##
#########################
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pip==23.0
git+https://github.com/PennyLaneAI/pennylane.git@master
git+https://github.com/PennyLaneAI/pennylane.git@v0.33.0
ninja
flaky
pybind11
Expand Down

0 comments on commit 7e5c3d0

Please sign in to comment.