From 4a87ce864cd620bb332848d1614efac28a91d08d Mon Sep 17 00:00:00 2001 From: Chae-Yeun Park Date: Sat, 17 Sep 2022 20:28:31 -0400 Subject: [PATCH] Squashed commit of the following: commit 84e31bd219141acf7bd84140726b775f61a8a4a8 Author: Christina Lee Date: Fri Sep 9 09:22:56 2022 -0700 Defer op-arithmetic to default qubit (#349) * defer op-arithmetic to default qubit * Auto update version * tests, changelog, black * differentiation tests * black Co-authored-by: Dev version update bot commit 3b7892445894612ca06316626955372743c083b3 Author: Matthew Silverman Date: Tue Aug 30 08:48:53 2022 -0400 remove `supports_reversible_diff` (#342) * remove unused option * Auto update version Co-authored-by: Dev version update bot commit 6958fb853848a553a0ec48931ce87328a5444b19 Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Date: Mon Aug 29 09:36:08 2022 -0400 Quick fix for upload artifact for win (#346) * fix upload artifact for win * update changelog commit 66429b00724deeec2059a3d1792e9e02b480f1a3 Author: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Sat Aug 27 21:28:06 2022 -0400 Updated ReadTheDocs bade to new url (#339) * Updated ReadTheDocs bade to new url * Auto update version * Auto update version Co-authored-by: Dev version update bot Co-authored-by: Josh Izaac Co-authored-by: Dev version update bot commit f1a67893ed38cea27c29a4bc64a28fe1ec58e2f6 Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Date: Fri Aug 26 13:41:14 2022 -0400 Update cancel-workflow-action and bot credentials (#345) * update bot credentials * update cancel-workflow-action commit b5942349a3f2b72d1b6db0e90b1484f13a70d298 Author: Lee James O'Riordan Date: Fri Aug 26 09:21:15 2022 -0400 Update tagger bot for latest release (#344) * Update tagged CI for releases * Auto update version * Update changelog [skip_ci] Co-authored-by: Dev version update bot commit 8265eddd2025e044c223b976e202970a27135860 Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Date: Thu Aug 25 10:59:45 2022 -0400 Caching Kokkos build for wheel-builds (#316) * introduce caching Kokkos for wheels * improve process_options file * isolate Kokkos installation * offload windows wheel build to cibuildwheel * update PennyLane-Lightning build Co-authored-by: Lee James O'Riordan Co-authored-by: Lee J. O'Riordan commit 2282f9f69462b717f7bea0532497b2873d201392 Author: Chae-Yeun Park Date: Wed Aug 24 10:07:59 2022 -0400 Exclude AVX512 lines from codecov (#340) * Add expval(ham) forward * Fix namespace * Auto update version * Trigger CI * Unwrap ArrayBox * Format * Trigger CI * Remove irrelevant file * Update for CodeCov * Auto update version * Retry for AVX2 * Retry for AVX2 * Retry for AVX2 * Retry for AVX2 * Retry for AVX2 commit 9bad5924eb281845057d2ed6c1836b852bd6cf4d Author: Chae-Yeun Park Date: Tue Aug 23 18:07:46 2022 -0400 Add Hamiltonian expval in the forward path (#333) * Add expval(ham) forward * Fix namespace * Auto update version * Trigger CI * Unwrap ArrayBox * Format * Trigger CI * Auto update version * Remove irrelevant file * Auto update version * Update pennylane_lightning/src/algorithms/JacobianTape.hpp Co-authored-by: Lee James O'Riordan * Update changelog Co-authored-by: Lee James O'Riordan commit c4435925eda5569066157265ecbfd06118c0a15f Author: Josh Izaac Date: Tue Aug 23 11:11:50 2022 -0400 Update docs URL (#335) * Update docs URL * Auto update version * Auto update version * update navbar Co-authored-by: Dev version update bot Co-authored-by: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> commit bc54a3e4027bf17399d4692a7383bfe3268124b8 Author: Josh Izaac Date: Tue Aug 23 02:45:02 2022 +0800 Update conf.py commit 1e43ace40853eb90b93e05c18426f8fbdcd30a13 Author: Chae-Yeun Park Date: Mon Aug 22 14:37:00 2022 -0400 Fix measurement error message (#334) * Fix measurement error message * Reformat * Add Changelog commit c15fa0d9b0ba115da690c9c7de31a7637f7ae2d8 Author: Amintor Dusko <87949283+AmintorDusko@users.noreply.github.com> Date: Thu Aug 18 10:06:32 2022 -0400 Create a PennyLane-lightning requirements-dev.txt and update the Dockerfile (#330) * Create a requirements-dev.txt * Update tests and benchmarks * Improve dockerfile commit 87538ecc0ec4f589593f7fc67e896a321bea18ae Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon Aug 15 10:57:49 2022 -0400 post release version bump (#331) Co-authored-by: mlxd commit dc0d3b178dd22b1f4b3d22386bd835a2747f39df Author: Lee J. O'Riordan Date: Thu Aug 11 13:03:58 2022 -0400 Remove redundant Win ops and pin to WS2019 commit e5755d9e7ab0b24052387c7f6f9f71d25875a49b Author: Lee J. O'Riordan Date: Thu Aug 11 11:39:24 2022 -0400 Remove build base command commit ba16ec99b2ec459abc4d63fc676bf8593dbfa536 Author: Lee J. O'Riordan Date: Thu Aug 11 11:32:27 2022 -0400 Downgrade Py3.10 version to avoid additional characters in build path commit e3f8b4e5308f838c3869f4bc9212ee3fefff5d4a Author: Lee J. O'Riordan Date: Thu Aug 11 11:19:56 2022 -0400 Attempt updating Python installation package for Windows runner commit 90c06cc2bd9fcc21ab9ed3cb143e392b56351057 Author: Lee J. O'Riordan Date: Thu Aug 11 11:00:55 2022 -0400 Retry forcing longpaths for W10 build commit 36abd9bb0ca55a697d58d2faa71638c1b98c52fe Author: Lee J. O'Riordan Date: Thu Aug 11 10:38:24 2022 -0400 Disable clone of Kokkos submodules to allow Windows builds to proceed commit becd10c659e6c075922ae40413e33ee115f7c2b4 Author: Lee J. O'Riordan Date: Thu Aug 11 08:45:43 2022 -0400 Fix changelog++ commit c321d3459aa25708728888063c33ec53e6a4f361 Author: Lee J. O'Riordan Date: Thu Aug 11 08:44:12 2022 -0400 Fix changelog commit c198a5dbb5e890fee68765363bfe4ba5795c9b97 Author: Lee J. O'Riordan Date: Tue Aug 9 12:10:44 2022 -0400 Update version string Signed-off-by: Lee J. O'Riordan commit 2dd4b80f60d2b2b8505cae3171da1fbe92ae5555 Author: Lee J. O'Riordan Date: Tue Aug 9 12:08:50 2022 -0400 Update changelog --- .github/CHANGELOG.md | 56 +++++- .github/workflows/benchmarks.yml | 3 +- .github/workflows/format.yml | 6 +- ...se_tag_latest.yml => post_release_tag.yml} | 4 +- .github/workflows/tests_linux.yml | 16 +- .github/workflows/tests_windows.yml | 4 +- .github/workflows/tests_without_binary.yml | 6 +- .github/workflows/update_dev_version.yml | 4 +- .github/workflows/wheel_linux_aarch64.yml | 162 ++++++++++++--- .github/workflows/wheel_linux_ppc64le.yml | 163 ++++++++++++--- .github/workflows/wheel_linux_x86_64.yml | 150 ++++++++++++-- .github/workflows/wheel_macos_arm64.yml | 12 +- .github/workflows/wheel_macos_x86_64.yml | 127 +++++++++++- .github/workflows/wheel_win_x86_64.yml | 185 +++++++++++++----- README.rst | 16 +- cmake/process_options.cmake | 86 +++++--- codecov.yml | 1 + doc/_static/favicon.ico | Bin 4286 -> 15406 bytes doc/_static/logo.png | Bin 0 -> 26645 bytes doc/_static/pennylane.svg | 80 ++++++++ doc/conf.py | 5 +- docker/Dockerfile | 8 +- pennylane_lightning/_serialize.py | 3 +- pennylane_lightning/_version.py | 2 +- pennylane_lightning/lightning_qubit.py | 31 ++- .../src/algorithms/AlgUtil.hpp | 11 +- .../src/algorithms/CMakeLists.txt | 2 +- .../src/algorithms/JacobianTape.hpp | 7 +- pennylane_lightning/src/bindings/Bindings.cpp | 11 +- .../src/simulator/CMakeLists.txt | 16 +- .../src/simulator/CPUMemoryModel.hpp | 2 + .../src/simulator/KernelMap_X64.cpp | 12 ++ .../src/simulator/Measures.cpp | 7 +- .../src/simulator/Measures.hpp | 19 +- .../{algorithms => simulator}/Observables.cpp | 16 +- .../{algorithms => simulator}/Observables.hpp | 4 +- .../src/tests/Test_AdjDiff.cpp | 3 +- .../src/tests/Test_AlgUtil.cpp | 1 + .../src/tests/Test_Measures.cpp | 1 + .../src/tests/Test_Measures_Sparse.cpp | 1 + .../src/tests/Test_Observables.cpp | 2 +- .../src/tests/Test_StateVecAdjDiff.cpp | 1 + requirements-dev.txt | 8 + requirements.txt | 2 +- setup.py | 19 +- tests/test_device.py | 17 -- tests/test_expval.py | 83 ++++++++ tests/test_measures.py | 98 +++++++++- 48 files changed, 1181 insertions(+), 292 deletions(-) rename .github/workflows/{post_release_tag_latest.yml => post_release_tag.yml} (85%) create mode 100644 doc/_static/logo.png create mode 100644 doc/_static/pennylane.svg rename pennylane_lightning/src/{algorithms => simulator}/Observables.cpp (57%) rename pennylane_lightning/src/{algorithms => simulator}/Observables.hpp (99%) create mode 100644 requirements-dev.txt diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 9c24bed7fe..4ab54f4f46 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -1,4 +1,53 @@ -# Release 0.25.0-dev +# Release 0.26.0-dev + +### New features since last release + +### Breaking changes + +### Improvements + +* Introduces requirements-dev.txt and improves dockerfile. +[(#330)](https://github.com/PennyLaneAI/pennylane-lightning/pull/330) + +* Support `expval` for a Hamiltonian. +[(#333)](https://github.com/PennyLaneAI/pennylane-lightning/pull/333) + +* Implements caching for Kokkos installation. +[(#316)](https://github.com/PennyLaneAI/pennylane-lightning/pull/316) + +* Supports measurements of operator arithmetic classes such as `Sum`, `Prod`, + and `SProd` by deferring handling of them to `DefaultQubit`. + [(#349)](https://github.com/PennyLaneAI/pennylane-lightning/pull/349) + +``` +@qml.qnode(qml.device('lightning.qubit', wires=2)) +def circuit(): + obs = qml.s_prod(2.1, qml.PauliZ(0)) + qml.op_sum(qml.PauliX(0), qml.PauliZ(1)) + return qml.expval(obs) +``` + +### Documentation + +### Bug fixes + +* Test updates to reflect new measurement error messages. +[(#334)](https://github.com/PennyLaneAI/pennylane-lightning/pull/334) + +* Updates to the release tagger to fix incompatibilities with RTD. +[(#344)](https://github.com/PennyLaneAI/pennylane-lightning/pull/344) + +* Update cancel-workflow-action and bot credentials. +[(#345)](https://github.com/PennyLaneAI/pennylane-lightning/pull/345) + +### Contributors + +This release contains contributions from (in alphabetical order): + +Amintor Dusko, Christina Lee, Chae-Yeun Park + +--- + +# Release 0.25.0 ### New features since last release @@ -23,6 +72,7 @@ [(#313)](https://github.com/PennyLaneAI/pennylane-lightning/pull/313) ### Documentation + * Updated ReadTheDocs runner version from Ubuntu 20.04 to 22.04 [(#327)](https://github.com/PennyLaneAI/pennylane-lightning/pull/327) @@ -35,7 +85,7 @@ This release contains contributions from (in alphabetical order): -Amintor Dusko, Lee James O'Riordan, Chae-Yeun Park +Amintor Dusko, Christina Lee, Rashid N H M, Lee J. O'Riordan, Chae-Yeun Park --- @@ -702,4 +752,4 @@ Initial release. This release contains contributions from (in alphabetical order): -Tom Bromley, Josh Izaac, Nathan Killoran, Rashid N H M, Antal Száva +Tom Bromley, Josh Izaac, Nathan Killoran, Antal Száva diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index d1ef5ccb58..6c180e61db 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -32,9 +32,8 @@ jobs: run: | cd main python -m pip install --upgrade pip - pip install -r requirements.txt + pip install -r requirements-dev.txt pip install matplotlib - pip install git+https://github.com/PennyLaneAI/pennylane.git@master - name: Install lightning.qubit device (master) run: | diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index d9a0b7e6d0..c465f68b07 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -35,7 +35,7 @@ jobs: steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -63,7 +63,7 @@ jobs: steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} diff --git a/.github/workflows/post_release_tag_latest.yml b/.github/workflows/post_release_tag.yml similarity index 85% rename from .github/workflows/post_release_tag_latest.yml rename to .github/workflows/post_release_tag.yml index 71d359a38c..f1a4582c3a 100644 --- a/.github/workflows/post_release_tag_latest.yml +++ b/.github/workflows/post_release_tag.yml @@ -5,7 +5,7 @@ on: types: [published] env: - TAG_NAME: latest + TAG_NAME: latest_release jobs: post_release_tag_latest: @@ -18,7 +18,7 @@ jobs: - name: Overwrite tag run: | - git config --local user.email "chae-yeun@xanadu.ai" + git config --local user.email 'github-actions[bot]@users.noreply.github.com' git config --local user.name "Latest tag update bot" git tag -d $TAG_NAME || true if git push --delete origin $TAG_NAME; then diff --git a/.github/workflows/tests_linux.yml b/.github/workflows/tests_linux.yml index 6c15acd483..d60b1bb719 100644 --- a/.github/workflows/tests_linux.yml +++ b/.github/workflows/tests_linux.yml @@ -21,7 +21,7 @@ jobs: os: [ubuntu-20.04] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -74,7 +74,7 @@ jobs: os: [ubuntu-20.04] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -127,7 +127,7 @@ jobs: os: [ubuntu-20.04] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -181,7 +181,7 @@ jobs: os: [ubuntu-20.04] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -230,9 +230,7 @@ jobs: run: | cd main python -m pip install --upgrade pip - pip install -r requirements.txt - pip uninstall pennylane -y - pip install git+https://github.com/PennyLaneAI/pennylane.git + pip install -r requirements-dev.txt - name: Install ML libraries for interfaces run: | @@ -285,9 +283,7 @@ jobs: run: | cd main python -m pip install --upgrade pip - pip install -r requirements.txt - pip uninstall pennylane -y - pip install git+https://github.com/PennyLaneAI/pennylane.git + pip install -r requirements-dev.txt - name: Install ML libraries for interfaces run: | diff --git a/.github/workflows/tests_windows.yml b/.github/workflows/tests_windows.yml index 9e66aabd9f..a9d33d9dcd 100644 --- a/.github/workflows/tests_windows.yml +++ b/.github/workflows/tests_windows.yml @@ -14,7 +14,7 @@ jobs: os: [windows-latest] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 @@ -60,7 +60,7 @@ jobs: os: [windows-latest] steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 diff --git a/.github/workflows/tests_without_binary.yml b/.github/workflows/tests_without_binary.yml index dd29bdc059..3db163ecd2 100644 --- a/.github/workflows/tests_without_binary.yml +++ b/.github/workflows/tests_without_binary.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Cancel previous runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -36,9 +36,7 @@ jobs: run: | cd main python -m pip install --upgrade pip - pip install -r requirements.txt - pip uninstall pennylane -y - pip install git+https://github.com/PennyLaneAI/pennylane.git + pip install -r requirements-dev.txt - name: Install lightning.qubit device run: | diff --git a/.github/workflows/update_dev_version.yml b/.github/workflows/update_dev_version.yml index 52ad3d721c..2672cbb53b 100644 --- a/.github/workflows/update_dev_version.yml +++ b/.github/workflows/update_dev_version.yml @@ -36,8 +36,8 @@ jobs: run: | cd ./pr if [[ -n $(git status -s) ]]; then - git config --local user.email "chae-yeun@xanadu.ai" - git config --local user.name "Dev version update bot" + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git config --global user.name "Dev version update bot" git add . git commit -m 'Auto update version' git push diff --git a/.github/workflows/wheel_linux_aarch64.yml b/.github/workflows/wheel_linux_aarch64.yml index 37bff873c7..8352cb02f6 100644 --- a/.github/workflows/wheel_linux_aarch64.yml +++ b/.github/workflows/wheel_linux_aarch64.yml @@ -18,18 +18,19 @@ env: jobs: linux-set-matrix-aarch64: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -41,62 +42,173 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + + - name: Kokkos execution strategy + id: exec_model + run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations + + - name: Kokkos version + id: kokkos_version + run: echo "::set-output name=kokkos_version::[\"3.6.00\"]" + outputs: matrix: ${{ steps.pyver.outputs.matrix }} + exec_model: ${{ steps.exec_model.outputs.exec_model }} + kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }} - linux-wheels-aarch64: + build_dependencies: needs: [linux-set-matrix-aarch64] + strategy: + matrix: + os: [ubuntu-latest] + arch: [aarch64] + exec_model: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_aarch64"] + + name: Kokkos core & kernels (${{ matrix.exec_model }}::${{ matrix.arch }} ) + runs-on: ${{ matrix.os }} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} + + - name: Cache installation directories + id: kokkos-cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Clone Kokkos libs + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/kokkos/kokkos.git + cd kokkos + git checkout ${{ matrix.kokkos_version }} + cd - + pushd . &> /dev/null + git clone https://github.com/kokkos/kokkos-kernels.git + cd kokkos-kernels + git checkout ${{ matrix.kokkos_version }} + cd - + + - uses: docker/setup-qemu-action@v2 + name: Set up QEMU + + - name: Build Kokkos core library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + mkdir -p ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + cd kokkos + docker run --platform linux/aarch64 \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/io \ + -v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \ + -i ${{ matrix.container_img }} \ + bash -c "cd /io && \ + python3.7 -m pip install ninja && \ + ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \ + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \ + -DKokkos_ENABLE_COMPLEX_ALIGN=OFF \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja && \ + cmake --build ./Build --verbose && \ + cmake --install ./Build; " + cd - + - name: Build Kokkos kernels library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + cd kokkos-kernels + docker run --platform linux/aarch64 \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/io \ + -v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \ + -i ${{ matrix.container_img }} \ + bash -c "cd /io && \ + python3.7 -m pip install ninja && \ + ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \ + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_PREFIX_PATH=/install \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja && \ + cmake --build ./Build --verbose && \ + cmake --install ./Build; " + cd - + + linux-wheels-aarch64: + needs: [linux-set-matrix-aarch64, build_dependencies] strategy: fail-fast: false matrix: os: [ubuntu-latest] arch: [aarch64] - cibw_build: ${{fromJson(needs.linux-set-matrix-aarch64.outputs.matrix)}} + cibw_build: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.matrix) }} + exec_model: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-aarch64.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_aarch64"] name: ubuntu-latest::aarch64 (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }}) runs-on: ${{ matrix.os }} steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 - - - uses: docker/setup-qemu-action@v1 - name: Set up QEMU + - uses: actions/checkout@v3 - - uses: actions/setup-python@v2 - name: Install Python + - name: Restoring cached dependencies + id: kokkos-cache + uses: actions/cache@v3 with: - python-version: '3.7' + path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Copy cached libraries + run: | + mkdir Kokkos + cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python3 -m pip install cibuildwheel==2.8.1 + + - uses: docker/setup-qemu-action@v2 + name: Set up QEMU - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} + CIBW_BUILD: ${{ matrix.cibw_build }} + CIBW_SKIP: "*-musllinux*" # Python build settings CIBW_BEFORE_BUILD: | - pip install pybind11 ninja cmake && yum install -y gcc gcc-c++ - - # Testing of built wheels - CIBW_TEST_REQUIRES: numpy~=1.21 scipy pytest pytest-cov pytest-mock flaky + cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf + pip install ninja cmake - CIBW_BEFORE_TEST: pip install git+https://github.com/PennyLaneAI/pennylane.git@master + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 - CIBW_TEST_COMMAND: | - pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report + CIBW_BUILD_VERBOSITY: 3 - # Use Centos 7 wheel-builder for ARM - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + run: python3 -m cibuildwheel --output-dir wheelhouse - CIBW_ARCHS_LINUX: ${{matrix.arch}} + - uses: actions-ecosystem/action-regex-match@v2 + id: rc_build + with: + text: ${{ github.event.pull_request.head.ref }} + regex: '.*[0-9]+.[0-9]+.[0-9]+[-_]?rc[0-9]+' - uses: actions/upload-artifact@v2 if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} diff --git a/.github/workflows/wheel_linux_ppc64le.yml b/.github/workflows/wheel_linux_ppc64le.yml index 4e2b7a8d7e..51edfb5a0b 100644 --- a/.github/workflows/wheel_linux_ppc64le.yml +++ b/.github/workflows/wheel_linux_ppc64le.yml @@ -1,6 +1,6 @@ name: Wheel::Linux::PowerPC -# **What it does**: Build python wheels for Linux (ubuntu-latest) architecture PowerPC 64 and store it as artifacts. +# **What it does**: Builds python wheels for Linux (ubuntu-latest) architecture PowerPC 64 and store it as artifacts. # Python versions: 3.7, 3.8, 3.9, 3.10. # **Why we have it**: To build wheels for pennylane-lightning installation. # **Who does it impact**: Wheels to be uploaded to PyPI. @@ -18,18 +18,19 @@ env: jobs: linux-set-matrix-ppc64le: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -41,62 +42,176 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + + - name: Kokkos execution strategy + id: exec_model + run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations + + - name: Kokkos version + id: kokkos_version + run: echo "::set-output name=kokkos_version::[\"3.6.00\"]" + outputs: matrix: ${{ steps.pyver.outputs.matrix }} + exec_model: ${{ steps.exec_model.outputs.exec_model }} + kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }} - linux-wheels-ppc64le: + build_dependencies: needs: [linux-set-matrix-ppc64le] + strategy: + matrix: + os: [ubuntu-latest] + arch: [ppc64le] + exec_model: ${{ fromJson(needs.linux-set-matrix-ppc64le.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-ppc64le.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_ppc64le"] + + name: Kokkos core & kernels (${{ matrix.exec_model }}::${{ matrix.arch }} ) + runs-on: ${{ matrix.os }} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} + + - name: Cache installation directories + id: kokkos-cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Clone Kokkos libs + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/kokkos/kokkos.git + cd kokkos + git checkout ${{ matrix.kokkos_version }} + cd - + pushd . &> /dev/null + git clone https://github.com/kokkos/kokkos-kernels.git + cd kokkos-kernels + git checkout ${{ matrix.kokkos_version }} + cd - + + - uses: docker/setup-qemu-action@v2 + name: Set up QEMU + + - name: Build Kokkos core library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + mkdir -p ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + cd kokkos + docker run --platform linux/ppc64le \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/io \ + -v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \ + -i ${{ matrix.container_img }} \ + bash -c "cd /io && \ + python3.7 -m pip install ninja && \ + ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \ + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \ + -DKokkos_ENABLE_COMPLEX_ALIGN=OFF \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja && \ + cmake --build ./Build --verbose && \ + cmake --install ./Build; " + cd - + - name: Build Kokkos kernels library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + cd kokkos-kernels + docker run --platform linux/ppc64le \ + -v /var/run/docker.sock:/var/run/docker.sock \ + -v `pwd`:/io \ + -v ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}:/install \ + -i ${{ matrix.container_img }} \ + bash -c "cd /io && \ + python3.7 -m pip install ninja && \ + ln -s /opt/python/cp37-cp37m/bin/ninja /usr/bin/ninja && \ + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/install \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_PREFIX_PATH=/install \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja && \ + cmake --build ./Build --verbose && \ + cmake --install ./Build; " + cd - + + linux-wheels-ppc64le: + needs: [linux-set-matrix-ppc64le, build_dependencies] strategy: fail-fast: false matrix: os: [ubuntu-latest] arch: [ppc64le] cibw_build: ${{fromJson(needs.linux-set-matrix-ppc64le.outputs.matrix)}} + exec_model: ${{ fromJson(needs.linux-set-matrix-ppc64le.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-ppc64le.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_ppc64le"] name: ubuntu-latest::ppc64le (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }}) runs-on: ${{ matrix.os }} steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - uses: docker/setup-qemu-action@v1 - name: Set up QEMU - - - uses: actions/setup-python@v2 - name: Install Python + - name: Restoring cached dependencies + id: kokkos-cache + uses: actions/cache@v3 with: - python-version: '3.7' + path: ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Copy cached libraries + run: | + mkdir Kokkos + cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python3 -m pip install cibuildwheel==2.8.1 + + - uses: docker/setup-qemu-action@v2 + name: Set up QEMU - name: Build wheels - run: python -m cibuildwheel --output-dir wheelhouse env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} + CIBW_BUILD: ${{ matrix.cibw_build }} + CIBW_SKIP: "*-musllinux*" # Python build settings CIBW_BEFORE_BUILD: | - pip install pybind11 ninja cmake && yum install -y gcc gcc-c++ + cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf + pip install ninja cmake - # Skip PPC tests due to lack of numpy/scipy wheel support - CIBW_TEST_SKIP: "*-manylinux_{ppc64le}" + CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014 - CIBW_BEFORE_TEST: pip install git+https://github.com/PennyLaneAI/pennylane.git@master + CIBW_BUILD_VERBOSITY: 3 - # Use CentOS 7 image for PPC - CIBW_MANYLINUX_PPC64LE_IMAGE: manylinux2014 + run: python3 -m cibuildwheel --output-dir wheelhouse - CIBW_ARCHS_LINUX: ${{matrix.arch}} + - uses: actions-ecosystem/action-regex-match@v2 + id: rc_build + with: + text: ${{ github.event.pull_request.head.ref }} + regex: '.*[0-9]+.[0-9]+.[0-9]+[-_]?rc[0-9]+' - uses: actions/upload-artifact@v2 - if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' }} + if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' || steps.rc_build.outputs.match != ''}} with: name: ${{ runner.os }}-wheels-${{ matrix.arch }}.zip path: ./wheelhouse/*.whl diff --git a/.github/workflows/wheel_linux_x86_64.yml b/.github/workflows/wheel_linux_x86_64.yml index e680194737..df4931d553 100644 --- a/.github/workflows/wheel_linux_x86_64.yml +++ b/.github/workflows/wheel_linux_x86_64.yml @@ -19,18 +19,19 @@ env: jobs: linux-set-matrix-x86_64: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -42,45 +43,161 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + + - name: Kokkos execution strategy + id: exec_model + run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations + + - name: Kokkos version + id: kokkos_version + run: echo "::set-output name=kokkos_version::[\"3.6.00\"]" + outputs: matrix: ${{ steps.pyver.outputs.matrix }} + exec_model: ${{ steps.exec_model.outputs.exec_model }} + kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }} - linux-wheels-x86-64: + build_dependencies: needs: [linux-set-matrix-x86_64] + strategy: + matrix: + os: [ubuntu-latest] + exec_model: ${{ fromJson(needs.linux-set-matrix-x86_64.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-x86_64.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_x86_64"] + + name: Kokkos core & kernels (${{ matrix.exec_model }}) + runs-on: ${{ matrix.os }} + container: ${{ matrix.container_img }} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} + + - name: Cache installation directories + id: kokkos-cache + uses: actions/cache@v3 + with: + path: /root/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Install dependencies (Ubuntu) + if: ${{ (matrix.container_img == 'ubuntu:latest') && (steps.kokkos-cache.outputs.cache-hit != 'true') }} + run: | + apt-get update && DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get -y -q install cmake gcc-10 g++-10 ninja-build git + echo "COMPILER=g++-10" >> $GITHUB_ENV + + - name: Install dependencies (CentOS) + if: ${{ (matrix.container_img == 'quay.io/pypa/manylinux2014_x86_64') && (steps.kokkos-cache.outputs.cache-hit != 'true') }} + run: | + yum update -y && yum install -y cmake ninja-build + echo "COMPILER=g++" >> $GITHUB_ENV + + - name: Clone Kokkos libs + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/kokkos/kokkos.git + cd kokkos + git checkout ${{ matrix.kokkos_version }} + cd - + pushd . &> /dev/null + git clone https://github.com/kokkos/kokkos-kernels.git + cd kokkos-kernels + git checkout ${{ matrix.kokkos_version }} + cd - + + - name: Build Kokkos core library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + mkdir -p /root/Kokkos_install/${{ matrix.exec_model }} + cd kokkos + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/root/Kokkos_install/${{ matrix.exec_model }} \ + -DKokkos_ENABLE_COMPLEX_ALIGN=OFF \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_COMPILER=${{ env.COMPILER }} \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja + cmake --build ./Build --verbose + cmake --install ./Build + cd - + + - name: Build Kokkos kernels library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + mkdir -p /root/Kokkos_install/${{ matrix.exec_model }} + cd kokkos-kernels + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=/root/Kokkos_install/${{ matrix.exec_model }} \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DCMAKE_CXX_COMPILER=${{ env.COMPILER }} \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_PREFIX_PATH=/root/Kokkos_install/${{ matrix.exec_model }} \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -G Ninja + cmake --build ./Build --verbose + cmake --install ./Build + + linux-wheels-x86-64: + needs: [linux-set-matrix-x86_64, build_dependencies] strategy: fail-fast: false matrix: os: [ubuntu-latest] arch: [x86_64] - cibw_build: ${{fromJson(needs.linux-set-matrix-x86_64.outputs.matrix)}} + cibw_build: ${{ fromJson(needs.linux-set-matrix-x86_64.outputs.matrix) }} + exec_model: ${{ fromJson(needs.linux-set-matrix-x86_64.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.linux-set-matrix-x86_64.outputs.kokkos_version) }} + container_img: ["quay.io/pypa/manylinux2014_x86_64"] name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }}) runs-on: ${{ matrix.os }} + container: ${{ matrix.container_img }} steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v2 - name: Install Python + - name: Restoring cached dependencies + id: kokkos-cache + uses: actions/cache@v3 with: - python-version: '3.7' + path: /root/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.container_img }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - uses: actions/checkout@v3 + + - name: Copy cached libraries + run: | + mkdir Kokkos + cp -rf /root/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ + + - name: Install dependencies (CentOS) + if: ${{ (matrix.container_img == 'quay.io/pypa/manylinux2014_x86_64') }} + run: | + # Reduce wait time for repos not responding + cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf + yum update -y && yum install -y docker - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python3.7 -m pip install cibuildwheel==2.8.1 - name: Build wheels env: + CIBW_ARCHS_LINUX: ${{matrix.arch}} + CIBW_BUILD: ${{ matrix.cibw_build }} + CIBW_SKIP: "*-musllinux*" # Python build settings CIBW_BEFORE_BUILD: | - pip install pybind11 ninja cmake && yum install -y gcc gcc-c++ + cat /etc/yum.conf | sed "s/\[main\]/\[main\]\ntimeout=5/g" > /etc/yum.conf + pip install ninja cmake # Testing of built wheels CIBW_TEST_REQUIRES: numpy~=1.21 scipy pytest pytest-cov pytest-mock flaky @@ -92,9 +209,10 @@ jobs: pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 - CIBW_ARCHS_LINUX: ${{matrix.arch}} - run: python -m cibuildwheel --output-dir wheelhouse + CIBW_BUILD_VERBOSITY: 3 + + run: python3.7 -m cibuildwheel --output-dir wheelhouse - uses: actions-ecosystem/action-regex-match@v2 id: rc_build diff --git a/.github/workflows/wheel_macos_arm64.yml b/.github/workflows/wheel_macos_arm64.yml index cddfbf75bd..eaa974bad8 100644 --- a/.github/workflows/wheel_macos_arm64.yml +++ b/.github/workflows/wheel_macos_arm64.yml @@ -20,18 +20,19 @@ env: jobs: mac-set-matrix-arm: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -43,6 +44,7 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + outputs: matrix: ${{ steps.pyver.outputs.matrix }} @@ -60,7 +62,7 @@ jobs: steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} @@ -72,7 +74,7 @@ jobs: python-version: '3.8' - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python -m pip install cibuildwheel==2.8.1 - name: Build wheels env: diff --git a/.github/workflows/wheel_macos_x86_64.yml b/.github/workflows/wheel_macos_x86_64.yml index 689ca63949..edb2b22e5b 100644 --- a/.github/workflows/wheel_macos_x86_64.yml +++ b/.github/workflows/wheel_macos_x86_64.yml @@ -6,6 +6,7 @@ name: Wheel::MacOS::Intel # **Who does it impact**: Wheels to be uploaded to PyPI. on: + pull_request: push: branches: - master @@ -19,18 +20,19 @@ env: jobs: mac-set-matrix-x86: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -42,28 +44,136 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + + - name: Kokkos execution strategy + id: exec_model + run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations + + - name: Kokkos version + id: kokkos_version + run: echo "::set-output name=kokkos_version::[\"3.6.00\"]" + outputs: matrix: ${{ steps.pyver.outputs.matrix }} + exec_model: ${{ steps.exec_model.outputs.exec_model }} + kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }} - mac-wheels-x86: + build_dependencies: needs: [mac-set-matrix-x86] + strategy: + matrix: + os: [macos-11] + arch: [x86_64] + exec_model: ${{ fromJson(needs.mac-set-matrix-x86.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.mac-set-matrix-x86.outputs.kokkos_version) }} + + name: Kokkos core & kernels (${{ matrix.exec_model }}::${{ matrix.arch }} ) + runs-on: ${{ matrix.os }} + + steps: + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} + + - name: Cache installation directories + id: kokkos-cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Install clang + run: brew install llvm + + - name: Clone Kokkos libs + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/kokkos/kokkos.git + cd kokkos + git checkout ${{ matrix.kokkos_version }} + cd - + pushd . &> /dev/null + git clone https://github.com/kokkos/kokkos-kernels.git + cd kokkos-kernels + git checkout ${{ matrix.kokkos_version }} + cd - + + - uses: actions/setup-python@v2 + name: Install Python + with: + python-version: '3.7' + + - name: Build Kokkos core library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + mkdir -p ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} + cd kokkos + python -m pip install cmake ninja + + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} \ + -DKokkos_ENABLE_COMPLEX_ALIGN=OFF \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ \ + -G Ninja + cmake --build ./Build --verbose + cmake --install ./Build + cd - + + - name: Build Kokkos kernels library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + cd kokkos-kernels + python -m pip install cmake ninja + + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} \ + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON \ + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF \ + -DCMAKE_CXX_STANDARD=20 \ + -DCMAKE_PREFIX_PATH=${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ \ + -G Ninja + cmake --build ./Build --verbose + cmake --install ./Build + cd - + + mac-wheels-x86: + needs: [mac-set-matrix-x86, build_dependencies] strategy: fail-fast: false matrix: os: [macos-11] arch: [x86_64] cibw_build: ${{fromJson(needs.mac-set-matrix-x86.outputs.matrix)}} + exec_model: ${{ fromJson(needs.mac-set-matrix-x86.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.mac-set-matrix-x86.outputs.kokkos_version) }} name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }}) runs-on: ${{ matrix.os }} steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + + - name: Restoring cached dependencies + id: kokkos-cache + uses: actions/cache@v3 + with: + path: ${{ github.workspace}}/Kokkos_install/${{ matrix.exec_model }} + key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - name: Copy cached libraries + run: | + mkdir Kokkos + cp -rf ${{ github.workspace }}/Kokkos_install/${{ matrix.exec_model }}/* Kokkos/ - uses: actions/setup-python@v2 name: Install Python @@ -71,7 +181,7 @@ jobs: python-version: '3.7' - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python -m pip install cibuildwheel==2.8.1 - name: Build wheels env: @@ -80,7 +190,6 @@ jobs: # MacOS specific build settings CIBW_BEFORE_ALL_MACOS: | brew uninstall --force oclint - brew install llvm brew install libomp brew install llvm diff --git a/.github/workflows/wheel_win_x86_64.yml b/.github/workflows/wheel_win_x86_64.yml index 2e03fdafe3..0b2b4dcd11 100644 --- a/.github/workflows/wheel_win_x86_64.yml +++ b/.github/workflows/wheel_win_x86_64.yml @@ -21,18 +21,19 @@ env: jobs: win-set-matrix-x86: - name: Set builder matrix versions + name: Set builder matrix runs-on: ubuntu-latest steps: - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - uses: actions/checkout@v2 - - id: pyver + - name: Python version + id: pyver run: | if [[ ${{ github.event_name }} == 'pull_request' ]]; then echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \ @@ -44,69 +45,157 @@ jobs: --max-version=3.${{ env.PYTHON3_MAX_VERSION }} \ --range)" fi + + - name: Kokkos execution strategy + id: exec_model + run: echo "::set-output name=exec_model::[\"SERIAL\"]" # We may also adopt [OPENMP, THREADS] in later iterations + + - name: Kokkos version + id: kokkos_version + run: echo "::set-output name=kokkos_version::[\"3.6.00\"]" + outputs: matrix: ${{ steps.pyver.outputs.matrix }} + exec_model: ${{ steps.exec_model.outputs.exec_model }} + kokkos_version: ${{ steps.kokkos_version.outputs.kokkos_version }} - win-wheels: + build_dependencies: needs: [win-set-matrix-x86] strategy: fail-fast: false matrix: - os: [windows-latest] - py_version: ${{fromJson(needs.win-set-matrix-x86.outputs.matrix)}} - name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.py_version] }}) + os: [windows-2019] + exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }} + + name: Kokkos core & kernels (${{ matrix.exec_model }}) runs-on: ${{ matrix.os }} steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.4.1 + - name: Cancel previous runs + uses: styfle/cancel-workflow-action@0.10.0 with: access_token: ${{ github.token }} - - name: Get git branch name - id: branch-name - uses: tj-actions/branch-names@v5 + - name: Cache installation directories + 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 }} - - name: Enable long paths + - name: Clone Kokkos libs + if: steps.kokkos-cache.outputs.cache-hit != 'true' run: | - powershell.exe New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force + cd D:\a + git clone https://github.com/kokkos/kokkos.git + cd D:\a\kokkos + git checkout ${{ matrix.kokkos_version }} + cd D:\a\ + git clone https://github.com/kokkos/kokkos-kernels.git + cd D:\a\kokkos-kernels + git checkout ${{ matrix.kokkos_version }} + cd .. + + - name: Create installation directory + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: mkdir -p D:\a\install_dir\${{ matrix.exec_model }} + + - name: Install dependencies + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + python -m pip install cmake build - - uses: actions/checkout@v3 + - name: Build Kokkos core library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + cd D:\a\kokkos + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=D:\a\install_dir\${{ matrix.exec_model }} ` + -DKokkos_ENABLE_COMPLEX_ALIGN=OFF ` + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON ` + -DKokkos_ENABLE_DEPRECATION_WARNINGS=OFF ` + -DCMAKE_CXX_STANDARD=20 ` + -DCMAKE_POSITION_INDEPENDENT_CODE=ON ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -T clangcl + cmake --build ./Build --config RelWithDebInfo --verbose + cmake --install ./Build --config RelWithDebInfo --verbose + + - name: Build Kokkos kernels library + if: steps.kokkos-cache.outputs.cache-hit != 'true' + run: | + cd D:\a\kokkos-kernels + cmake -BBuild . -DCMAKE_INSTALL_PREFIX=D:\a\install_dir\${{ matrix.exec_model }} ` + -DKokkos_ENABLE_${{ matrix.exec_model }}=ON ` + -DCMAKE_CXX_STANDARD=20 ` + -DCMAKE_PREFIX_PATH=D:\a\install_dir\${{ matrix.exec_model }} ` + -DCMAKE_POSITION_INDEPENDENT_CODE=ON ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -T clangcl + cmake --build ./Build --config RelWithDebInfo --verbose + cmake --install ./Build --config RelWithDebInfo --verbose + + win-wheels: + needs: [win-set-matrix-x86, build_dependencies] + strategy: + fail-fast: false + matrix: + os: [windows-2019] + arch: [AMD64] + cibw_build: ${{ fromJson(needs.win-set-matrix-x86.outputs.matrix) }} + exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }} + kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }} + name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }}) + runs-on: ${{ matrix.os }} + + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.10.0 + with: + access_token: ${{ github.token }} - - uses: actions/setup-python@v2 - name: Install Python + - name: Restoring cached dependencies + id: kokkos-cache + uses: actions/cache@v3 with: - python-version: ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.py_version] }} + path: D:\a\install_dir\${{ matrix.exec_model }} + key: ${{ matrix.os }}-kokkos${{ matrix.kokkos_version }}-${{ matrix.exec_model }} + + - uses: actions/checkout@v3 + + - name: Copy cached libraries + if: steps.kokkos-cache.outputs.cache-hit == 'true' + run: | + Copy-Item -Path "D:\a\install_dir\${{ matrix.exec_model }}\" ` + -Destination "D:\a\pennylane-lightning\pennylane-lightning\Kokkos" -Recurse -Force - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.3.0 + run: python -m pip install cibuildwheel==2.8.1 - name: Build wheels - run: | - Subst Z: (pwd) - Set-Location -Path "Z:\" - python -m pip install wheel cmake ninja build - python setup.py bdist_wheel - Set-Location -Path "./dist" - foreach ($i in Get-ChildItem -Path ./*.whl){ - python -m wheel unpack $i.Name - $name = $i.Name - $dirName = python -c "s = '$name'; print('-'.join(s.split('-')[0:2]))" - if (Test-Path -Path $dirName\pennylane_lightning\Debug) { - Move-Item -Path $dirName\pennylane_lightning\Debug\* -Destination $dirName\pennylane_lightning - Remove-Item $dirName\pennylane_lightning\Debug -Recurse - python -m wheel pack $dirName - } - Remove-Item $dirName -Recurse - } - - - name: Test wheel - run: | - Set-Location -Path "Z:\" - foreach ($i in Get-ChildItem -Path Z:\dist\*.whl){ python -m pip install $i } - python -m pip install git+https://github.com/PennyLaneAI/pennylane.git@master && ` - python -m pip install pytest pytest-cov pytest-mock flaky && ` - pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report + env: + CIBW_ARCHS_WINDOWS: ${{matrix.arch}} + + CIBW_BUILD: ${{ matrix.cibw_build }} + + # Python build settings + CIBW_BEFORE_BUILD: | + pip install pybind11 cmake + + # Testing of built wheels + CIBW_TEST_REQUIRES: numpy~=1.21 scipy pytest pytest-cov pytest-mock flaky + + CIBW_BEFORE_TEST: | + pip install git+https://github.com/PennyLaneAI/pennylane.git@master + + CIBW_TEST_COMMAND: | + pl-device-test --device=lightning.qubit --skip-ops -x --tb=short --no-flaky-report + + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + + CIBW_BUILD_VERBOSITY: 3 + + run: python -m cibuildwheel --output-dir wheelhouse - uses: actions-ecosystem/action-regex-match@v2 id: rc_build @@ -117,8 +206,8 @@ jobs: - uses: actions/upload-artifact@v2 if: ${{ github.event_name == 'release' || github.ref == 'refs/heads/master' || steps.rc_build.outputs.match != ''}} with: - name: ${{ runner.os }}-wheels.zip - path: Z:\dist\*.whl + name: ${{ runner.os }}-wheels-${{ matrix.arch }}.zip + path: ./wheelhouse/*.whl upload-pypi: needs: win-wheels @@ -127,7 +216,7 @@ jobs: steps: - uses: actions/download-artifact@v2 with: - name: Windows-wheels.zip + name: Windows-wheels-AMD64.zip path: dist - name: Upload wheels to PyPI @@ -135,4 +224,4 @@ jobs: with: user: __token__ password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository_url: https://test.pypi.org/legacy/ \ No newline at end of file diff --git a/README.rst b/README.rst index f0d1d7a0fe..d8b1de536d 100644 --- a/README.rst +++ b/README.rst @@ -13,9 +13,9 @@ PennyLane-Lightning Plugin :alt: CodeFactor Grade :target: https://www.codefactor.io/repository/github/pennylaneai/pennylane-lightning -.. image:: https://img.shields.io/readthedocs/pennylane-lightning.svg?logo=read-the-docs&style=flat-square +.. image:: https://readthedocs.com/projects/xanaduai-pennylane-lightning/badge/?version=latest&style=flat-square :alt: Read the Docs - :target: https://pennylane-lightning.readthedocs.io + :target: https://docs.pennylane.ai/projects/lightning .. image:: https://img.shields.io/pypi/v/PennyLane-Lightning.svg?style=flat-square :alt: PyPI @@ -29,7 +29,7 @@ PennyLane-Lightning Plugin The PennyLane-Lightning plugin provides a fast state-vector simulator written in C++. -`PennyLane `_ is a cross-platform Python library for quantum machine +`PennyLane `_ is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations. .. header-end-inclusion-marker-do-not-remove @@ -103,7 +103,7 @@ For GPU support, `PennyLane-Lightning-GPU `_. +For more information, please refer to the PennyLane Lightning GPU `documentation `_. Testing ------- @@ -172,8 +172,8 @@ Note that OpenMP and BLAS are disabled in this setting. .. installation-end-inclusion-marker-do-not-remove -Please refer to the `plugin documentation `_ as -well as to the `PennyLane documentation `_ for further reference. +Please refer to the `plugin documentation `_ as +well as to the `PennyLane documentation `_ for further reference. Docker Support @@ -186,7 +186,7 @@ One can also build the Pennylane-Lightning image using Docker: $ cd pennylane-lightning $ docker build -t lightning/base -f docker/Dockerfile . -Please refer to the `PennyLane installation `_ for detailed description about PennyLane Docker support. +Please refer to the `PennyLane installation `_ for detailed description about PennyLane Docker support. Contributing @@ -247,4 +247,4 @@ PennyLane Lightning makes use of the following libraries and tools, which are un - **Kokkos Core:** https://github.com/kokkos/kokkos - **Kokkos Kernels:** https://github.com/kokkos/kokkos-kernels -.. acknowledgements-end-inclusion-marker-do-not-remove \ No newline at end of file +.. acknowledgements-end-inclusion-marker-do-not-remove diff --git a/cmake/process_options.cmake b/cmake/process_options.cmake index 1711e07cdf..495baa0289 100644 --- a/cmake/process_options.cmake +++ b/cmake/process_options.cmake @@ -1,6 +1,6 @@ ############################################################################## -# This file processes ENABLE_WARNINGS, ENABLE_NATIVE, ENABLE_AVX, -# ENABLE_OPENMP, ENABLE_KOKKOS, and ENABLE_BLAS +# This file processes ENABLE_WARNINGS, ENABLE_NATIVE, ENABLE_OPENMP, +# ENABLE_KOKKOS, and ENABLE_BLAS # options and produces interface libraries # lightning_compile_options and lightning_external_libs. ############################################################################## @@ -10,8 +10,8 @@ include_guard() if (WIN32) # Increasing maximum full-path length allowed. - message("Setting default path length to 249 characters") - set(CMAKE_OBJECT_PATH_MAX 249) + message("Setting default path length to 240 characters") + set(CMAKE_OBJECT_PATH_MAX 240) endif () # Check GCC version @@ -116,35 +116,62 @@ else() endif() if(ENABLE_KOKKOS) - # Setting the Serial device for all cases. - option(Kokkos_ENABLE_SERIAL "Enable Kokkos SERIAL device" ON) - message(STATUS "KOKKOS SERIAL DEVICE ENABLED.") + message(STATUS "ENABLE_KOKKOS is ON.") - option(Kokkos_ENABLE_COMPLEX_ALIGN "Enable complex alignment in memory" OFF) - - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - include(FetchContent) - - FetchContent_Declare(kokkos - GIT_REPOSITORY https://github.com/kokkos/kokkos.git - GIT_TAG 3.6.00 + find_package(Kokkos + HINTS ${CMAKE_SOURCE_DIR}/Kokkos + /usr + /usr/local + /opt ) - - FetchContent_MakeAvailable(kokkos) - - get_target_property(kokkos_INC_DIR kokkos INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(kokkos PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkos_INC_DIR}") + if(Kokkos_FOUND) + message(STATUS "Found existing Kokkos library") + endif() - FetchContent_Declare(kokkoskernels - GIT_REPOSITORY https://github.com/kokkos/kokkos-kernels.git - GIT_TAG 3.6.00 + find_package(KokkosKernels + HINTS ${CMAKE_SOURCE_DIR}/Kokkos + ${CMAKE_SOURCE_DIR}/KokkosKernels + /usr + /usr/local + /opt ) - - FetchContent_MakeAvailable(kokkoskernels) - - get_target_property(kokkoskernels_INC_DIR kokkoskernels INTERFACE_INCLUDE_DIRECTORIES) - set_target_properties(kokkoskernels PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkoskernels_INC_DIR}") + if(KokkosKernels_FOUND) + message(STATUS "Found existing Kokkos Kernels library") + endif() + if (NOT (Kokkos_FOUND AND KokkosKernels_FOUND)) + # Setting the Serial device. + option(Kokkos_ENABLE_SERIAL "Enable Kokkos SERIAL device" ON) + message(STATUS "KOKKOS SERIAL DEVICE ENABLED.") + + option(Kokkos_ENABLE_COMPLEX_ALIGN "Enable complex alignment in memory" OFF) + + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + include(FetchContent) + + FetchContent_Declare(kokkos + GIT_REPOSITORY https://github.com/kokkos/kokkos.git + GIT_TAG 3.6.00 + GIT_SUBMODULES "" # Avoid recursively cloning all submodules + ) + + FetchContent_MakeAvailable(kokkos) + + get_target_property(kokkos_INC_DIR kokkos INTERFACE_INCLUDE_DIRECTORIES) + set_target_properties(kokkos PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkos_INC_DIR}") + + FetchContent_Declare(kokkoskernels + GIT_REPOSITORY https://github.com/kokkos/kokkos-kernels.git + GIT_TAG 3.6.00 + GIT_SUBMODULES "" # Avoid recursively cloning all submodules + ) + + FetchContent_MakeAvailable(kokkoskernels) + + get_target_property(kokkoskernels_INC_DIR kokkoskernels INTERFACE_INCLUDE_DIRECTORIES) + set_target_properties(kokkoskernels PROPERTIES INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${kokkoskernels_INC_DIR}") + + endif() target_compile_options(lightning_compile_options INTERFACE "-D_ENABLE_KOKKOS=1") target_link_libraries(lightning_external_libs INTERFACE Kokkos::kokkos Kokkos::kokkoskernels) else() @@ -154,5 +181,4 @@ endif() 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() - +endif() \ No newline at end of file diff --git a/codecov.yml b/codecov.yml index 46fc4e95b7..ec986fda58 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,6 +3,7 @@ fixes: ignore: - "pennylane_lightning/src/tests" + - "pennylane_lightning/src/gates/cpu_kernels/avx_common" codecov: notify: diff --git a/doc/_static/favicon.ico b/doc/_static/favicon.ico index c52850d8d00c7a6e81eb798f346a36458a931b39..cf510d1b3ccda19d64692a87b998b1b0b134747a 100644 GIT binary patch literal 15406 zcmeHO33O9c8ctifuqZHs;*5?60+q#KaZr>^M~+L=qzkoJML^c0&LD6QkdZ}XnPCwT zK|tA|3vH67p-YkygaH{u0cDYWZ7GzcZIV(7egAy-wl}_{FKr41IS%ifckau3_ul`z z|NZa3-5Zt4PZgkQ)JTQ0xoSimm8z>srE1>1{C8+$m1;TOb?jL2y|qfUy{SqSiaKb5 z7Ul0z)c7K!x(Tfd1BIGjqz~&M>C{(oJIJ8vRFfVkDJDSDh3zGsny#&hrITNe99xt2 zQi^&wYg@EvDCs*Mr^d-e*8?n$SA6M%EHMp%`8;cXV)Pt}8FP_T7AN^xoU?stFB!sT zv$pKsI%yFFraO3he{<2~>e`boq9w4Gi1vfh(ho7(Ex#$GA0{p+mGt3zq^!sXz4Zg! zI?|j@-b9=yROqXJ6L|1 zjW)%+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97eakgPG39ligq=6m?X3Yr{UmN>K_mdJdN7k+a-+BN~c>}jB0&I7Q7n@{SJ$Q;) zi+T0oa*2xO&w$V;gtpd@Rk+pDEw@4J;S?Ay_OJa909crr0%#9>o1YRwO#1oQ7}{XT zS(BHQ)8gpZUmTW4>wSC^=+1qhhun=?WO7zZHQVwQ{=4uA@!B)M0{GMNZoj>A1xv8F zp&=JCa<@l4?Z4I)upBX9H!3Ea>-Tl3Q%g}Uy?eadAuSLP9isJ2h?wwfgtFpM(*JnJw${q!g(l9hF_{jCV9 zzZ#N~q#t)oY)&OsN9wC|e%U$D`KP@4FDLg?M${v z%TY8>2|$?(+qXOF+cEPZDvia+_Z65FpBD+Kvtaamg14qmZ#L`P5gjuK{=3FOu4vu~ z%-@goxm|cI_{=9^<)w)`wu8@hsYe)4e!=kI$u|7dCZ98oJ9-p#|Ao< z0YgHO*qcCpygOb`0!NVaxe69-EdQ#!!fR=`%HDA4N~T*hAb#q3CnQr7Q+15eSRS|? zEI~?RH%cdSf78#F;+j2wpbaa|DLjJ_LE8=21CDT<902T(2^~?id6^5Bz`%rb4|vmu z;?tq9OU@<_p+zu{c*%ZnTp&a=Mmag8hh5RKFz{$e%FXcQ|s z>}AHdArcdjd^8| + + + + + + + + + + + + + + + + + + + + diff --git a/doc/conf.py b/doc/conf.py index e088e3a696..591a538ad5 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -213,11 +213,14 @@ def __getattr__(cls, name): # xanadu theme options (see theme.conf for more information) html_theme_options = { - "navbar_wordmark_path": "_static/pl_wordmark.png", + "navbar_logo_path": "_static/logo.png", + "navbar_wordmark_path": "_static/pennylane.svg", # Specifying #19b37b is more correct but does not match the other PL websites. "navbar_logo_colour": "#2d7c7f", "navbar_home_link": "https://pennylane.ai", + + "google_analytics_tracking_id": "UA-130507810-1", "navbar_left_links": [ { diff --git a/docker/Dockerfile b/docker/Dockerfile index 2e67eed946..bce3b788a0 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -29,8 +29,10 @@ RUN apt-get update \ python3-pip \ python3-venv \ python3-dev \ + gcc-10 g++-10 cpp-10 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* \ + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10 \ && /usr/sbin/update-ccache-symlinks \ && mkdir /opt/ccache \ && ccache --set-config=cache_dir=/opt/ccache \ @@ -44,12 +46,8 @@ WORKDIR /opt/pennylane-lightning COPY . . RUN pip install --no-cache-dir wheel \ - pytest \ - pytest-cov \ - pytest-mock \ - flaky \ sphinx \ - && pip install --no-cache-dir -r requirements.txt \ + && pip install --no-cache-dir -r requirements-dev.txt \ && pip uninstall -y PennyLane_Lightning \ && make install \ && make test-python \ diff --git a/pennylane_lightning/_serialize.py b/pennylane_lightning/_serialize.py index 309484ad3d..e0e546192a 100644 --- a/pennylane_lightning/_serialize.py +++ b/pennylane_lightning/_serialize.py @@ -27,6 +27,7 @@ from pennylane.grouping import is_pauli_word from pennylane.operation import Observable, Tensor from pennylane.tape import QuantumTape +from pennylane.math import unwrap # Remove after the next release of PL # Add from pennylane import matrix @@ -111,7 +112,7 @@ def _serialize_hamiltonian(ob, wires_map: dict, use_csingle: bool): rtype = np.float64 hamiltonian_obs = HamiltonianC128 - coeffs = np.array(ob.coeffs).astype(rtype) + coeffs = np.array(unwrap(ob.coeffs)).astype(rtype) terms = [_serialize_ob(t, wires_map, use_csingle) for t in ob.ops] return hamiltonian_obs(coeffs, terms) diff --git a/pennylane_lightning/_version.py b/pennylane_lightning/_version.py index 5808396e8d..5f3b5d5ddf 100644 --- a/pennylane_lightning/_version.py +++ b/pennylane_lightning/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.25.0-dev10" +__version__ = "0.26.0-dev12" diff --git a/pennylane_lightning/lightning_qubit.py b/pennylane_lightning/lightning_qubit.py index c865756569..68b255a26e 100644 --- a/pennylane_lightning/lightning_qubit.py +++ b/pennylane_lightning/lightning_qubit.py @@ -57,7 +57,7 @@ best_alignment, ) - from ._serialize import _serialize_observables, _serialize_ops + from ._serialize import _serialize_ob, _serialize_observables, _serialize_ops CPP_BINARY_AVAILABLE = True except ModuleNotFoundError: @@ -76,14 +76,6 @@ def _remove_snapshot_from_operations(operations): return operations -def _remove_op_arithmetic_from_observables(observables): - observables = observables.copy() - observables.discard("Sum") - observables.discard("SProd") - observables.discard("Prod") - return observables - - class LightningQubit(DefaultQubit): """PennyLane Lightning device. @@ -111,7 +103,6 @@ class LightningQubit(DefaultQubit): author = "Xanadu Inc." _CPP_BINARY_AVAILABLE = True operations = _remove_snapshot_from_operations(DefaultQubit.operations) - observables = _remove_op_arithmetic_from_observables(DefaultQubit.observables) def __init__(self, wires, *, c_dtype=np.complex128, shots=None, batch_obs=False): if c_dtype is np.complex64: @@ -149,7 +140,6 @@ def capabilities(cls): capabilities = super().capabilities().copy() capabilities.update( model="qubit", - supports_reversible_diff=False, supports_inverse_operations=True, supports_analytic_computation=True, supports_broadcasting=False, @@ -618,12 +608,15 @@ def expval(self, observable, shot_range=None, bin_size=None): Returns: Expectation value of the observable """ - if isinstance(observable.name, List) or observable.name in [ - "Identity", - "Projector", - "Hermitian", - "Hamiltonian", - ]: + if ( + (observable.arithmetic_depth > 0) + or isinstance(observable.name, List) + or observable.name + in [ + "Identity", + "Projector", + ] + ): return super().expval(observable, shot_range=shot_range, bin_size=bin_size) if self.shots is not None: @@ -648,6 +641,10 @@ def expval(self, observable, shot_range=None, bin_size=None): ) return super().expval(observable, shot_range=shot_range, bin_size=bin_size) + if observable.name in ["Hamiltonian", "Hermitian"]: + ob_serialized = _serialize_ob(observable, self.wire_map, use_csingle=self.use_csingle) + return M.expval(ob_serialized) + # translate to wire labels used by device observable_wires = self.map_wires(observable.wires) diff --git a/pennylane_lightning/src/algorithms/AlgUtil.hpp b/pennylane_lightning/src/algorithms/AlgUtil.hpp index 8e1f50a064..4ea92712e6 100644 --- a/pennylane_lightning/src/algorithms/AlgUtil.hpp +++ b/pennylane_lightning/src/algorithms/AlgUtil.hpp @@ -66,7 +66,7 @@ inline void applyOperationAdj(StateVectorManagedCPU &state, */ template inline void applyObservable(StateVectorManagedCPU &state, - Observable &observable) { + Simulators::Observable &observable) { observable.applyInPlace(state); } @@ -79,10 +79,11 @@ inline void applyObservable(StateVectorManagedCPU &state, * @param observables Vector of observables to apply to each statevector. */ template -inline void applyObservables( - std::vector> &states, - const StateVectorManagedCPU &reference_state, - const std::vector>> &observables) { +inline void +applyObservables(std::vector> &states, + const StateVectorManagedCPU &reference_state, + const std::vector>> + &observables) { std::exception_ptr ex = nullptr; size_t num_observables = observables.size(); diff --git a/pennylane_lightning/src/algorithms/CMakeLists.txt b/pennylane_lightning/src/algorithms/CMakeLists.txt index 7b7bfca8d1..50e315a4fe 100644 --- a/pennylane_lightning/src/algorithms/CMakeLists.txt +++ b/pennylane_lightning/src/algorithms/CMakeLists.txt @@ -1,6 +1,6 @@ project(lightning_algorithms LANGUAGES CXX) -set(ALGORITHM_FILES AdjointDiff.cpp Observables.cpp JacobianTape.cpp StateVecAdjDiff.cpp CACHE INTERNAL "" FORCE) +set(ALGORITHM_FILES AdjointDiff.cpp JacobianTape.cpp StateVecAdjDiff.cpp CACHE INTERNAL "" FORCE) add_library(lightning_algorithms STATIC ${ALGORITHM_FILES}) target_link_libraries(lightning_algorithms PRIVATE lightning_compile_options diff --git a/pennylane_lightning/src/algorithms/JacobianTape.hpp b/pennylane_lightning/src/algorithms/JacobianTape.hpp index 1c94696a1b..923d20d85e 100644 --- a/pennylane_lightning/src/algorithms/JacobianTape.hpp +++ b/pennylane_lightning/src/algorithms/JacobianTape.hpp @@ -35,6 +35,7 @@ namespace Pennylane::Algorithms { * @brief Utility class for encapsulating operations used by AdjointJacobian * class. */ + template class OpsData { private: size_t num_par_ops_; @@ -206,7 +207,7 @@ template class JacobianData { * @var observables * Observables for which to calculate Jacobian. */ - const std::vector>> observables; + const std::vector>> observables; /** * @var operations @@ -238,7 +239,7 @@ template class JacobianData { * @endrst */ JacobianData(size_t num_params, size_t num_elem, std::complex *ps, - std::vector>> obs, + std::vector>> obs, OpsData ops, std::vector trainP) : num_parameters(num_params), num_elements(num_elem), psi(ps), observables(std::move(obs)), operations(std::move(ops)), @@ -278,7 +279,7 @@ template class JacobianData { * @return List of observables */ [[nodiscard]] auto getObservables() const - -> const std::vector>> & { + -> const std::vector>> & { return observables; } diff --git a/pennylane_lightning/src/bindings/Bindings.cpp b/pennylane_lightning/src/bindings/Bindings.cpp index 9ec619c7b4..92caecefe9 100644 --- a/pennylane_lightning/src/bindings/Bindings.cpp +++ b/pennylane_lightning/src/bindings/Bindings.cpp @@ -18,6 +18,7 @@ #include "Bindings.hpp" #include "GateUtil.hpp" +#include "Measures.hpp" #include "StateVecAdjDiff.hpp" #include "StateVectorManagedCPU.hpp" @@ -27,6 +28,7 @@ namespace { using namespace Pennylane; using namespace Pennylane::Util; +using namespace Pennylane::Simulators; using namespace Pennylane::Algorithms; using namespace Pennylane::Gates; @@ -95,6 +97,13 @@ void lightning_class_bindings(py::module_ &m) { const std::string &, const std::vector &)>( &Measures::expval), "Expected value of an operation by name.") + .def( + "expval", + [](Measures &M, + const std::shared_ptr> &ob) { + return M.expval(*ob); + }, + "Expected value of an operation object.") .def( "expval", [](Measures &M, const np_arr_sparse_ind row_map, @@ -413,7 +422,7 @@ PYBIND11_MODULE(lightning_qubit_ops, // NOLINT: No control over Pybind internals /* Add compile info */ m.def("compile_info", &getCompileInfo, "Compiled binary information."); - /* Add compile info */ + /* Add runtime info */ m.def("runtime_info", &getRuntimeInfo, "Runtime information."); /* Add Kokkos and Kokkos Kernels info */ diff --git a/pennylane_lightning/src/simulator/CMakeLists.txt b/pennylane_lightning/src/simulator/CMakeLists.txt index 50da06f71c..e1ea946e93 100644 --- a/pennylane_lightning/src/simulator/CMakeLists.txt +++ b/pennylane_lightning/src/simulator/CMakeLists.txt @@ -1,23 +1,13 @@ project(lightning_simulator) -set(SIMULATOR_FILES StateVectorRawCPU.cpp StateVectorManagedCPU.cpp Measures.cpp CACHE INTERNAL "" FORCE) +set(SIMULATOR_FILES StateVectorRawCPU.cpp Observables.cpp StateVectorManagedCPU.cpp Measures.cpp CACHE INTERNAL "" FORCE) add_library(lightning_simulator STATIC ${SIMULATOR_FILES}) if (UNIX AND (${CMAKE_SYSTEM_PROCESSOR} MATCHES "(AMD64)|(X64)|(x64)|(x86_64)")) - add_library(lightning_simulator_assign_kernels_x64 STATIC KernelMap_X64.cpp AssignKernelMap_AVX2.cpp AssignKernelMap_AVX512.cpp AssignKernelMap_Default.cpp) - target_link_libraries(lightning_simulator_assign_kernels_x64 PRIVATE lightning_compile_options - lightning_external_libs - lightning_gates - lightning_utils) - target_link_libraries(lightning_simulator PRIVATE lightning_simulator_assign_kernels_x64) + target_sources(lightning_simulator PRIVATE KernelMap_X64.cpp AssignKernelMap_AVX2.cpp AssignKernelMap_AVX512.cpp AssignKernelMap_Default.cpp) else() - add_library(lightning_simulator_assign_kernels_default STATIC KernelMap_Default.cpp AssignKernelMap_Default.cpp) - target_link_libraries(lightning_simulator_assign_kernels_default PRIVATE lightning_compile_options - lightning_external_libs - lightning_gates - lightning_utils) - target_link_libraries(lightning_simulator PRIVATE lightning_simulator_assign_kernels_default) + target_sources(lightning_simulator PRIVATE KernelMap_Default.cpp AssignKernelMap_Default.cpp) endif() target_include_directories(lightning_simulator PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/pennylane_lightning/src/simulator/CPUMemoryModel.hpp b/pennylane_lightning/src/simulator/CPUMemoryModel.hpp index 7ca7893014..2a6e4a0747 100644 --- a/pennylane_lightning/src/simulator/CPUMemoryModel.hpp +++ b/pennylane_lightning/src/simulator/CPUMemoryModel.hpp @@ -23,6 +23,7 @@ #include #include +// LCOV_EXCL_START namespace Pennylane { /** @@ -111,3 +112,4 @@ constexpr auto getBestAllocator() -> Util::AlignedAllocator { return getAllocator(bestCPUMemoryModel()); } } // namespace Pennylane +// LCOV_EXCL_STOP diff --git a/pennylane_lightning/src/simulator/KernelMap_X64.cpp b/pennylane_lightning/src/simulator/KernelMap_X64.cpp index 09e64c3e73..b2fcbff32c 100644 --- a/pennylane_lightning/src/simulator/KernelMap_X64.cpp +++ b/pennylane_lightning/src/simulator/KernelMap_X64.cpp @@ -32,13 +32,17 @@ int assignKernelsForGateOp() { if (RuntimeInfo::AVX2() && RuntimeInfo::FMA()) { assignKernelsForGateOp_AVX2(CPUMemoryModel::Aligned256); + // LCOV_EXCL_START if (!RuntimeInfo::AVX512F()) { assignKernelsForGateOp_AVX2(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP } + // LCOV_EXCL_START if (RuntimeInfo::AVX512F()) { assignKernelsForGateOp_AVX512(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP return 1; } int assignKernelsForGeneratorOp() { @@ -46,13 +50,17 @@ int assignKernelsForGeneratorOp() { if (RuntimeInfo::AVX2() && RuntimeInfo::FMA()) { assignKernelsForGeneratorOp_AVX2(CPUMemoryModel::Aligned256); + // LCOV_EXCL_START if (!RuntimeInfo::AVX512F()) { assignKernelsForGeneratorOp_AVX2(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP } + // LCOV_EXCL_START if (RuntimeInfo::AVX512F()) { assignKernelsForGeneratorOp_AVX512(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP return 1; } int assignKernelsForMatrixOp() { @@ -60,13 +68,17 @@ int assignKernelsForMatrixOp() { if (RuntimeInfo::AVX2() && RuntimeInfo::FMA()) { assignKernelsForMatrixOp_AVX2(CPUMemoryModel::Aligned256); + // LCOV_EXCL_START if (!RuntimeInfo::AVX512F()) { assignKernelsForMatrixOp_AVX2(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP } + // LCOV_EXCL_START if (RuntimeInfo::AVX512F()) { assignKernelsForMatrixOp_AVX512(CPUMemoryModel::Aligned512); } + // LCOV_EXCL_STOP return 1; } } // namespace Pennylane::KernelMap::Internal diff --git a/pennylane_lightning/src/simulator/Measures.cpp b/pennylane_lightning/src/simulator/Measures.cpp index c817639950..513b898f51 100644 --- a/pennylane_lightning/src/simulator/Measures.cpp +++ b/pennylane_lightning/src/simulator/Measures.cpp @@ -15,6 +15,7 @@ #include "Measures.hpp" // explicit instantiation -template class Pennylane::Measures>; -template class Pennylane::Measures>; +template class Pennylane::Simulators::Measures< + float, Pennylane::StateVectorRawCPU>; +template class Pennylane::Simulators::Measures< + double, Pennylane::StateVectorRawCPU>; diff --git a/pennylane_lightning/src/simulator/Measures.hpp b/pennylane_lightning/src/simulator/Measures.hpp index e0d2d53f0c..d053e4359a 100644 --- a/pennylane_lightning/src/simulator/Measures.hpp +++ b/pennylane_lightning/src/simulator/Measures.hpp @@ -30,10 +30,11 @@ #include "Kokkos_Sparse.hpp" #include "LinearAlgebra.hpp" +#include "Observables.hpp" #include "StateVectorManagedCPU.hpp" #include "StateVectorRawCPU.hpp" -namespace Pennylane { +namespace Pennylane::Simulators { /** * @brief Observable's Measurement Class. @@ -217,6 +218,20 @@ class Measures { return expected_value_list; } + /** + * @brief Expectation value for a general Observable + * + * @param ob Observable + */ + auto expval(const Observable &ob) -> fp_t { + StateVectorManagedCPU op_sv(original_statevector); + ob.applyInPlace(op_sv); + const auto inner_prod = + Util::innerProdC(original_statevector.getData(), op_sv.getData(), + original_statevector.getLength()); + return std::real(inner_prod); + } + /** * @brief Variance of an observable. * @@ -380,4 +395,4 @@ class Measures { return samples; } }; // class Measures -} // namespace Pennylane +} // namespace Pennylane::Simulators diff --git a/pennylane_lightning/src/algorithms/Observables.cpp b/pennylane_lightning/src/simulator/Observables.cpp similarity index 57% rename from pennylane_lightning/src/algorithms/Observables.cpp rename to pennylane_lightning/src/simulator/Observables.cpp index d784910db0..8b200a2651 100644 --- a/pennylane_lightning/src/algorithms/Observables.cpp +++ b/pennylane_lightning/src/simulator/Observables.cpp @@ -14,14 +14,14 @@ #include "Observables.hpp" -template class Pennylane::Algorithms::NamedObs; -template class Pennylane::Algorithms::NamedObs; +template class Pennylane::Simulators::NamedObs; +template class Pennylane::Simulators::NamedObs; -template class Pennylane::Algorithms::HermitianObs; -template class Pennylane::Algorithms::HermitianObs; +template class Pennylane::Simulators::HermitianObs; +template class Pennylane::Simulators::HermitianObs; -template class Pennylane::Algorithms::TensorProdObs; -template class Pennylane::Algorithms::TensorProdObs; +template class Pennylane::Simulators::TensorProdObs; +template class Pennylane::Simulators::TensorProdObs; -template class Pennylane::Algorithms::Hamiltonian; -template class Pennylane::Algorithms::Hamiltonian; +template class Pennylane::Simulators::Hamiltonian; +template class Pennylane::Simulators::Hamiltonian; diff --git a/pennylane_lightning/src/algorithms/Observables.hpp b/pennylane_lightning/src/simulator/Observables.hpp similarity index 99% rename from pennylane_lightning/src/algorithms/Observables.hpp rename to pennylane_lightning/src/simulator/Observables.hpp index bf2e765272..f803276e96 100644 --- a/pennylane_lightning/src/algorithms/Observables.hpp +++ b/pennylane_lightning/src/simulator/Observables.hpp @@ -21,7 +21,7 @@ #include #include -namespace Pennylane::Algorithms { +namespace Pennylane::Simulators { /** * @brief A base class for all observable classes. @@ -442,4 +442,4 @@ template class Hamiltonian final : public Observable { } }; -} // namespace Pennylane::Algorithms +} // namespace Pennylane::Simulators diff --git a/pennylane_lightning/src/tests/Test_AdjDiff.cpp b/pennylane_lightning/src/tests/Test_AdjDiff.cpp index a131433ab0..78ffdc5045 100644 --- a/pennylane_lightning/src/tests/Test_AdjDiff.cpp +++ b/pennylane_lightning/src/tests/Test_AdjDiff.cpp @@ -23,6 +23,7 @@ using namespace Pennylane; using namespace Pennylane::Algorithms; +using namespace Pennylane::Simulators; TEST_CASE("Algorithms::adjointJacobian Op=RX, Obs=Z", "[Algorithms]") { const std::vector param{-M_PI / 7, M_PI / 5, 2 * M_PI / 3}; @@ -540,7 +541,7 @@ TEST_CASE( "Algorithms::adjointJacobian with exceedingly complicated Hamiltonian", "[Algorithms]") { using namespace std::literals; - using Pennylane::Algorithms::detail::HamiltonianApplyInPlace; + using Pennylane::Simulators::detail::HamiltonianApplyInPlace; std::vector param{-M_PI / 7, M_PI / 5, 2 * M_PI / 3}; std::vector t_params{0, 2}; diff --git a/pennylane_lightning/src/tests/Test_AlgUtil.cpp b/pennylane_lightning/src/tests/Test_AlgUtil.cpp index 3698ada7ec..51a1853e6b 100644 --- a/pennylane_lightning/src/tests/Test_AlgUtil.cpp +++ b/pennylane_lightning/src/tests/Test_AlgUtil.cpp @@ -5,6 +5,7 @@ using namespace Pennylane; using namespace Pennylane::Algorithms; +using namespace Pennylane::Simulators; class TestException : public std::exception {}; diff --git a/pennylane_lightning/src/tests/Test_Measures.cpp b/pennylane_lightning/src/tests/Test_Measures.cpp index 311cc714c4..ff6760f7bf 100644 --- a/pennylane_lightning/src/tests/Test_Measures.cpp +++ b/pennylane_lightning/src/tests/Test_Measures.cpp @@ -16,6 +16,7 @@ using namespace Pennylane; using namespace Pennylane::Util; +using namespace Pennylane::Simulators; using std::complex; using std::size_t; diff --git a/pennylane_lightning/src/tests/Test_Measures_Sparse.cpp b/pennylane_lightning/src/tests/Test_Measures_Sparse.cpp index 32a2aca8b9..0e361ffde3 100644 --- a/pennylane_lightning/src/tests/Test_Measures_Sparse.cpp +++ b/pennylane_lightning/src/tests/Test_Measures_Sparse.cpp @@ -17,6 +17,7 @@ using namespace Pennylane; using namespace Pennylane::Util; +using namespace Pennylane::Simulators; namespace { using std::complex; diff --git a/pennylane_lightning/src/tests/Test_Observables.cpp b/pennylane_lightning/src/tests/Test_Observables.cpp index fb37dba954..c1b62275a9 100644 --- a/pennylane_lightning/src/tests/Test_Observables.cpp +++ b/pennylane_lightning/src/tests/Test_Observables.cpp @@ -4,7 +4,7 @@ #include using namespace Pennylane; -using namespace Pennylane::Algorithms; +using namespace Pennylane::Simulators; using Pennylane::Util::LightningException; // NOLINTNEXTLINE(readability-function-cognitive-complexity) diff --git a/pennylane_lightning/src/tests/Test_StateVecAdjDiff.cpp b/pennylane_lightning/src/tests/Test_StateVecAdjDiff.cpp index 092e0e380b..8b26641cda 100644 --- a/pennylane_lightning/src/tests/Test_StateVecAdjDiff.cpp +++ b/pennylane_lightning/src/tests/Test_StateVecAdjDiff.cpp @@ -15,6 +15,7 @@ using namespace Pennylane; using namespace Pennylane::Util; using namespace Pennylane::Algorithms; +using namespace Pennylane::Simulators; /** * @brief diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000000..08be6260f0 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,8 @@ +ninja +flaky +numpy +git+https://github.com/PennyLaneAI/pennylane.git@master +pybind11 +pytest +pytest-cov +pytest-mock diff --git a/requirements.txt b/requirements.txt index f945837dca..de0d3cba80 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ ninja flaky numpy -pennylane>=0.15 +pennylane~=0.25 pybind11 pytest pytest-cov diff --git a/setup.py b/setup.py index 89a720c8a5..bf5b0cb9ed 100644 --- a/setup.py +++ b/setup.py @@ -69,12 +69,16 @@ def build_extension(self, ext: CMakeExtension): f"-DCMAKE_MAKE_PROGRAM={ninja_path}", ] + build_args = [] + if debug: configure_args += ["-DCMAKE_BUILD_TYPE=Debug"] + build_args += ["--config", "Debug"] + else: + build_args += ["--config", "RelWithDebInfo"] + configure_args += self.cmake_defines - - build_args = [] - + # Add more platform dependent options if platform.system() == "Darwin": #To support ARM64 @@ -93,20 +97,17 @@ def build_extension(self, ext: CMakeExtension): configure_args += [] else: configure_args += ["-DENABLE_OPENMP=OFF"] - elif platform.system() == "Linux": - if platform.machine() == "x86_64": - configure_args += ["-DENABLE_AVX=ON"] # Enable AVX if x64 on Linux elif platform.system() == "Windows": configure_args += ["-DENABLE_OPENMP=OFF", "-DENABLE_BLAS=OFF"] else: - raise RuntimeError(f"Unsupported '{platform.system()}' platform") + if platform.system() != "Linux": + raise RuntimeError(f"Unsupported '{platform.system()}' platform") if not Path(self.build_temp).exists(): os.makedirs(self.build_temp) subprocess.check_call(["cmake", str(ext.sourcedir)] + configure_args, cwd=self.build_temp) - subprocess.check_call(["cmake", "--build", "."] + build_args, cwd=self.build_temp) - + subprocess.check_call(["cmake", "--build", ".", "--verbose"] + build_args, cwd=self.build_temp) with open(os.path.join("pennylane_lightning", "_version.py")) as f: version = f.readlines()[-1].split()[-1].strip("\"'") diff --git a/tests/test_device.py b/tests/test_device.py index 8a0a7cdba8..9a3bb52a20 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -39,20 +39,3 @@ def test_create_device_with_dtype(C): def test_create_device_with_unsupported_dtype(): with pytest.raises(TypeError, match="Unsupported complex Type:"): dev = qml.device("lightning.qubit", wires=1, c_dtype=np.complex256) - - -def test_no_op_arithmetic_support(): - """Test that lightning qubit explicitly does not support SProd, Prod, and Sum.""" - - dev = qml.device("lightning.qubit", wires=2) - for name in {"Prod", "SProd", "Sum"}: - assert name not in dev.operations - - obs = qml.prod(qml.PauliX(0), qml.PauliY(1)) - - @qml.qnode(dev) - def circuit(): - return qml.expval(obs) - - with pytest.raises(qml.DeviceError, match=r"Observable Prod not supported on device"): - circuit() diff --git a/tests/test_expval.py b/tests/test_expval.py index b85a856254..e12b017b4b 100644 --- a/tests/test_expval.py +++ b/tests/test_expval.py @@ -110,6 +110,89 @@ def test_hadamard_expectation(self, theta, phi, qubit_device_3_wires, tol): assert np.allclose(res, expected, tol) +@pytest.mark.parametrize("diff_method", ("parameter-shift", "adjoint")) +class TestExpOperatorArithmetic: + """Test integration of lightning with SProd, Prod, and Sum.""" + + dev = qml.device("lightning.qubit", wires=2) + + def test_sprod(self, diff_method): + """Test the `SProd` class with lightning qubit.""" + + @qml.qnode(self.dev, diff_method=diff_method) + def circuit(x): + qml.RX(x, wires=0) + return qml.expval(qml.s_prod(0.5, qml.PauliZ(0))) + + x = qml.numpy.array(0.123, requires_grad=True) + res = circuit(x) + assert qml.math.allclose(res, 0.5 * np.cos(x)) + + g = qml.grad(circuit)(x) + expected_grad = -0.5 * np.sin(x) + assert qml.math.allclose(g, expected_grad) + + def test_prod(self, diff_method): + """Test the `Prod` class with lightning qubit.""" + + @qml.qnode(self.dev, diff_method=diff_method) + def circuit(x): + qml.RX(x, wires=0) + qml.Hadamard(1) + qml.PauliZ(1) + return qml.expval(qml.prod(qml.PauliZ(0), qml.PauliX(1))) + + x = qml.numpy.array(0.123, requires_grad=True) + res = circuit(x) + assert qml.math.allclose(res, -np.cos(x)) + + g = qml.grad(circuit)(x) + expected_grad = np.sin(x) + assert qml.math.allclose(g, expected_grad) + + def test_sum(self, diff_method): + """Test the `Sum` class with lightning qubit.""" + + @qml.qnode(self.dev, diff_method=diff_method) + def circuit(x, y): + qml.RX(x, wires=0) + qml.RY(y, wires=1) + return qml.expval(qml.op_sum(qml.PauliZ(0), qml.PauliX(1))) + + x = qml.numpy.array(-3.21, requires_grad=True) + y = qml.numpy.array(2.34, requires_grad=True) + res = circuit(x, y) + assert qml.math.allclose(res, np.cos(x) + np.sin(y)) + + g = qml.grad(circuit)(x, y) + expected = (-np.sin(x), np.cos(y)) + assert qml.math.allclose(g, expected) + + def test_integration(self, diff_method): + """Test a Combination of `Sum`, `SProd`, and `Prod`.""" + + obs = qml.op_sum( + qml.s_prod(2.3, qml.PauliZ(0)), -0.5 * qml.prod(qml.PauliY(0), qml.PauliZ(1)) + ) + + @qml.qnode(self.dev, diff_method=diff_method) + def circuit(x, y): + qml.RX(x, wires=0) + qml.RY(y, wires=1) + return qml.expval(obs) + + x = qml.numpy.array(0.654, requires_grad=True) + y = qml.numpy.array(-0.634, requires_grad=True) + + res = circuit(x, y) + expected = 2.3 * np.cos(x) + 0.5 * np.sin(x) * np.cos(y) + assert qml.math.allclose(res, expected) + + g = qml.grad(circuit)(x, y) + expected = (-2.3 * np.sin(x) + 0.5 * np.cos(y) * np.cos(x), -0.5 * np.sin(x) * np.sin(y)) + assert qml.math.allclose(g, expected) + + @pytest.mark.parametrize("theta,phi,varphi", list(zip(THETA, PHI, VARPHI))) class TestTensorExpval: """Test tensor expectation values""" diff --git a/tests/test_measures.py b/tests/test_measures.py index 0492200c17..4c83c24b4c 100644 --- a/tests/test_measures.py +++ b/tests/test_measures.py @@ -227,6 +227,41 @@ def circuit(): assert np.allclose(circuit(), cases[1], atol=tol, rtol=0) + @pytest.mark.parametrize( + "obs, coeffs, res", + [ + ([qml.PauliX(0) @ qml.PauliZ(1)], [1.0], 0.0), + ([qml.PauliZ(0) @ qml.PauliZ(1)], [1.0], math.cos(0.4) * math.cos(-0.2)), + ( + [ + qml.PauliX(0) @ qml.PauliZ(1), + qml.Hermitian( + [ + [1.0, 0.0, 0.0, 0.0], + [0.0, 3.0, 0.0, 0.0], + [0.0, 0.0, -1.0, 1.0], + [0.0, 0.0, 1.0, -2.0], + ], + wires=[0, 1], + ), + ], + [0.3, 1.0], + 0.9319728930156066, + ), + ], + ) + def test_expval_hamiltonian(self, obs, coeffs, res, tol, dev): + """Test expval with Hamiltonian""" + ham = qml.Hamiltonian(coeffs, obs) + + @qml.qnode(dev) + def circuit(): + qml.RX(0.4, wires=[0]) + qml.RY(-0.2, wires=[1]) + return qml.expval(ham) + + assert np.allclose(circuit(), res, atol=tol, rtol=0) + def test_value(self, dev, tol): """Test that the expval interface works""" @@ -248,9 +283,9 @@ def test_not_an_observable(self, dev): @qml.qnode(dev) def circuit(): qml.RX(0.52, wires=0) - return qml.expval(qml.CNOT(wires=[0, 1])) + return qml.expval(qml.RX(0.742, wires=[0])) - with pytest.raises(qml.QuantumFunctionError, match="CNOT is not an observable"): + with pytest.raises(qml._device.DeviceError, match="Observable RX not supported"): circuit() def test_observable_return_type_is_expectation(self, dev): @@ -348,10 +383,10 @@ def test_not_an_observable(self, dev): @qml.qnode(dev) def circuit(): qml.RX(0.52, wires=0) - return qml.var(qml.CNOT(wires=[0, 1])) + return qml.var(qml.RX(0.742, wires=[0])) - with pytest.raises(qml.QuantumFunctionError, match="CNOT is not an observable"): - res = circuit() + with pytest.raises(qml._device.DeviceError, match="Observable RX not supported"): + circuit() def test_observable_return_type_is_variance(self, dev): """Test that the return type of the observable is :attr:`ObservableReturnTypes.Variance`""" @@ -377,9 +412,9 @@ def test_not_an_observable(self, stat_func): @qml.qnode(dev) def circuit(): qml.RX(0.52, wires=0) - return stat_func(qml.CNOT(wires=[0, 1])) + return qml.var(qml.RX(0.742, wires=[0])) - with pytest.raises(qml.QuantumFunctionError, match="CNOT is not an observable"): + with pytest.raises(qml._device.DeviceError, match="Observable RX not supported"): circuit() @@ -428,6 +463,55 @@ def circuit2(): assert np.allclose(circuit1(), circuit2(), atol=tol) + @pytest.mark.parametrize( + "wires1, wires2", + [ + ([2, 3, 0], [2, 3, 0]), + ([0, 1], [0, 1]), + ([0, 2, 3], [2, 0, 3]), + (["a", "c", "d"], [2, 3, 0]), + ([-1, -2, -3], ["q1", "ancilla", 2]), + (["a", "c"], [3, 0]), + ([-1, -2], ["ancilla", 2]), + ], + ) + @pytest.mark.parametrize("C", [np.complex64, np.complex128]) + def test_wires_expval_hermitian(self, wires1, wires2, C, tol): + """Test that the expectation of a circuit is independent from the wire labels used.""" + dev1 = qml.device("lightning.qubit", wires=wires1, c_dtype=C) + dev1._state = dev1._asarray(dev1._state, C) + + dev2 = qml.device("lightning.qubit", wires=wires2) + dev2._state = dev2._asarray(dev2._state, C) + ob_mat = [ + [1.0, 2.0, 0.0, 1.0], + [2.0, -1.0, 0.0, 0.0], + [0.0, 0.0, 2.0, 0.0], + [1.0, 0.0, 0.0, -1.0], + ] + + n_wires = len(wires1) + ob1 = qml.Hermitian(ob_mat, wires=[wires1[0 % n_wires], wires1[1 % n_wires]]) + ob2 = qml.Hermitian(ob_mat, wires=[wires2[0 % n_wires], wires2[1 % n_wires]]) + + @qml.qnode(dev1) + def circuit1(): + qml.RX(0.5, wires=wires1[0 % n_wires]) + qml.RY(2.0, wires=wires1[1 % n_wires]) + if n_wires > 1: + qml.CNOT(wires=[wires1[0], wires1[1]]) + return [qml.expval(ob1)] + + @qml.qnode(dev2) + def circuit2(): + qml.RX(0.5, wires=wires2[0 % n_wires]) + qml.RY(2.0, wires=wires2[1 % n_wires]) + if n_wires > 1: + qml.CNOT(wires=[wires2[0], wires2[1]]) + return [qml.expval(ob2)] + + assert np.allclose(circuit1(), circuit2(), atol=tol) + class TestSample: """Tests that samples are properly calculated."""