Skip to content

Commit

Permalink
Remove CPhase + Tidy up src (#717)
Browse files Browse the repository at this point in the history
* Remove CPhase; Tidy up NDPermuter, gh scripts, and doc

* Add release_notes to docs

* Auto update version from '0.37.0-dev0' to '0.37.0-dev2'

* Update changelog

* Auto update version from '0.37.0-dev2' to '0.37.0-dev3'

* trigger ci

* Revert change in config.h

* Update

* Update

* Update

* Auto update version from '0.37.0-dev3' to '0.37.0-dev4'

* Fix _version

* Auto update version from '0.37.0-dev6' to '0.37.0-dev7'

* Update format

* trigger ci

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
  • Loading branch information
maliasadi and ringo-but-quantum committed May 10, 2024
1 parent 3187d24 commit c164f2e
Show file tree
Hide file tree
Showing 199 changed files with 5,975 additions and 5,411 deletions.
10 changes: 8 additions & 2 deletions .github/CHANGELOG.md
Expand Up @@ -9,10 +9,16 @@

### Improvements

* Update C++ and Python GitHub actions names to include the matrix info.
[(#717)](https://github.com/PennyLaneAI/pennylane-lightning/pull/717)

* Remove `CPhase` in favour of `CPhaseShift` in Lightning devices.
[(#717)](https://github.com/PennyLaneAI/pennylane-lightning/pull/717)

* The various OpenMP configurations of Lightning-Qubit are tested in parallel on different Github Actions runners.
[(#712)](https://github.com/PennyLaneAI/pennylane-lightning/pull/712)

* Update Linux wheels to use manylinux_2_28 images.
* Update Linux wheels to use `manylinux_2_28` images.
[(#667)](https://github.com/PennyLaneAI/pennylane-lightning/pull/667)

* Add support for `qml.expval` and `qml.var` in the `lightning.tensor` device for the `quimb` interface and the MPS method.
Expand All @@ -29,7 +35,7 @@

This release contains contributions from (in alphabetical order):

Amintor Dusko, Pietropaolo Frisoni, Vincent Michaud-Rioux, Mudit Pandey
Ali Asadi, Amintor Dusko, Pietropaolo Frisoni, Vincent Michaud-Rioux, Mudit Pandey

---

Expand Down
34 changes: 23 additions & 11 deletions .github/workflows/dev_version_script.py
Expand Up @@ -12,14 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import re
import argparse
import re
from pathlib import Path

try:
from semver import Version
except ImportError as exc:
raise ImportError("Unable to import semver. Install semver by running `pip install semver`") from exc
raise ImportError(
"Unable to import semver. Install semver by running `pip install semver`"
) from exc

DEV_PRERELEASE_TAG_PREFIX = "dev"
DEV_PRERELEASE_TAG_START = "dev0"
Expand All @@ -45,10 +47,14 @@ def extract_version(repo_root_path: Path) -> Version:
if line.startswith("__version__"):
if (m := rgx_ver.match(line.strip())) is not None:
if not m.groups():
raise ValueError(f"Unable to find valid semver for __version__. Got: '{line}'")
raise ValueError(
f"Unable to find valid semver for __version__. Got: '{line}'"
)
parsed_semver = m.group(1)
if not Version.is_valid(parsed_semver):
raise ValueError(f"Invalid semver for __version__. Got: '{parsed_semver}' from line '{line}'")
raise ValueError(
f"Invalid semver for __version__. Got: '{parsed_semver}' from line '{line}'"
)
return Version.parse(parsed_semver)
raise ValueError(f"Unable to find valid semver for __version__. Got: '{line}'")
raise ValueError("Cannot parse version")
Expand All @@ -67,10 +73,7 @@ def update_prerelease_version(repo_root_path: Path, version: Version):
raise FileNotFoundError(f"Unable to find version file at location {version_file_path}")

with version_file_path.open() as f:
lines = [
rgx_ver.sub(f"__version__ = \"{str(version)}\"", line)
for line in f
]
lines = [rgx_ver.sub(f'__version__ = "{str(version)}"', line) for line in f]

with version_file_path.open("w") as f:
f.write("".join(lines))
Expand Down Expand Up @@ -98,8 +101,14 @@ def update_prerelease_version(repo_root_path: Path, version: Version):
# If a PR is of a higher version AND the prerelease tag is reset, then do nothing
# This captures the case during release where we might bump the release version
# within a PR and reset tag back to dev0
if pr_version > master_version and pr_version.prerelease and pr_version.prerelease == DEV_PRERELEASE_TAG_START:
print("This Pull Request is upgrading the package version to next release ... skipping bumping!")
if (
pr_version > master_version
and pr_version.prerelease
and pr_version.prerelease == DEV_PRERELEASE_TAG_START
):
print(
"This Pull Request is upgrading the package version to next release ... skipping bumping!"
)
print("If this is happening in error, please report it to the PennyLane team!")
elif pr_version.prerelease and pr_version.prerelease.startswith(DEV_PRERELEASE_TAG_PREFIX):
# If master branch does not have a prerelease (for any reason) OR does not have an ending number
Expand All @@ -109,7 +118,10 @@ def update_prerelease_version(repo_root_path: Path, version: Version):
else:
# If master branch does not have a prerelease (for any reason) OR does not have an ending number
# Then default to the starting tag
if not master_version.prerelease or master_version.prerelease == DEV_PRERELEASE_TAG_PREFIX:
if (
not master_version.prerelease
or master_version.prerelease == DEV_PRERELEASE_TAG_PREFIX
):
next_prerelease_version = DEV_PRERELEASE_TAG_START
else:
# Generate the next prerelease version (eg: dev1 -> dev2). Sourcing from master version.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lgpu_cpp.yml
Expand Up @@ -63,7 +63,7 @@ jobs:
pl_backend: ["lightning_gpu"]
cuda_version: ["12"]

name: C++ tests (Lightning-GPU)
name: C++ Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }})
runs-on:
- ubuntu-22.04
- self-hosted
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/tests_lgpu_python.yml
Expand Up @@ -66,7 +66,7 @@ jobs:
default_backend: ["lightning_qubit"]
cuda_version: ["12"]

name: Python tests with LGPU
name: Python Tests (${{ matrix.pl_backend }}, cuda-${{ matrix.cuda_version }})
runs-on:
- ubuntu-22.04
- self-hosted
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
py_path=$(which python)
echo "Python Interpreter Path => $py_path"
echo "python=$py_path" >> $GITHUB_OUTPUT
pip_path=$(which python)
echo "PIP Path => $pip_path"
echo "pip=$pip_path" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
python -m pip uninstall -y pennylane && python -m pip install -U pennylane
- name: Build and install package
env:
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
run: |
cd main
Expand All @@ -181,34 +181,34 @@ jobs:
- name: Run PennyLane-Lightning-GPU unit tests
if: ${{ matrix.pl_backend != 'all'}}
env:
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
run: |
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --skip-ops --shots=20000 $COVERAGE_FLAGS --cov-append
pl-device-test --device ${DEVICENAME} --shots=None --skip-ops $COVERAGE_FLAGS --cov-append
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
mv coverage.xml coverage-${{ github.job }}-${{ matrix.pl_backend }}.xml
- name: Install all backend devices
if: ${{ matrix.pl_backend == 'all' }}
env:
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum')")
run: |
cd main
rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{matrix.default_backend}} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install . -vv
rm -rf build
CMAKE_ARGS="-DPL_BACKEND=${{ matrix.pl_backend }} -DENABLE_PYTHON=ON -DCMAKE_CXX_COMPILER=$(which g++-$GCC_VERSION)" \
python -m pip install . -vv
- name: Run PennyLane-Lightning unit tests for lightning.qubit with all devices installed
if: ${{ matrix.pl_backend == 'all' }}
env:
env:
OMP_NUM_THREADS: 1
OMP_PROC_BIND: false
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lgpumpi_cpp.yml
Expand Up @@ -184,7 +184,7 @@ jobs:
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Cleanup
if: always()
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests_linux_cpp.yml
Expand Up @@ -51,7 +51,7 @@ jobs:
- enable_kernel_omp: OFF
enable_kernel_avx_stream: ON
timeout-minutes: 60
name: C++ tests
name: C++ Tests (${{ matrix.pl_backend }}, ENABLE_KERNEL_OMP=${{ matrix.enable_kernel_omp }}, ENABLE_KERNEL_AVX_STREAM=${{ matrix.enable_kernel_avx_stream }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
matrix:
pl_backend: ["lightning_qubit"]
timeout-minutes: 60
name: C++ tests (OpenBLAS)
name: C++ Tests (${{ matrix.pl_backend }}, blas-ON)
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down Expand Up @@ -181,7 +181,7 @@ jobs:
exec_model: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.kokkos_version) }}
timeout-minutes: 60
name: C++ tests (Kokkos)
name: C++ Tests (${{ matrix.pl_backend }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down Expand Up @@ -275,7 +275,7 @@ jobs:
exec_model: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.kokkos_version) }}
timeout-minutes: 60
name: C++ tests (multiple backends)
name: C++ Tests (multiple-backends, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_lkcpu_python.yml
Expand Up @@ -58,7 +58,7 @@ jobs:
exec_model: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.kokkos_version) }}
timeout-minutes: 60
name: Python tests with Kokkos
name: Build (${{ matrix.pl_backend }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down Expand Up @@ -153,7 +153,7 @@ jobs:
exec_model: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.build_and_cache_Kokkos.outputs.kokkos_version) }}
timeout-minutes: 60
name: Python tests with Kokkos
name: Python Tests (${{ matrix.pl_backend }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }}, test-group-${{ matrix.group }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lkcuda_cpp.yml
Expand Up @@ -111,7 +111,7 @@ jobs:
exec_model: ["CUDA"]
kokkos_version: ["4.2.00"]

name: C++ tests (Kokkos)
name: C++ Tests (${{ matrix.pl_backend }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on:
- ${{ matrix.os }}
- self-hosted
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests_lkcuda_python.yml
Expand Up @@ -112,7 +112,7 @@ jobs:
exec_model: ["CUDA"]
kokkos_version: ["4.2.00"]

name: Python tests with Kokkos
name: Python Tests (${{ matrix.pl_backend }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on:
- ${{ matrix.os }}
- self-hosted
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests_lqcpu_python.yml
Expand Up @@ -49,7 +49,7 @@ jobs:
pl_backend: ["lightning_qubit"]
blas: ["OFF", "ON"]
timeout-minutes: 60
name: Python tests
name: Build (${{ matrix.pl_backend }}, blas-${{ matrix.blas }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down Expand Up @@ -126,7 +126,7 @@ jobs:
blas: ["OFF", "ON"]
group: [1, 2, 3, 4]
timeout-minutes: 60
name: Python tests
name: Python Tests (${{ matrix.pl_backend }}, blas-${{ matrix.blas }}, test-group-${{ matrix.group }})
runs-on: ${{ needs.determine_runner.outputs.runner_group }}

steps:
Expand Down
11 changes: 6 additions & 5 deletions .github/workflows/tests_windows_cpp.yml
Expand Up @@ -53,7 +53,7 @@ jobs:
exec_model: ${{ fromJson(needs.win-set-matrix-x86.outputs.exec_model) }}
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}
timeout-minutes: 30
name: Kokkos core (${{ matrix.exec_model }})
name: Build Kokkos core (kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -100,12 +100,13 @@ jobs:
cpptests:
if: ${{ !contains(fromJSON('["schedule", "workflow_dispatch"]'), github.event_name) }}
timeout-minutes: 30
name: C++ tests (Windows)
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
pl_backend: ["lightning_qubit"]
name: C++ Tests (${{ matrix.pl_backend }}, on-${{ matrix.os }})

steps:
- uses: actions/setup-python@v4
name: Install Python
Expand All @@ -114,7 +115,7 @@ jobs:

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

- name: Install dependencies
run: |
python -m pip install cmake build ninja scipy
Expand Down Expand Up @@ -155,7 +156,7 @@ jobs:
name: windows-test-report-${{ github.job }}-${{ matrix.pl_backend }}
path: .\Build\tests\results\
if-no-files-found: error

- name: Upload coverage results
uses: actions/upload-artifact@v3
with:
Expand All @@ -174,7 +175,7 @@ jobs:
kokkos_version: ${{ fromJson(needs.win-set-matrix-x86.outputs.kokkos_version) }}

timeout-minutes: 30
name: C++ tests (Windows, Kokkos)
name: C++ Tests (${{matrix.pl_backend}}, on-${{ matrix.os }}, kokkos-${{ matrix.kokkos_version }}, model-${{ matrix.exec_model }})
runs-on: ${{ matrix.os }}

steps:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/tests_without_binary.yml
Expand Up @@ -34,12 +34,13 @@ jobs:
pythontests:
needs: [determine_runner]
timeout-minutes: 30
name: Python tests
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
strategy:
matrix:
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu"]

name: Python Tests without Binary (${{ matrix.pl_backend }})

steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/vb_script.py
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import argparse

import pennylane as qml

pl_version = '"' + qml.version() + '"'
Expand Down
2 changes: 1 addition & 1 deletion doc/docker.rst → doc/dev/docker.rst
@@ -1,3 +1,3 @@
.. include:: ../README.rst
.. include:: ../../README.rst
:start-after: docker-start-inclusion-marker-do-not-remove
:end-before: docker-end-inclusion-marker-do-not-remove
12 changes: 6 additions & 6 deletions doc/installation.rst → doc/dev/installation.rst
Expand Up @@ -6,17 +6,17 @@ Each device in the Lightning ecosystem is a separate Python package. Select the
.. title-card::
:name: Lightning Qubit
:description: Guidelines to installing and testing the Lightning Qubit device.
:link: ./lightning_qubit/installation.html
:link: ../lightning_qubit/installation.html

.. title-card::
:name: Lightning GPU
:description: Guidelines to installing and testing the Lightning GPU device
:link: ./lightning_gpu/installation.html
:link: ../lightning_gpu/installation.html

.. title-card::
:name: Lightning Kokkos
:description: Guidelines to installing and testing the Lightning Kokkos device
:link: ./lightning_kokkos/installation.html
:link: ../lightning_kokkos/installation.html

.. raw:: html

Expand All @@ -26,6 +26,6 @@ Each device in the Lightning ecosystem is a separate Python package. Select the
.. toctree::
:hidden:

lightning_qubit/installation
lightning_gpu/installation
lightning_kokkos/installation
../lightning_qubit/installation
../lightning_gpu/installation
../lightning_kokkos/installation
2 changes: 1 addition & 1 deletion doc/support.rst → doc/dev/support.rst
@@ -1,3 +1,3 @@
.. include:: ../README.rst
.. include:: ../../README.rst
:start-after: support-start-inclusion-marker-do-not-remove
:end-before: support-end-inclusion-marker-do-not-remove

0 comments on commit c164f2e

Please sign in to comment.