Skip to content

Commit

Permalink
Merge branch 'master' into lk-control
Browse files Browse the repository at this point in the history
  • Loading branch information
josephleekl authored Oct 17, 2024
2 parents 1c50fc6 + 7c43ed6 commit 6b8ffa5
Show file tree
Hide file tree
Showing 77 changed files with 3,143 additions and 2,293 deletions.
35 changes: 34 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

### New features since last release

* Add `mid-circuit measurements` support to `lightning.gpu`'s single-GPU backend.
[(#931)](https://github.com/PennyLaneAI/pennylane-lightning/pull/931)

* Add Matrix Product Operator (MPO) for all gates support to `lightning.tensor`. Note current C++ implementation only works for MPO sites data provided by users.
[(#859)](https://github.com/PennyLaneAI/pennylane-lightning/pull/859)

Expand All @@ -21,8 +24,14 @@
* Lightning-Kokkos migrated to the new device API.
[(#810)](https://github.com/PennyLaneAI/pennylane-lightning/pull/810)

* Lightning-GPU migrated to the new device API.
[(#853)](https://github.com/PennyLaneAI/pennylane-lightning/pull/853)

### Breaking changes

* Deprecate `initSV()` and add `resetStateVector()` to `lightning.gpu`.
[(#933)](https://github.com/PennyLaneAI/pennylane-lightning/pull/933)

* Deprecate PI gates implementation.
[(#925)](https://github.com/PennyLaneAI/pennylane-lightning/pull/925)

Expand All @@ -37,6 +46,21 @@

### Improvements

* Optimize the cartesian product to reduce the amount of memory necessary to set the StatePrep with LightningTensor.
[(#943)](https://github.com/PennyLaneAI/pennylane-lightning/pull/943)

* The `prob` data return `lightning.gpu` C++ layer is aligned with other state-vector backends and `lightning.gpu` supports out-of-order `qml.prob`.
[(#941)](https://github.com/PennyLaneAI/pennylane-lightning/pull/941)

* Add `setStateVector(state, wire)` support to the `lightning.gpu` C++ layer.
[(#930)](https://github.com/PennyLaneAI/pennylane-lightning/pull/930)

* Add zero-state initialization to both `StateVectorCudaManaged` and `StateVectorCudaMPI` constructors to remove the `reset_state` in the python layer ctor and refactor `setBasisState(state, wires)` in the C++ layer.
[(#933)](https://github.com/PennyLaneAI/pennylane-lightning/pull/933)

* The `generate_samples` methods of lightning.{qubit/kokkos} can now take in a seed number to make the generated samples deterministic. This can be useful when, among other things, fixing flaky tests in CI.
[(#927)](https://github.com/PennyLaneAI/pennylane-lightning/pull/927)

* Always decompose `qml.QFT` in Lightning.
[(#924)](https://github.com/PennyLaneAI/pennylane-lightning/pull/924)

Expand Down Expand Up @@ -95,6 +119,15 @@

### Bug fixes

* Fix missing `liblightning_kokkos_catalyst.so` in Lightning-Kokkos editable installation.
[(#945)](https://github.com/PennyLaneAI/pennylane-lightning/pull/945)

* Add concept restriction to ensure `ConstMult` inline function only hit with arithmetic-values times complex values. Fixes build failures with the test suite when enabling OpenMP, and disabling BLAS and Python under clang.
[(#936)](https://github.com/PennyLaneAI/pennylane-lightning/pull/936)

* Bug fix for `applyMatrix` in `lightning.tensor`. Matrix operator data is not stored in the `cuGateCache` object to support `TensorProd` obs with multiple `Hermitian` obs.
[(#932)](https://github.com/PennyLaneAI/pennylane-lightning/pull/932)

* Bug fix for `_pauli_word` of `QuantumScriptSerializer`. `_pauli_word` can process `PauliWord` object: `I`.
[(#919)](https://github.com/PennyLaneAI/pennylane-lightning/pull/919)

Expand All @@ -105,7 +138,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
Ali Asadi, Amintor Dusko, Luis Alfredo Nuñez Meneses, Vincent Michaud-Rioux, Lee J. O'Riordan, Mudit Pandey, Shuli Shu, Haochen Paul Wang

---

Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/wheel_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,13 @@ jobs:
mkdir Kokkos
cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/
- name: Install Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: python -m pip install cibuildwheel~=2.20.0 tomlkit
run: python3.10 -m pip install cibuildwheel~=2.20.0 tomlkit

- name: Configure pyproject.toml file
run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/wheel_linux_aarch64_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ jobs:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v4

- name: Install Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel~=2.20.0 tomlkit
run: python3.10 -m pip install cibuildwheel~=2.20.0 tomlkit

- name: Configure pyproject.toml file
run: PL_BACKEND="${{ matrix.pl_backend }}" python scripts/configure_pyproject_toml.py
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/wheel_noarch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ jobs:
if: ${{ matrix.pl_backend == 'lightning_qubit'}}
uses: actions/checkout@v4


- uses: actions/setup-python@v5
if: ${{ matrix.pl_backend == 'lightning_qubit'}}
with:
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include cmake/*
include requirements.txt
include .github/CHANGELOG.md
include pennylane_lightning/lightning_qubit/lightning_qubit.toml
include pennylane_lightning/lightning_qpu/lightning_gpu.toml
include pennylane_lightning/lightning_gpu/lightning_gpu.toml
include pennylane_lightning/lightning_kokkos/lightning_kokkos.toml
include pennylane_lightning/core/_version.py
graft pennylane_lightning/core/src/
27 changes: 25 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ help:
@echo " test-cpp [verbose=1] to run the C++ test suite (requires CMake)"
@echo " use with 'verbose=1' for building with verbose flag"
@echo " test-cpp [target=?] to run a specific C++ test target (requires CMake)."
@echo " test-cpp-mpi [backend=?] to run the C++ test suite with MPI (requires CMake and MPI)"
@echo " Default: lightning_gpu"
@echo " test-python [device=?] to run the Python test suite"
@echo " Default: lightning.qubit"
@echo " wheel [backend=?] to configure and build Python wheels
@echo " wheel [backend=?] to configure and build Python wheels"
@echo " Default: lightning_qubit"
@echo " coverage [device=?] to generate a coverage report for python interface"
@echo " Default: lightning.qubit"
Expand Down Expand Up @@ -98,7 +100,7 @@ coverage-cpp:
lcov --directory . -b ../pennylane_lightning/core/src/ --capture --output-file coverage.info; \
genhtml coverage.info --output-directory out

.PHONY: test-python test-builtin test-suite test-cpp
.PHONY: test-python test-builtin test-suite test-cpp test-cpp-mpi
test-python: test-builtin test-suite

test-builtin:
Expand All @@ -124,6 +126,27 @@ else
cmake --build ./BuildTests $(VERBOSE) --target test
endif

test-cpp-mpi:
rm -rf ./BuildTests
cmake -BBuildTests -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DENABLE_WARNINGS=ON \
-DPL_BACKEND=lightning_gpu \
-DENABLE_MPI=ON \
$(OPTIONS)
ifdef target
cmake --build ./BuildTests $(VERBOSE) --target $(target)
mpirun -np 2 ./BuildTests/$(target)
else
cmake --build ./BuildTests $(VERBOSE)
for file in ./BuildTests/*_test_runner_mpi; do \
echo "Running $$file"; \
mpirun -np 2 $$file ; \
done
endif


.PHONY: format format-cpp format-python
format: format-cpp format-python

Expand Down
7 changes: 5 additions & 2 deletions doc/lightning_gpu/device.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ A ``lightning.gpu`` device can be loaded using:
import pennylane as qml
dev = qml.device("lightning.gpu", wires=2)
If the NVIDIA cuQuantum libraries are available, the above device will allow all operations to be performed on a CUDA capable GPU of generation SM 7.0 (Volta) and greater. If the libraries are not correctly installed, or available on path, the device will fall-back to ``lightning.qubit`` and perform all simulation on the CPU.
If the NVIDIA cuQuantum libraries are available, the above device will allow all operations to be performed on a CUDA capable GPU of generation SM 7.0 (Volta) and greater. If the libraries are not correctly installed, or available on path, the device will raise an error.

The ``lightning.gpu`` device also directly supports quantum circuit gradients using the adjoint differentiation method. This can be enabled at the PennyLane QNode level with:
The ``lightning.gpu`` device supports quantum circuit gradients using the adjoint differentiation method by default. This can be enabled at the PennyLane QNode level with:

.. code-block:: python
Expand Down Expand Up @@ -281,3 +281,6 @@ To enable the memory-optimized adjoint method with MPI support, ``batch_obs`` sh
dev = qml.device('lightning.gpu', wires= n_wires, mpi=True, batch_obs=True)
For the adjoint method, each MPI process will provide the overall simulation results.

.. note::
The observable ``Projector``` does not have support with the multi-GPU backend.
7 changes: 7 additions & 0 deletions mpitests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def get_device():
# Device specification
if device_name == "lightning.gpu":
from pennylane_lightning.lightning_gpu import LightningGPU as LightningDevice
from pennylane_lightning.lightning_gpu._measurements import (
LightningGPUMeasurements as LightningMeasurements,
)
from pennylane_lightning.lightning_gpu._state_vector import (
LightningGPUStateVector as LightningStateVector,
)

else:
raise qml.DeviceError(f"The MPI tests do not apply to the {device_name} device.")

Expand Down
Loading

0 comments on commit 6b8ffa5

Please sign in to comment.