Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
AmintorDusko committed Apr 22, 2024
2 parents 0762cb1 + f4acabd commit d7c60b0
Show file tree
Hide file tree
Showing 37 changed files with 1,216 additions and 236 deletions.
21 changes: 21 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@

### Improvements

* Refactor `cuda_utils` to remove its dependency on `custatevec.h`.
[(#681)](https://github.com/PennyLaneAI/pennylane-lightning/pull/681)

* Add `test_templates.py` module where Grover and QSVT are tested.
[(#684)](https://github.com/PennyLaneAI/pennylane-lightning/pull/684)

* Create `cuda_utils` for common usage of CUDA related backends.
[(#676)](https://github.com/PennyLaneAI/pennylane-lightning/pull/676)

Expand All @@ -74,6 +80,12 @@

### Bug fixes

* `LightningQubit` correctly decomposes state prep operations when used in the middle of a circuit.
[(#687)](https://github.com/PennyLaneAI/pennylane/pull/687)

* `LightningQubit` correctly decomposes `qml.QFT` and `qml.GroverOperator` if `len(wires)` is greater than 9 and 12 respectively.
[(#687)](https://github.com/PennyLaneAI/pennylane/pull/687)

* Specify `isort` `--py` (Python version) and `-l` (max line length) to stabilize `isort` across Python versions and environments.
[(#647)](https://github.com/PennyLaneAI/pennylane-lightning/pull/647)

Expand All @@ -83,6 +95,15 @@
* `lightning.qubit` correctly decomposed state preparation operations with adjoint differentiation.
[(#661)](https://github.com/PennyLaneAI/pennylane-lightning/pull/661)

* Fix the failed observable serialization unit tests.
[(#683)](https://github.com/PennyLaneAI/pennylane-lightning/pull/683)

* Update the `LightningQubit` new device API to work with Catalyst.
[(#665)](https://github.com/PennyLaneAI/pennylane-lightning/pull/665)

* Update the version of `codecov-action` to v4 and fix the CodeCov issue with the PL-Lightning check-compatibility actions.
[(#682)](https://github.com/PennyLaneAI/pennylane-lightning/pull/682)

### Contributors

This release contains contributions from (in alphabetical order):
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/compat-check-latest-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
with:
lightning-version: latest
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lkokkos_gpu:
name: Lightning Compatibility test (tests_lkokkos_gpu) - latest/latest
uses: ./.github/workflows/tests_gpu_kokkos.yml
with:
lightning-version: latest
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lgpu_gpu:
name: Lightning Compatibility test (tests_lgpu_gpu) - latest/latest
uses: ./.github/workflows/tests_gpu_cuda.yml
with:
lightning-version: latest
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lgpu_gpu_mpi:
name: Lightning Compatibility test (tests_lgpu_gpu_mpi) - latest/latest
uses: ./.github/workflows/tests_linux_x86_mpi_gpu.yml
with:
lightning-version: latest
pennylane-version: latest
secrets: inherit # pass all secrets
tests_without_binary:
name: Lightning Compatibility test (tests_without_binary) - latest/latest
uses: ./.github/workflows/tests_without_binary.yml
with:
lightning-version: latest
pennylane-version: latest
secrets: inherit # pass all secrets
5 changes: 5 additions & 0 deletions .github/workflows/compat-check-latest-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
with:
lightning-version: latest
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lkokkos_gpu:
name: Lightning Compatibility test (tests_lkokkos_gpu) - latest/stable
uses: ./.github/workflows/tests_gpu_kokkos.yml
with:
lightning-version: latest
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lgpu_gpu:
name: Lightning Compatibility test (tests_lgpu_gpu) - latest/stable
uses: ./.github/workflows/tests_gpu_cuda.yml
with:
lightning-version: latest
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lgpu_gpu_mpi:
name: Lightning Compatibility test (tests_lgpu_gpu_mpi) - latest/stable
uses: ./.github/workflows/tests_linux_x86_mpi_gpu.yml
with:
lightning-version: latest
pennylane-version: stable
secrets: inherit # pass all secrets
tests_without_binary:
name: Lightning Compatibility test (tests_without_binary) - latest/stable
uses: ./.github/workflows/tests_without_binary.yml
with:
lightning-version: latest
pennylane-version: stable
secrets: inherit # pass all secrets
5 changes: 5 additions & 0 deletions .github/workflows/compat-check-release-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
with:
lightning-version: release
pennylane-version: release
secrets: inherit # pass all secrets
tests_lkokkos_gpu:
name: Lightning Compatibility test (tests_lkokkos_gpu) - release/release
uses: ./.github/workflows/tests_gpu_kokkos.yml
with:
lightning-version: release
pennylane-version: release
secrets: inherit # pass all secrets
tests_lgpu_gpu:
name: Lightning Compatibility test (tests_lgpu_gpu) - release/release
uses: ./.github/workflows/tests_gpu_cuda.yml
with:
lightning-version: release
pennylane-version: release
secrets: inherit # pass all secrets
tests_lgpu_gpu_mpi:
name: Lightning Compatibility test (tests_lgpu_gpu_mpi) - release/release
uses: ./.github/workflows/tests_linux_x86_mpi_gpu.yml
with:
lightning-version: release
pennylane-version: release
secrets: inherit # pass all secrets
tests_without_binary:
name: Lightning Compatibility test (tests_without_binary) - release/release
uses: ./.github/workflows/tests_without_binary.yml
with:
lightning-version: release
pennylane-version: release
secrets: inherit # pass all secrets
5 changes: 5 additions & 0 deletions .github/workflows/compat-check-stable-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
with:
lightning-version: stable
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lkokkos_gpu:
name: Lightning Compatibility test (tests_lkokkos_gpu) - stable/latest
uses: ./.github/workflows/tests_gpu_kokkos.yml
with:
lightning-version: stable
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lgpu_gpu:
name: Lightning Compatibility test (tests_lgpu_gpu) - stable/latest
uses: ./.github/workflows/tests_gpu_cuda.yml
with:
lightning-version: stable
pennylane-version: latest
secrets: inherit # pass all secrets
tests_lgpu_gpu_mpi:
name: Lightning Compatibility test (tests_lgpu_gpu_mpi) - stable/latest
uses: ./.github/workflows/tests_linux_x86_mpi_gpu.yml
with:
lightning-version: stable
pennylane-version: latest
secrets: inherit # pass all secrets
tests_without_binary:
name: Lightning Compatibility test (tests_without_binary) - stable/latest
uses: ./.github/workflows/tests_without_binary.yml
with:
lightning-version: stable
pennylane-version: latest
secrets: inherit # pass all secrets
5 changes: 5 additions & 0 deletions .github/workflows/compat-check-stable-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,32 @@ jobs:
with:
lightning-version: stable
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lkokkos_gpu:
name: Lightning Compatibility test (tests_lkokkos_gpu) - stable/stable
uses: ./.github/workflows/tests_gpu_kokkos.yml
with:
lightning-version: stable
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lgpu_gpu:
name: Lightning Compatibility test (tests_lgpu_gpu) - stable/stable
uses: ./.github/workflows/tests_gpu_cuda.yml
with:
lightning-version: stable
pennylane-version: stable
secrets: inherit # pass all secrets
tests_lgpu_gpu_mpi:
name: Lightning Compatibility test (tests_lgpu_gpu_mpi) - stable/stable
uses: ./.github/workflows/tests_linux_x86_mpi_gpu.yml
with:
lightning-version: stable
pennylane-version: stable
secrets: inherit # pass all secrets
tests_without_binary:
name: Lightning Compatibility test (tests_without_binary) - stable/stable
uses: ./.github/workflows/tests_without_binary.yml
with:
lightning-version: stable
pennylane-version: stable
secrets: inherit # pass all secrets
6 changes: 4 additions & 2 deletions .github/workflows/tests_gpu_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@ jobs:
name: ubuntu-codecov-results-python

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

upload-to-codecov-linux-cpp:
Expand All @@ -359,9 +360,10 @@ jobs:
name: ubuntu-codecov-results-cpp

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -560,10 +560,13 @@ jobs:
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests/ -k "not test_native_mcm" $COVERAGE_FLAGS
OMP_NUM_THREADS=1 PL_DEVICE=${DEVICENAME} python -m pytest -n auto tests/ -k "test_native_mcm" $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
mv .coverage .coverage-${{ github.job }}-${{ matrix.pl_backend }}
# TODO: Remove this if-cond with release v0.36.0
if [ -f tests/test_native_mcm.py ]; then
OMP_NUM_THREADS=1 PL_DEVICE=${DEVICENAME} python -m pytest -n auto tests/ -k "test_native_mcm" $COVERAGE_FLAGS --cov-append
fi
- name: Install all backend devices
if: ${{ matrix.pl_backend == 'all' }}
Expand Down Expand Up @@ -622,9 +625,10 @@ jobs:
python -m coverage xml -i -o coverage-${{ github.job }}.xml
- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

upload-to-codecov-linux-cpp:
Expand All @@ -641,9 +645,10 @@ jobs:
name: ubuntu-codecov-results-cpp

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

cpptestsWithMultipleBackends:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_linux_x86_mpi_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ jobs:
name: ubuntu-codecov-results-cpp

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
Expand All @@ -324,7 +324,7 @@ jobs:
name: ubuntu-codecov-results-python

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
verbose: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ jobs:
name: windows-coverage-report

- name: Upload to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/tests_without_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,9 @@ jobs:
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./main/coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions pennylane_lightning/core/_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ def map_wire(wire: int):

def _pauli_sentence(self, observable, wires_map: dict = None):
"""Serialize a :class:`pennylane.pauli.PauliSentence` into a Hamiltonian."""
# Trivial Pauli sentences' items is empty, cannot unpack
if not observable:
return self.hamiltonian_obs(np.array([0.0]).astype(self.rtype), [self._ob(Identity(0))])
pwords, coeffs = zip(*observable.items())
terms = [self._pauli_word(pw, wires_map) for pw in pwords]
coeffs = np.array(coeffs).astype(self.rtype)
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.36.0-dev28"
__version__ = "0.36.0-dev33"
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "MPIManager.hpp"
#include "MPI_helpers.hpp"
#include "cuError.hpp"
#include "cuStateVecError.hpp"
#include <cuda.h>
#include <cuda_runtime.h>
#include <custatevec.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "DevTag.hpp"
#include "Error.hpp"
#include "StateVectorBase.hpp"
#include "cuStateVecError.hpp"
#include "cuda_helpers.hpp"

/// @cond DEV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include "StateVectorCudaBase.hpp"
#include "cuGateCache.hpp"
#include "cuGates_host.hpp"
#include "cuStateVecError.hpp"
#include "cuStateVec_helpers.hpp"
#include "cuda_helpers.hpp"

#include "CPUMemoryModel.hpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
#include "CPUMemoryModel.hpp"

#include "cuError.hpp"
#include "cuStateVecError.hpp"
#include "cuStateVec_helpers.hpp"

#include "LinearAlg.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "Observables.hpp"
#include "ObservablesGPU.hpp"
#include "StateVectorCudaManaged.hpp"
#include "cuStateVecError.hpp"
#include "cuStateVec_helpers.hpp"
#include "cuda_helpers.hpp"

/// @cond DEV
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "ObservablesGPUMPI.hpp"
#include "StateVectorCudaMPI.hpp"
#include "StateVectorCudaManaged.hpp"
#include "cuStateVecError.hpp"
#include "cuda_helpers.hpp"

/// @cond DEV
Expand Down
Loading

0 comments on commit d7c60b0

Please sign in to comment.