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

Improve tests and checks CI/CD pipelines #353

Merged
merged 27 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9953c03
set version
AmintorDusko Sep 14, 2022
3dcbaa8
fix typo in wheel_linux_x86_64
AmintorDusko Sep 14, 2022
49f9feb
improve tests for linux performance
AmintorDusko Sep 15, 2022
0cea6c3
update benchmarks
AmintorDusko Sep 15, 2022
350f21d
set different names for tests reports
AmintorDusko Sep 15, 2022
a336727
rename cpptests
AmintorDusko Sep 15, 2022
ab9cfd9
update Ubuntu
AmintorDusko Sep 15, 2022
55a3446
improve format checks
AmintorDusko Sep 15, 2022
78547fe
reusable workflow for build and cache Kokkos
AmintorDusko Sep 15, 2022
2458974
rename reusable workflow
AmintorDusko Sep 15, 2022
b017d03
update tests for windows
AmintorDusko Sep 15, 2022
ec0b5bc
label Kokkos key as debug in tests for Win
AmintorDusko Sep 15, 2022
73ba47f
Trigger CI
AmintorDusko Sep 15, 2022
2ca099c
expicilt build type for Kokkos caching in Win Wheels
AmintorDusko Sep 15, 2022
a448ba7
set tests for ubuntu-20.04
AmintorDusko Sep 15, 2022
314cb4b
update linux runners
AmintorDusko Sep 16, 2022
93eae83
update external plugins version
AmintorDusko Sep 16, 2022
2dc5264
update build to Ninja
AmintorDusko Sep 16, 2022
3c84f9a
rectify update actions versions
AmintorDusko Sep 16, 2022
b0276a0
Merge branch 'master' into Improvement/checks_and_tests
AmintorDusko Sep 20, 2022
8490eed
Auto update version
github-actions[bot] Sep 20, 2022
fa54d38
update pennylane dependence to 0.26
AmintorDusko Sep 20, 2022
889bd8c
update changelog
AmintorDusko Sep 20, 2022
4bbb3b8
set compiler outside script
AmintorDusko Sep 20, 2022
643910e
Update .github/workflows/benchmarks.yml
AmintorDusko Sep 20, 2022
d3e54f9
Update .github/workflows/benchmarks.yml
AmintorDusko Sep 20, 2022
3ddc301
update checkout action
AmintorDusko Sep 20, 2022
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
41 changes: 22 additions & 19 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* Update clang-tools version in Github workflows.
[(#351)](https://github.com/PennyLaneAI/pennylane-lightning/pull/351)

* Improve tests and checks CI/CD pipelines.
[(#353)](https://github.com/PennyLaneAI/pennylane-lightning/pull/353)

### Documentation

### Bug fixes
Expand All @@ -17,7 +20,7 @@

This release contains contributions from (in alphabetical order):

Chae-Yeun Park
Amintor Dusko, Chae-Yeun Park

---

Expand Down Expand Up @@ -92,7 +95,7 @@ Amintor Dusko, Christina Lee, Chae-Yeun Park

### Documentation

* Updated ReadTheDocs runner version from Ubuntu 20.04 to 22.04
* Updated ReadTheDocs runner version from Ubuntu 20.04 to 22.04
[(#327)](https://github.com/PennyLaneAI/pennylane-lightning/pull/327)

### Bug fixes
Expand All @@ -118,7 +121,7 @@ Amintor Dusko, Christina Lee, Rashid N H M, Lee J. O'Riordan, Chae-Yeun Park
* Add a new dispatch mechanism for future kernels.
[(#291)](https://github.com/PennyLaneAI/pennylane-lightning/pull/291)

* Add `IsingXY` gate operation.
* Add `IsingXY` gate operation.
[(#303)](https://github.com/PennyLaneAI/pennylane-lightning/pull/303)

* Support `qml.state()` in vjp and Hamiltonian in adjoint jacobian.
Expand All @@ -137,8 +140,8 @@ Amintor Dusko, Christina Lee, Rashid N H M, Lee J. O'Riordan, Chae-Yeun Park
* Split matrix operations, refactor dispatch mechanisms, and add a benchmark suits.
[(#274)](https://github.com/PennyLaneAI/pennylane-lightning/pull/274)

* Add native support for the calculation of sparse Hamiltonians' expectation values.
Sparse operations are offloaded to [Kokkos](https://github.com/kokkos/kokkos) and
* Add native support for the calculation of sparse Hamiltonians' expectation values.
Sparse operations are offloaded to [Kokkos](https://github.com/kokkos/kokkos) and
[Kokkos-Kernels](https://github.com/kokkos/kokkos-kernels).
[(#283)](https://github.com/PennyLaneAI/pennylane-lightning/pull/283)

Expand Down Expand Up @@ -308,10 +311,10 @@ Ali Asadi, Chae-Yeun Park, Lee James O'Riordan
* `setup.py` adds debug only when --debug is given
[(#208)](https://github.com/PennyLaneAI/pennylane-lightning/pull/208)

* Add new highly-performant C++ kernels for quantum gates.
* Add new highly-performant C++ kernels for quantum gates.
[(#202)](https://github.com/PennyLaneAI/pennylane-lightning/pull/202)

The new kernels significantly improve the runtime performance of PennyLane-Lightning
The new kernels significantly improve the runtime performance of PennyLane-Lightning
for both differentiable and non-differentiable workflows. Here is an example workflow
using the adjoint differentiation method with a circuit of 5 strongly entangling layers:

Expand Down Expand Up @@ -488,22 +491,22 @@ Ali Asadi, Lee James O'Riordan
* PennyLane-Lightning now provides a high-performance
[adjoint Jacobian](http://arxiv.org/abs/2009.02823) method for differentiating quantum circuits.
[(#136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)

The adjoint method operates after a forward pass by iteratively applying inverse gates to scan
backwards through the circuit. The method is already available in PennyLane's
`default.qubit` device, but the version provided by `lightning.qubit` integrates with the C++
backend and is more performant, as shown in the plot below:

<img src="https://raw.githubusercontent.com/PennyLaneAI/pennylane-lightning/master/doc/_static/lightning_adjoint.png" width=70%/>

The plot compares the average runtime of `lightning.qubit` and `default.qubit` for calculating the
Jacobian of a circuit using the adjoint method for a range of qubit numbers. The circuit
consists of ten `BasicEntanglerLayers` with a `PauliZ` expectation value calculated on each wire,
repeated over ten runs. We see that `lightning.qubit` provides a speedup of around two to eight
times, depending on the number of qubits.

The adjoint method can be accessed using the standard interface. Consider the following circuit:

```python
import pennylane as qml

Expand All @@ -518,9 +521,9 @@ Ali Asadi, Lee James O'Riordan

weights = qml.init.strong_ent_layers_normal(layers, wires, seed=1967)
```

The circuit can be executed and its gradient calculated using:

```pycon
>>> print(f"Circuit evaluated: {circuit(weights)}")
Circuit evaluated: 0.9801286266677633
Expand All @@ -532,19 +535,19 @@ Ali Asadi, Lee James O'Riordan

[[-1.14472273e-04 3.85963953e-02 0.00000000e+00]
[-5.76791765e-05 -9.78478343e-02 0.00000000e+00]
[-5.55111512e-17 0.00000000e+00 -1.11022302e-16]]]
[-5.55111512e-17 0.00000000e+00 -1.11022302e-16]]]
```

* PennyLane-Lightning now supports all of the operations and observables of `default.qubit`.
[(#124)](https://github.com/PennyLaneAI/pennylane-lightning/pull/124)

### Improvements

* A new state-vector class `StateVectorManaged` was added, enabling memory use to be bound to
* A new state-vector class `StateVectorManaged` was added, enabling memory use to be bound to
statevector lifetime.
[(#136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)

* The repository now has a well-defined component hierarchy, allowing each indepedent unit to be
* The repository now has a well-defined component hierarchy, allowing each indepedent unit to be
compiled and linked separately.
[(#136)](https://github.com/PennyLaneAI/pennylane-lightning/pull/136)

Expand Down Expand Up @@ -601,20 +604,20 @@ Thomas Bromley, Lee James O'Riordan
* The PennyLane device test suite is now included in coverage reports.
[(#123)](https://github.com/PennyLaneAI/pennylane-lightning/pull/123)

* Static versions of jQuery and Bootstrap are no longer included in the CSS theme.
* Static versions of jQuery and Bootstrap are no longer included in the CSS theme.
[(#118)](https://github.com/PennyLaneAI/pennylane-lightning/pull/118)

* C++ tests have been ported to use Catch2 framework.
[(#115)](https://github.com/PennyLaneAI/pennylane-lightning/pull/115)

* Testing now exists for both float and double precision methods in C++ layer.
* Testing now exists for both float and double precision methods in C++ layer.
[(#113)](https://github.com/PennyLaneAI/pennylane-lightning/pull/113)
[(#115)](https://github.com/PennyLaneAI/pennylane-lightning/pull/115)

* Compile-time utility methods with `constexpr` have been added.
[(#113)](https://github.com/PennyLaneAI/pennylane-lightning/pull/113)

* Wheel-build support for ARM64 (Linux and MacOS) and PowerPC (Linux) added.
* Wheel-build support for ARM64 (Linux and MacOS) and PowerPC (Linux) added.
[(#110)](https://github.com/PennyLaneAI/pennylane-lightning/pull/110)

* Add support for Controlled Phase Gate (`ControlledPhaseShift`).
Expand Down
82 changes: 22 additions & 60 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,83 +1,45 @@
name: Benchmarking
on:
pull_request:
push:
branches:
- master

env:
GCC_VERSION: 10

jobs:
benchmarks:
name: Gate benchmarks
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-22.04]

steps:
name: Gate benchmarks
runs-on: ${{ matrix.os }}

- name: Checkout PennyLane-Lightning master
uses: actions/checkout@v2
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.10.0
with:
ref: master
path: main
access_token: ${{ github.token }}

- name: Checkout PennyLane-Lightning
uses: actions/checkout@v3

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.7'

- name: Install dependencies
run: sudo apt-get -y -q install cmake gcc

- name: Get required Python packages
run: |
cd main
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install matplotlib

- name: Install lightning.qubit device (master)
run: |
cd main
python3 setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-10)"
pip install -e .

- name: Benchmark lightning master device
run: |
cd main
python .github/workflows/benchmarks/run_bench.py lightning.qubit lightning_master.json
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-10 g++-10 ninja-build libopenblas-dev

- name: Benchmark default qubit device
- name: Build GBenchmark
run: |
cd main
python .github/workflows/benchmarks/run_bench.py default.qubit default_qubit.json
cmake pennylane_lightning/src/ -BBuildGBench -DBUILD_BENCHMARKS=ON -DENABLE_BLAS=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER="$(which g++-$GCC_VERSION)" -G Ninja
cmake --build ./BuildGBench --parallel 2

- name: Checkout PennyLane-Lightning PR
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
path: pr

- name: Install lightning.qubit device (PR)
- name: Run GBenchmark
run: |
cd main
make clean || true
pip uninstall pennylane-lightning -y
cd ../pr
python3 setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-10)"
pip install -e .

- name: Benchmark lightning PR device
run: |
cd pr
python .github/workflows/benchmarks/run_bench.py lightning.qubit lightning_pr.json
mv lightning_pr.json ../main

- name: Plot results
run: |
cd main
python .github/workflows/benchmarks/plot_results.py

- uses: actions/upload-artifact@v2
with:
name: gates.png
path: ./main/gates.png
./BuildGBench/benchmarks/utils
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
./BuildGBench/benchmarks/apply_operations
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
AmintorDusko marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 0 additions & 15 deletions .github/workflows/benchmarks/parameters.py

This file was deleted.

98 changes: 0 additions & 98 deletions .github/workflows/benchmarks/plot_results.py

This file was deleted.

Loading