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

Add Hermitian support for shot-noise & LAPACK linking #569

Merged
merged 255 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
255 commits
Select commit Hold shift + click to select a range
b3a21d1
add MPI support
multiphaseCFD Nov 9, 2023
62b3714
add samples_to_counts to measurement base class
multiphaseCFD Nov 9, 2023
05cfb89
tidy up tests
multiphaseCFD Nov 9, 2023
ddfdb72
move tests to measurement base
multiphaseCFD Nov 9, 2023
44df765
move mpi tests to measurement base class
multiphaseCFD Nov 9, 2023
b3931e9
make format
multiphaseCFD Nov 9, 2023
3a52184
add python layer
multiphaseCFD Nov 10, 2023
d714e0e
add mpi tests
multiphaseCFD Nov 10, 2023
9d1a418
remove else
multiphaseCFD Nov 10, 2023
d9d7a7d
add tensor product support
multiphaseCFD Nov 12, 2023
5745f4f
add more tests for tensor prod obs shots
multiphaseCFD Nov 12, 2023
bcb46d1
make format
multiphaseCFD Nov 12, 2023
68f2865
add Hamiltonian support
multiphaseCFD Nov 14, 2023
bc58332
make format
multiphaseCFD Nov 14, 2023
5288491
quick fix
multiphaseCFD Nov 14, 2023
c7f5ea2
add hamiltonian tests
multiphaseCFD Nov 14, 2023
4b56805
add more py tests for tensorprod
multiphaseCFD Nov 14, 2023
f09342f
remove changes made in py layer
multiphaseCFD Nov 15, 2023
d13e9f2
revert more changes in py layer
multiphaseCFD Nov 15, 2023
9ef8dac
tidy up code
multiphaseCFD Nov 15, 2023
bd8fd5a
update measurement base and kokkos
multiphaseCFD Nov 15, 2023
15d8244
make format
multiphaseCFD Nov 15, 2023
1bc196f
refactor and add _sample_state method
multiphaseCFD Nov 15, 2023
e5b64a0
for loop sum to accumulate sum
multiphaseCFD Nov 15, 2023
6fda049
refactor and add _preprocess_state() method
multiphaseCFD Nov 15, 2023
2949500
add more unit tests for LK backend
multiphaseCFD Nov 16, 2023
70637dc
Merge branch 'master' into add_shot_expval
multiphaseCFD Nov 16, 2023
2cbd160
Auto update version
github-actions[bot] Nov 16, 2023
5595a8a
tidy up docstring
multiphaseCFD Nov 16, 2023
d41f2b2
remove samples() and samples2counts method
multiphaseCFD Nov 16, 2023
ebf80f0
fix typo
multiphaseCFD Nov 16, 2023
3238a08
quick fix
multiphaseCFD Nov 16, 2023
35065d1
update LQRaw object creation
multiphaseCFD Nov 16, 2023
264481f
fix for multiple backends
multiphaseCFD Nov 16, 2023
2d3cf11
update format
multiphaseCFD Nov 16, 2023
b12885d
format fix
multiphaseCFD Nov 16, 2023
ad1e11d
format update
multiphaseCFD Nov 16, 2023
288e01e
make format & trigger MPI CI
multiphaseCFD Nov 16, 2023
e08cb85
add changelog and codecov for expval(obs) method
multiphaseCFD Nov 16, 2023
2e495db
add shot_range coverage
multiphaseCFD Nov 16, 2023
0acc096
tidy up code
multiphaseCFD Nov 16, 2023
4f5f634
add more unit tests
multiphaseCFD Nov 16, 2023
fe042f6
fix typos
multiphaseCFD Nov 16, 2023
06ecd06
add MPI Hamiltonian tests for shots
multiphaseCFD Nov 17, 2023
602f16c
add HamBase tests for applyInPlaceShots
multiphaseCFD Nov 17, 2023
e839cf2
update based on comments
multiphaseCFD Nov 17, 2023
7408813
add more unit tests
multiphaseCFD Nov 17, 2023
00be785
move tests for non-distributed backends to base
multiphaseCFD Nov 17, 2023
6c4dfbd
move all unit tests into the base class
multiphaseCFD Nov 17, 2023
0d07d9c
move getTotalNumQubits to base and tidy up code
multiphaseCFD Nov 17, 2023
055d6b3
tidy up code
multiphaseCFD Nov 17, 2023
1a92ebf
revert changes in Test_MeasurementLQ
multiphaseCFD Nov 17, 2023
2c29713
initial commit
multiphaseCFD Nov 17, 2023
42ab1cc
tidy up code
multiphaseCFD Nov 17, 2023
6a5c5fe
Merge branch 'master' into add_sample_prob_var_obs
multiphaseCFD Nov 17, 2023
92571cb
Auto update version
github-actions[bot] Nov 17, 2023
77cba24
add var obs tests
multiphaseCFD Nov 18, 2023
ecf4683
add tests for prob for all backend and var for MPI
multiphaseCFD Nov 20, 2023
38748b3
quick fix
multiphaseCFD Nov 20, 2023
e3bb395
add unit tests for counts & samples obs
multiphaseCFD Nov 20, 2023
0ee73cb
add more sample() & counts() unit tests
multiphaseCFD Nov 20, 2023
531f386
add sample counts tests for mpi backend
multiphaseCFD Nov 20, 2023
e23a349
make format
multiphaseCFD Nov 20, 2023
a8cb9bc
Trigger MPI CI
multiphaseCFD Nov 20, 2023
f2c7923
tidy up code
multiphaseCFD Nov 21, 2023
17539d9
add changelogs and tidy up unit tests
multiphaseCFD Nov 21, 2023
b42d42d
update docstring
multiphaseCFD Nov 21, 2023
674dc8c
fix typo
multiphaseCFD Nov 21, 2023
3f70c2a
update return type of counts & tidy up code
multiphaseCFD Nov 24, 2023
ac4cb28
Merge branch 'master' into add_sample_prob_var_obs
multiphaseCFD Nov 24, 2023
70b208d
Auto update version
github-actions[bot] Nov 24, 2023
20366b9
update brief of probs(obs)
multiphaseCFD Nov 24, 2023
7101e5f
update based on comments
multiphaseCFD Nov 28, 2023
76317e1
fix typo
multiphaseCFD Nov 28, 2023
90cfaf6
initial commit
multiphaseCFD Nov 28, 2023
4ab2f5f
update unit tests
multiphaseCFD Nov 28, 2023
6a761fa
add unit tests
multiphaseCFD Nov 28, 2023
3bfc746
add changelog
multiphaseCFD Nov 28, 2023
a44bafd
fix typo
multiphaseCFD Nov 28, 2023
0fa1e6a
Merge branch 'master' into prob_shots
multiphaseCFD Nov 29, 2023
7f9989a
Auto update version
github-actions[bot] Nov 29, 2023
dd03e0a
fix typo
multiphaseCFD Nov 29, 2023
07928df
debug ci actions
multiphaseCFD Nov 29, 2023
fb2e1e1
set -x
vincentmr Nov 29, 2023
4b30ff0
revert serial tests
multiphaseCFD Nov 29, 2023
dbd0c30
fix typo
multiphaseCFD Nov 29, 2023
e037106
quick fix for ci failures
multiphaseCFD Nov 29, 2023
94c408e
unit tests fix
multiphaseCFD Nov 29, 2023
b30d569
test
multiphaseCFD Nov 29, 2023
fb7f297
update unit tests
multiphaseCFD Nov 29, 2023
139a9cc
fix unit tests
multiphaseCFD Nov 29, 2023
4f0e885
make format
multiphaseCFD Nov 29, 2023
4186222
quick fix reset unit test margin
multiphaseCFD Nov 29, 2023
fbb557d
fix for mpi unit tests
multiphaseCFD Nov 29, 2023
e009812
add sub-system prob with noise
multiphaseCFD Nov 30, 2023
248c225
quick fix
multiphaseCFD Nov 30, 2023
c2d515c
update changelog
multiphaseCFD Nov 30, 2023
2697e08
quick fix for mpi unit tests
multiphaseCFD Nov 30, 2023
8caf703
quick fix
multiphaseCFD Nov 30, 2023
00a30e9
quick test for LGPU backend
multiphaseCFD Nov 30, 2023
e7dd2ed
unit tests debug
multiphaseCFD Nov 30, 2023
76e4cc8
remove commented lines
multiphaseCFD Nov 30, 2023
d57c30a
quick fix
multiphaseCFD Nov 30, 2023
aab13c7
quick fix for mpi unit tests
multiphaseCFD Nov 30, 2023
83e996f
update ci
multiphaseCFD Nov 30, 2023
41a4b85
unify unit tests for all serial backends
multiphaseCFD Nov 30, 2023
5a11c17
tidy up code
multiphaseCFD Nov 30, 2023
9bdc9b0
Add arbitary eigenvalues support
multiphaseCFD Dec 1, 2023
c7998c4
Merge branch 'master' into refactor_obs_base
multiphaseCFD Dec 5, 2023
83ecb84
remove redefined prob methods
multiphaseCFD Dec 5, 2023
273ea7e
add hermitian support
multiphaseCFD Dec 5, 2023
4646b16
Auto update version
github-actions[bot] Dec 5, 2023
bb37e79
Refactor obs base and safer LQRaw call for measurement shots (#570)
multiphaseCFD Dec 6, 2023
beea863
Do not run cpp tests on schedule (compat tests). (#571)
vincentmr Dec 6, 2023
2f91767
Merge master
multiphaseCFD Dec 6, 2023
0c11461
Auto update version
github-actions[bot] Dec 6, 2023
77a506d
add Hermitian obs test
multiphaseCFD Dec 8, 2023
3b1c2c2
cmake script for cray system
multiphaseCFD Dec 9, 2023
810ea46
Merge branch 'master' into refactor_obs_base
multiphaseCFD Dec 11, 2023
8bd3e62
Auto update version
github-actions[bot] Dec 11, 2023
8495968
Merge branch 'master' into refactor_obs_base
multiphaseCFD Dec 25, 2023
53ba747
Auto update version
github-actions[bot] Dec 25, 2023
58cec11
build lapacke from scratch
multiphaseCFD Dec 29, 2023
f47e1df
add conditional compilation for hermitian diagonal
multiphaseCFD Dec 29, 2023
2c4e9e5
static->shared
multiphaseCFD Dec 29, 2023
b66dcbd
test msvc lapacke build
multiphaseCFD Dec 29, 2023
e84a510
test linux
multiphaseCFD Dec 29, 2023
7a483fa
remove ninja in ci build
multiphaseCFD Dec 29, 2023
ee4ab7b
update lib file dir in linux ci
multiphaseCFD Dec 29, 2023
690e2d7
quick fix
multiphaseCFD Dec 29, 2023
0390090
quick test
multiphaseCFD Dec 29, 2023
11fe1ca
quick test
multiphaseCFD Dec 29, 2023
d4f8dfa
update cmake
multiphaseCFD Jan 1, 2024
1139976
test msvc
multiphaseCFD Jan 1, 2024
1774dd0
fix windows ci syntax error
multiphaseCFD Jan 1, 2024
7f664dc
update gfortran install
multiphaseCFD Jan 1, 2024
befe9e2
quick fix
multiphaseCFD Jan 1, 2024
e004cd5
quick fix
multiphaseCFD Jan 1, 2024
2cff596
another tests
multiphaseCFD Jan 1, 2024
aa8530f
add path
multiphaseCFD Jan 1, 2024
2ec0cc7
windows yml debug
multiphaseCFD Jan 1, 2024
fb0ff22
windows debug
multiphaseCFD Jan 1, 2024
bd3b360
win32 test
multiphaseCFD Jan 2, 2024
96871d4
Auto update version
github-actions[bot] Jan 2, 2024
b1b74af
Merge branch 'master' into refactor_obs_base
multiphaseCFD Jan 2, 2024
5414a8e
update lapack install with msys2
multiphaseCFD Jan 2, 2024
41db279
update lapack install with msys2
multiphaseCFD Jan 2, 2024
f9ccfa4
win32 test
multiphaseCFD Jan 2, 2024
e636c62
fix ci error
multiphaseCFD Jan 2, 2024
09b3260
add msys2 to path
multiphaseCFD Jan 2, 2024
59d379b
install lapack with
multiphaseCFD Jan 4, 2024
fa0b3c3
Merge branch 'master' into refactor_obs_base
multiphaseCFD Jan 4, 2024
cc3e77a
Auto update version
github-actions[bot] Jan 4, 2024
f4aa48b
quick fix
multiphaseCFD Jan 4, 2024
42d8d67
add lapacke option vcpkg ci
multiphaseCFD Jan 4, 2024
bda75c1
quick fix yml windows
multiphaseCFD Jan 4, 2024
ddd8070
remove local build for win32
multiphaseCFD Jan 4, 2024
fd8f32c
try to enbale lapacke via vcpkg
multiphaseCFD Jan 4, 2024
dc47936
use api from lapack instead of lapacke
multiphaseCFD Jan 4, 2024
2f48e54
add windows tests for kokkos
multiphaseCFD Jan 4, 2024
e141ae6
change win32 install dir
multiphaseCFD Jan 4, 2024
5749ac9
test
multiphaseCFD Jan 4, 2024
2b7ceea
debug kokkos win32 tests lapack
multiphaseCFD Jan 4, 2024
d4d7d98
set CMAKE_TOOLCHAIN_FILE in cmakelist
multiphaseCFD Jan 4, 2024
d8f96f5
user has to ensure `CMAKE_TOOLCHAIN_FILE` setting
multiphaseCFD Jan 4, 2024
a354ad7
Auto update version
github-actions[bot] Jan 4, 2024
893b2c9
use prebuilt lapack for linux
multiphaseCFD Jan 4, 2024
13787bc
quick fix
multiphaseCFD Jan 4, 2024
7c9bacf
Merge branch 'master' into refactor_obs_base
multiphaseCFD Jan 4, 2024
602104f
Auto update version
github-actions[bot] Jan 4, 2024
69bdc12
tidy up code
multiphaseCFD Jan 4, 2024
a72ab41
convert kokkos::complex to std::complex for lapack
multiphaseCFD Jan 4, 2024
d949c3b
debug tests_linux
multiphaseCFD Jan 4, 2024
60a850a
set x
multiphaseCFD Jan 4, 2024
5c927da
set larger margin for hermitian shot measurement
multiphaseCFD Jan 4, 2024
195215e
make format
multiphaseCFD Jan 4, 2024
e0f95ea
use more shots for unit tests
multiphaseCFD Jan 4, 2024
7ddf386
trigger mgpu CI
multiphaseCFD Jan 4, 2024
ff1bece
add var shot support
multiphaseCFD Jan 5, 2024
b29f72a
add changelog & update Readme for LAPACK install
multiphaseCFD Jan 5, 2024
def416a
update README.srt
multiphaseCFD Jan 5, 2024
e10c34c
quick fix
multiphaseCFD Jan 5, 2024
bd7cc64
tidy up code
multiphaseCFD Jan 5, 2024
500a62e
ensure matrix passed to HermitianObs is Hermitian
multiphaseCFD Jan 5, 2024
a1ec96f
add more tests and fix unit tests
multiphaseCFD Jan 5, 2024
84bedd0
quick fix
multiphaseCFD Jan 5, 2024
75a6564
use relative margin for stochastic calculation
multiphaseCFD Jan 6, 2024
885824a
set margin as 20%
multiphaseCFD Jan 6, 2024
f5496e5
quick fix
multiphaseCFD Jan 6, 2024
f79accb
Less changes Herm check to applyInShot [skip CI]
multiphaseCFD Jan 8, 2024
23043bc
make format [skip CI]
multiphaseCFD Jan 8, 2024
1c9a75a
[skip ci]
multiphaseCFD Jan 8, 2024
03bd3da
update README [skip ci]
multiphaseCFD Jan 8, 2024
a2d9b26
fix readthedocs & remove set x in ci
multiphaseCFD Jan 8, 2024
8f7084a
[skip ci]
multiphaseCFD Jan 8, 2024
11e5778
Trigger CI
multiphaseCFD Jan 8, 2024
9ea300b
fix tidy and debug two backends CI c++
multiphaseCFD Jan 8, 2024
3624a76
add ci tests without lapack
multiphaseCFD Jan 8, 2024
9fd4980
quick fix
multiphaseCFD Jan 8, 2024
96620c1
revert readme changes
multiphaseCFD Jan 8, 2024
dd78509
update readthedocs.yml [skip ci]
multiphaseCFD Jan 9, 2024
ee11c95
put heev to anoy namespace
multiphaseCFD Jan 9, 2024
555f78a
remove Hermitian Check in obs construction
multiphaseCFD Jan 9, 2024
a47369a
set readthedocs python as 3.11 [skip ci]
multiphaseCFD Jan 9, 2024
08eb25c
update readthedocs [skip ci]
multiphaseCFD Jan 9, 2024
aec514a
refactor and move herm decompose from Util.hpp
multiphaseCFD Jan 9, 2024
6028a8d
add unit tests for herm decompose
multiphaseCFD Jan 9, 2024
20e2785
Revert "revert readme changes"
multiphaseCFD Jan 9, 2024
4526919
use v0.34.0 for python tests
multiphaseCFD Jan 9, 2024
2abfacb
Merge branch 'master' into refactor_obs_base
multiphaseCFD Jan 9, 2024
38c6c73
adjoint->parameter shift qubit unitary check
multiphaseCFD Jan 9, 2024
f1d2012
test_qubit_unitary adjoint -> parameter-shift
multiphaseCFD Jan 9, 2024
56355ce
tidy up code
multiphaseCFD Jan 9, 2024
3756906
revert requirement-dev
multiphaseCFD Jan 9, 2024
c2028d6
Use ps as unitary adjoint bench result
multiphaseCFD Jan 10, 2024
fbe57a1
make format
multiphaseCFD Jan 10, 2024
70b0d45
set pennylane as 0.34 revert to adj unitarty test
multiphaseCFD Jan 10, 2024
433e634
pennylane 0.32->0.34
multiphaseCFD Jan 10, 2024
d3ac3c9
set version as 0.35
multiphaseCFD Jan 10, 2024
94d3d9d
Merge branch 'master' into refactor_obs_base
multiphaseCFD Jan 10, 2024
e56f801
move 569 to dev0.35
multiphaseCFD Jan 10, 2024
2ea20d9
larger margin and add Hermitian check
multiphaseCFD Jan 10, 2024
7879ea8
revert changes in py unit tests
multiphaseCFD Jan 10, 2024
c46a0de
fix based on comments
multiphaseCFD Jan 10, 2024
475d96d
fix based on comments
multiphaseCFD Jan 10, 2024
769f496
quick fix for windows ci
multiphaseCFD Jan 10, 2024
8a28c81
add CMAKE_TOOLCHAIN_FILE for win test
multiphaseCFD Jan 10, 2024
97e2fdd
cache lapack
multiphaseCFD Jan 10, 2024
db44ed0
quick fix for lapack cache
multiphaseCFD Jan 10, 2024
952a37f
revert lapack cache in win ci
multiphaseCFD Jan 10, 2024
82a8e10
revert to 30 minutes for win tests
multiphaseCFD Jan 10, 2024
e2d4bf6
set time as 45 mins for win tests
multiphaseCFD Jan 11, 2024
38c5220
make format
multiphaseCFD Jan 11, 2024
6692b13
remove no need vector clear
multiphaseCFD Jan 11, 2024
e1550f6
Trigger CI
multiphaseCFD Jan 11, 2024
48ee246
change openblas test name
multiphaseCFD Jan 11, 2024
b544789
make format
multiphaseCFD Jan 11, 2024
e6b7cba
Trigger CI
multiphaseCFD Jan 11, 2024
1bdfebb
update catch2 version from 2.13.9-> 3.5.1
multiphaseCFD Jan 11, 2024
549d986
3.5->2.13.10
multiphaseCFD Jan 11, 2024
59df4a6
update linux CI
multiphaseCFD Jan 11, 2024
f9432a2
revert constexpr to const
multiphaseCFD Jan 11, 2024
ee1a205
revert 6692b13
multiphaseCFD Jan 11, 2024
c9808a7
const->constexpr & remove some vector clear
multiphaseCFD Jan 11, 2024
b3dd265
rename cov upload
multiphaseCFD Jan 11, 2024
637a223
remove cov files combination for python tests
multiphaseCFD Jan 11, 2024
565c7a0
revert the previous commit
multiphaseCFD Jan 11, 2024
1d80525
fix typo
multiphaseCFD Jan 11, 2024
70276b4
quick fix
multiphaseCFD Jan 11, 2024
f22a1fc
add Hermitian-Hamiltonian tests
multiphaseCFD Jan 11, 2024
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
4 changes: 4 additions & 0 deletions .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 Hermitian observable support for shot-noise measurement and Lapack support.
[(#569)](https://github.com/PennyLaneAI/pennylane-lightning/pull/569)

### Breaking changes

### Improvements
Expand All @@ -14,6 +17,7 @@

This release contains contributions from (in alphabetical order):

Shuli Shu

---

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests_gpu_cu11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,15 @@ jobs:
- name: Install required packages
run: |
python -m pip install ninja cmake custatevec-cu11
sudo apt-get -y -q install liblapack-dev

- name: Build and run unit tests
run: |
cd main
cmake . -BBuild \
-DCUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")\
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DENABLE_PYTHON=OFF \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
Expand Down
75 changes: 68 additions & 7 deletions .github/workflows/tests_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: echo ${{ github.event_name }} && sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION ninja-build gcovr lcov
run: echo ${{ github.event_name }} && sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION liblapack-dev ninja-build gcovr lcov

- name: Build and run unit tests
run: |
cmake . -BBuild -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DENABLE_PYTHON=OFF \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
Expand Down Expand Up @@ -197,7 +198,7 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION libopenblas-dev ninja-build gcovr lcov
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION liblapack-dev libopenblas-dev ninja-build gcovr lcov

- name: Build and run unit tests
run: |
Expand All @@ -207,6 +208,62 @@ jobs:
-DENABLE_BLAS=ON \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
-DENABLE_COVERAGE=ON
cmake --build ./Build
cd ./Build
mkdir -p ./tests/results
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results/report_$file.xml; done;
lcov --directory . -b ../pennylane_lightning/core/src --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' --output-file coverage.info
mv coverage.info coverage-${{ github.job }}-${{ matrix.pl_backend }}-Lapack.info

- name: Upload test results
uses: actions/upload-artifact@v3
if: always()
with:
name: ubuntu-tests-reports-${{ github.job }}-${{ matrix.pl_backend }}-Lapack
path: ./Build/tests/results/
if-no-files-found: error

- name: Upload code coverage results
uses: actions/upload-artifact@v3
with:
name: ubuntu-codecov-results-cpp
path: ./Build/coverage-${{ github.job }}-${{ matrix.pl_backend }}-Lapack.info
if-no-files-found: error

cpptestswithOpenBLASNoLAPACK:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
strategy:
matrix:
os: [ubuntu-22.04]
pl_backend: ["lightning_qubit"]
timeout-minutes: 30
name: C++ tests (OpenBLAS without LAPACK)
runs-on: ${{ matrix.os }}

steps:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.9'

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

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION liblapack-dev libopenblas-dev ninja-build gcovr lcov

- name: Build and run unit tests
run: |
cmake . -BBuild -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_PYTHON=OFF \
-DPL_BACKEND=${{ matrix.pl_backend }} \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=OFF \
-DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION) \
-DENABLE_COVERAGE=ON
cmake --build ./Build
Expand Down Expand Up @@ -370,13 +427,14 @@ jobs:
cp -rf ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION ninja-build gcovr lcov
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION liblapack-dev ninja-build gcovr lcov

- name: Build and run unit tests
run: |
cmake . -BBuild -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DENABLE_PYTHON=OFF \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos \
-DPL_BACKEND=${{ matrix.pl_backend }} \
Expand Down Expand Up @@ -548,7 +606,7 @@ jobs:

upload-to-codecov-linux-python:
needs: [pythontests, pythontestswithOpenBLAS, pythontestswithKokkos]
name: Upload coverage data to codecov
name: Upload python coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -575,8 +633,8 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}

upload-to-codecov-linux-cpp:
needs: [cpptests, cpptestswithOpenBLAS, cpptestswithKokkos]
name: Upload coverage data to codecov
needs: [cpptests, cpptestswithOpenBLAS, cpptestswithOpenBLASNoLAPACK, cpptestswithKokkos]
name: Upload cpp coverage data to codecov
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -630,13 +688,15 @@ jobs:
cp -rf ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/

- name: Install dependencies
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION ninja-build gcovr lcov
run: sudo apt-get update && sudo apt-get -y -q install cmake gcc-$GCC_VERSION g++-$GCC_VERSION liblapack-dev ninja-build gcovr lcov

- name: Build and run unit tests
run: |
set -x
cmake . -BBuild -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DENABLE_PYTHON=OFF \
-DCMAKE_PREFIX_PATH=${{ github.workspace }}/Kokkos \
-DPL_BACKEND="lightning_qubit;lightning_kokkos" \
Expand All @@ -645,6 +705,7 @@ jobs:
cd ./Build
mkdir -p ./tests/results_multiple_backends
for file in *runner ; do ./$file --order lex --reporter junit --out ./tests/results_multiple_backends/report_$file.xml; done;
set +x

- name: Upload test results
uses: actions/upload-artifact@v3
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/tests_linux_x86_mpi_gpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
run: |
python -m pip install -r requirements-dev.txt
python -m pip install cmake custatevec-cu11
sudo apt-get -y -q install liblapack-dev

- name: Validate GPU version and installed compiler
run: |
Expand Down Expand Up @@ -120,6 +121,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Debug \
-DENABLE_COVERAGE=ON \
-DBUILD_TESTS=ON \
-DENABLE_LAPACK=ON \
-DCMAKE_CXX_COMPILER=mpicxx \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
Expand Down
24 changes: 21 additions & 3 deletions .github/workflows/tests_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ concurrency:
jobs:
cpptests:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
timeout-minutes: 30
timeout-minutes: 45
name: C++ tests (Windows)
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -38,6 +38,13 @@ jobs:
with:
arch: amd64

- name: Install lapack with vcpkg
run: |
git clone --quiet --recursive https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
vcpkg install lapack

- name: Setup OpenCppCoverage and add to PATH
run: |
choco install OpenCppCoverage -y
Expand All @@ -51,6 +58,8 @@ jobs:
-DENABLE_PYTHON=OFF `
-DENABLE_GATE_DISPATCHER=OFF `
-DPL_BACKEND=${{ matrix.pl_backend }} `
-DENABLE_LAPACK=ON `
-DCMAKE_TOOLCHAIN_FILE=D:/a/pennylane-lightning/pennylane-lightning/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DENABLE_WARNINGS=OFF
cmake --build .\Build --config Debug
mkdir -p .\Build\tests\results
Expand Down Expand Up @@ -169,13 +178,13 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Restoring cached dependencies
- name: Restoring cached Kokkos
id: kokkos-cache
uses: actions/cache@v3
with:
path: D:\a\install_dir\${{ matrix.exec_model }}
key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }}-Debug

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

Expand All @@ -189,6 +198,13 @@ jobs:
uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: Install lapack with vcpkg
run: |
git clone --quiet --recursive https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
vcpkg install lapack

- name: Enable long paths
run: |
Expand All @@ -208,8 +224,10 @@ jobs:
-DENABLE_PYTHON=OFF `
-DENABLE_GATE_DISPATCHER=OFF `
-DCMAKE_PREFIX_PATH=D:\a\pennylane-lightning\pennylane-lightning\Kokkos `
-DCMAKE_TOOLCHAIN_FILE=D:/a/pennylane-lightning/pennylane-lightning/vcpkg/scripts/buildsystems/vcpkg.cmake `
-DENABLE_OPENMP=OFF `
-DPL_BACKEND=${{ matrix.pl_backend }} `
-DENABLE_LAPACK=ON `
-DENABLE_WARNINGS=OFF -T clangcl
cmake --build .\Build --config Debug -- /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true /p:MultiProcMaxCount=2
mkdir -p .\Build\tests\results
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ option(ENABLE_COVERAGE "Enable code coverage" OFF)
option(ENABLE_WARNINGS "Enable warnings" ON)
option(ENABLE_NATIVE "Enable native CPU build tuning" OFF)
option(ENABLE_PYTHON "Enable compilation of the Python module" ON)
option(ENABLE_LAPACK "Enable compilation of LAPACK" OFF)

# OpenMP
find_package(OpenMP)
Expand Down
25 changes: 23 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,8 @@ Then Lightning-GPU with MPI support can then be installed with ``pip``:
CMAKE_ARGS="-DENABLE_MPI=ON" PL_BACKEND="lightning_gpu" python -m pip install -e .


Test L-GPU with MPI
===================
Test Lightning-GPU with MPI
===========================

You may test the Python layer of the MPI enabled plugin as follows:

Expand Down Expand Up @@ -389,6 +389,26 @@ where ``${TARGET}`` is one of the following

.. docker-end-inclusion-marker-do-not-remove

LAPACK support
**************

LAPACK, a numerical linear algebra library, is required to enable stochastic measurement support in the C++ backend. We suggest first installing ``LAPACK`` following instructions in `LAPACK document <https://github.com/Reference-LAPACK/lapack/blob/db501d91ba690192dfe946524251b02d416298d0/README.md?plain=1#L85-L92>`_.

On Debian-based Linux systems, LAPACK can be also installed via ``apt``:

.. code-block:: console

$ sudo apt -y update &&
$ sudo apt install liblapack-dev

where LAPACK is included in ``liblapack-dev``.

On Windows systems, LAPACK is recommended to be built and installed using `vcpkg <https://github.com/Microsoft/vcpkg/>`_ following the instructions `here <https://github.com/Reference-LAPACK/lapack/blob/db501d91ba690192dfe946524251b02d416298d0/README.md?plain=1#L85-L92>`_.

The CMake option ``-DENABLE_LAPACK=ON`` must also be specified when building C++ backends. For Windows systems, we suggest adding the CMake option ``-DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>/scripts/buildsystems/vcpkg.cmake`` to ensure ``LAPACK`` can be found with CMake.

On MacOS systems, the Accelerate framework already includes optimized implementations of the LAPACK library.

Contributing
************

Expand Down Expand Up @@ -455,5 +475,6 @@ PennyLane Lightning makes use of the following libraries and tools, which are un
- **pybind11:** https://github.com/pybind/pybind11
- **Kokkos Core:** https://github.com/kokkos/kokkos
- **NVIDIA cuQuantum:** https://developer.nvidia.com/cuquantum-sdk
- **LAPACK:** https://github.com/Reference-LAPACK/lapack

.. acknowledgements-end-inclusion-marker-do-not-remove
17 changes: 17 additions & 0 deletions cmake/process_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,20 @@ if (UNIX AND (${CMAKE_SYSTEM_PROCESSOR} MATCHES "(AMD64)|(X64)|(x64)|(x86_64)"))
message(STATUS "ENABLE AVX for X64 on UNIX compatible system.")
target_compile_options(lightning_compile_options INTERFACE -mavx)
endif()


if(ENABLE_LAPACK)
find_package(LAPACK REQUIRED)
if(LAPACK_FOUND)
message(STATUS "LAPACK found.")
target_link_libraries(lightning_external_libs INTERFACE LAPACK::LAPACK)
target_compile_options(lightning_compile_options INTERFACE "-DPL_USE_LAPACK=1")
else()
if(MSVC)
if(NOT CMAKE_TOOLCHAIN_FILE)
message(FATAL_ERROR "LAPACK is enabled but not found. Please make sure you set CMAKE_TOOLCHAIN_FILE to use the vcpkg toolchain (<vcpkg-root>/scripts/buildsystems/vcpkg.cmake) after vcpkg install LAPACK.\n")
endif()
endif()
message(FATAL_ERROR "LAPACK is enabled but not found.\n")
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/support_tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ macro(FetchAndIncludeCatch)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.9
GIT_TAG v2.13.10
)

FetchContent_MakeAvailable(Catch2)
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.35.0-dev"
__version__ = "0.35.0-dev0"
4 changes: 2 additions & 2 deletions pennylane_lightning/core/lightning_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class LightningBase(QubitDevice):
OpenMP.
"""

pennylane_requires = ">=0.32"
pennylane_requires = ">=0.34"
version = __version__
author = "Xanadu Inc."
short_name = "lightning.base"
Expand Down Expand Up @@ -398,7 +398,7 @@ def processing_fns(tapes):

class LightningBaseFallBack(DefaultQubitLegacy): # pragma: no cover
# pylint: disable=missing-class-docstring, too-few-public-methods
pennylane_requires = ">=0.32"
pennylane_requires = ">=0.34"
version = __version__
author = "Xanadu Inc."
_CPP_BINARY_AVAILABLE = False
Expand Down
Loading