From 437d81b65e840c3721daf73acec72e25241d6893 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:20:14 -0400 Subject: [PATCH 01/16] Update determine runner workflow to use large runners if the branch name matches a certain format --- .github/workflows/determine-workflow-runner.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index 78919a9762..edb865324c 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -33,8 +33,10 @@ jobs: if: >- ${{ github.event_name == 'pull_request' - && contains(github.event.pull_request.labels.*.name, 'urgent') && startsWith(inputs.default_runner, 'ubuntu') }} id: runner_group - run: echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT \ No newline at end of file + run: | + if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then + echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT + fi From bdd1a37cd53cfa4658d83f74a3857e445d3f20c7 Mon Sep 17 00:00:00 2001 From: ringo-but-quantum Date: Tue, 18 Jun 2024 20:21:35 +0000 Subject: [PATCH 02/16] Auto update version from '0.37.0-dev42' to '0.37.0-dev43' --- pennylane_lightning/core/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index d9e5793cb2..054ae191d1 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.37.0-dev42" +__version__ = "0.37.0-dev43" From e94e0b22e171ff8f2c1dc5c73aa90af2a422b4c8 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:25:50 -0400 Subject: [PATCH 03/16] Change parameter to use head_ref --- .github/workflows/determine-workflow-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index edb865324c..5701079545 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -37,6 +37,6 @@ jobs: }} id: runner_group run: | - if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then + if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.head_ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT fi From cf2b19e9eda32c864211be6aa7f55c2e10326868 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:30:12 -0400 Subject: [PATCH 04/16] Use head.ref from pr context --- .github/workflows/determine-workflow-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index 5701079545..5441cccc7a 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -37,6 +37,6 @@ jobs: }} id: runner_group run: | - if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.head_ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then + if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.event.pull_request.head.ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT fi From 8027b632a37900c88404ea787925ba654078d39b Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:33:09 -0400 Subject: [PATCH 05/16] Don't use branch name for large runner if forked PR --- .github/workflows/determine-workflow-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index 5441cccc7a..a0252980bf 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -37,6 +37,6 @@ jobs: }} id: runner_group run: | - if [[ ${{ contains(github.event.pull_request.labels.*.name, 'urgent') }} == 'true' || "${{ github.event.pull_request.head.ref }}" =~ refs\/heads\/v\d+\.\d+\.\d+-rc\d? ]]; then + if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane-lightning' }}' == 'true' && "${{ github.event.pull_request.head.ref }}" =~ v\d+\.\d+\.\d+-rc\d?) ]]; then echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT fi From d817eedbf922ec8a6b85f5aa922dca87402fd632 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Wed, 19 Jun 2024 10:49:46 -0400 Subject: [PATCH 06/16] Fix regex --- .github/workflows/determine-workflow-runner.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index a0252980bf..4bb994275f 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -36,7 +36,11 @@ jobs: && startsWith(inputs.default_runner, 'ubuntu') }} id: runner_group + env: + # We are not able to use \d to check numeric values as bash does not allow them (not POSIX compliant) + RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]? + REPO_FULL_NAME: PennyLaneAI/pennylane-lightning run: | - if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name == 'PennyLaneAI/pennylane-lightning' }}' == 'true' && "${{ github.event.pull_request.head.ref }}" =~ v\d+\.\d+\.\d+-rc\d?) ]]; then + if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ "$RC_BRANCH_FORMAT_REGEX") ]]; then echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT fi From ccabde6c27909ec78b2aadcdcbe742f1fc78a050 Mon Sep 17 00:00:00 2001 From: ringo-but-quantum Date: Wed, 19 Jun 2024 14:50:20 +0000 Subject: [PATCH 07/16] Auto update version from '0.37.0-dev43' to '0.37.0-dev44' --- pennylane_lightning/core/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 054ae191d1..46f1c1e8ff 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.37.0-dev43" +__version__ = "0.37.0-dev44" From 544a07fad0d45cc09dc070e954c6f39a6db620c5 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:18:12 -0400 Subject: [PATCH 08/16] Trigger CI From 48e2df1aa0f10cd2c66912ad51262214d5e6fae2 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:18:20 -0400 Subject: [PATCH 09/16] Trigger CI From 1672f4c6aef443c51b6ac18fb5c7572600247cdc Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Wed, 19 Jun 2024 14:11:40 -0400 Subject: [PATCH 10/16] Update changelog --- .github/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 9fe7cf5066..61db240bb6 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -35,6 +35,8 @@ ### Improvements +* Release candidate branches are automatically switched over to using the new large GitHub runner pool [(#769)](https://github.com/PennyLaneAI/pennylane-lightning/pull/769) + * LightningKokkos dev wheels for MacOS (x86_64, ARM64) and Linux (aarch64) are uploaded to TestPyPI upon PR merge. [(#765)](https://github.com/PennyLaneAI/pennylane-lightning/pull/765) From 2d967a84bf95c7b89e580765369ec2022a1f4dd2 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Fri, 21 Jun 2024 12:25:42 -0400 Subject: [PATCH 11/16] Fix issue with regex check and added additional echo statements to show progress --- .github/workflows/determine-workflow-runner.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index 4bb994275f..bd2d0b4afc 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -41,6 +41,9 @@ jobs: RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]? REPO_FULL_NAME: PennyLaneAI/pennylane-lightning run: | - if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ "$RC_BRANCH_FORMAT_REGEX") ]]; then + if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ $RC_BRANCH_FORMAT_REGEX) ]]; then + echo "This job requires usage of the large runner group '$LARGE_RUNNER_GROUP_NAME'"; echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT + else + echo "This job does not require usage of large runners ..."; fi From b97e69fd20fe6c0be8d13e12ee830748fa1ec175 Mon Sep 17 00:00:00 2001 From: ringo-but-quantum Date: Fri, 21 Jun 2024 16:34:56 +0000 Subject: [PATCH 12/16] Auto update version from '0.37.0-dev45' to '0.37.0-dev46' --- pennylane_lightning/core/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index f288d1200e..8a46df66d0 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.37.0-dev45" +__version__ = "0.37.0-dev46" From 51638cbb0056c786637c3c8b43973efdcea5d763 Mon Sep 17 00:00:00 2001 From: Vincent Michaud-Rioux Date: Thu, 20 Jun 2024 15:26:56 -0400 Subject: [PATCH 13/16] Fix bug in large runner determination workflow Fix issue with regex check and added additional echo statements to show progress --- .github/CHANGELOG.md | 1 + .../workflows/determine-workflow-runner.yml | 5 +- .github/workflows/docker_linux_x86_64.yml | 4 +- Makefile | 2 +- docker/Dockerfile | 123 +++--------- pennylane_lightning/core/_version.py | 2 +- .../gates/BasicGateFunctors.hpp | 179 +++++++++++------- .../gates/BasicGeneratorFunctors.hpp | 115 ++++++----- 8 files changed, 216 insertions(+), 215 deletions(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 871b50c2d0..4e7b73b709 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -35,6 +35,7 @@ ### Improvements + * Release candidate branches are automatically switched over to using the new large GitHub runner pool. [(#769)](https://github.com/PennyLaneAI/pennylane-lightning/pull/769) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index 4bb994275f..bd2d0b4afc 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -41,6 +41,9 @@ jobs: RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]? REPO_FULL_NAME: PennyLaneAI/pennylane-lightning run: | - if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ "$RC_BRANCH_FORMAT_REGEX") ]]; then + if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ $RC_BRANCH_FORMAT_REGEX) ]]; then + echo "This job requires usage of the large runner group '$LARGE_RUNNER_GROUP_NAME'"; echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT + else + echo "This job does not require usage of large runners ..."; fi diff --git a/.github/workflows/docker_linux_x86_64.yml b/.github/workflows/docker_linux_x86_64.yml index 77b315f7bc..e3a622903e 100644 --- a/.github/workflows/docker_linux_x86_64.yml +++ b/.github/workflows/docker_linux_x86_64.yml @@ -12,7 +12,7 @@ on: lightning-version: type: string required: true - description: The version of Lightning to use. This should be a valid semantic version, e.g. 0.34.0. + description: The version of Lightning to use. This should be a valid git tag, e.g. v0.36.0. push-to-dockerhub: type: boolean required: true @@ -22,7 +22,7 @@ on: lightning-version: type: string required: true - description: The version of Lightning to use. This should be a valid semantic version, e.g. 0.34.0. + description: The version of Lightning to use. This should be a valid git tag, e.g. v0.36.0. push-to-dockerhub: type: boolean required: true diff --git a/Makefile b/Makefile index 3d40597db9..55bf7b55a5 100644 --- a/Makefile +++ b/Makefile @@ -150,7 +150,7 @@ endif ifdef version VERSION := $(version) else - VERSION := v0.35.0 + VERSION := v0.36.0 endif docker-build: diff --git a/docker/Dockerfile b/docker/Dockerfile index cec4284bef..33b1139457 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -16,17 +16,19 @@ # Define build arguments # Create and activate runtime virtual environment FROM ubuntu:jammy AS base-runtime -ARG AMD_ARCH=AMD_GFX90A ARG CUDA_ARCH=AMPERE80 +ARG AMD_ARCH=AMD_GFX90A ARG CUDA_INSTALLER=https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run +ARG DEBIAN_FRONTEND=noninteractive ARG GCC_VERSION=11 -ARG KOKKOS_VERSION=4.3.01 ARG LIGHTNING_VERSION=v0.36.0 -ARG ROCM_INSTALLER=https://repo.radeon.com/amdgpu-install/5.7/ubuntu/jammy/amdgpu-install_5.7.50700-1_all.deb +ARG PENNYLANE_VERSION=v0.36.0 +ARG ROCM_INSTALLER=https://repo.radeon.com/amdgpu-install/6.1.1/ubuntu/jammy/amdgpu-install_6.1.60101-1_all.deb RUN apt-get update \ && apt-get install --no-install-recommends -y \ apt-utils \ ca-certificates \ + git \ libgomp1 \ python3 \ python3-pip \ @@ -47,7 +49,6 @@ RUN apt-get update \ ccache \ cmake \ curl \ - git \ ninja-build \ python3-dev \ gcc-${GCC_VERSION} g++-${GCC_VERSION} cpp-${GCC_VERSION} \ @@ -70,9 +71,7 @@ RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" RUN rm -rf tmp && git clone --depth 1 --branch ${LIGHTNING_VERSION} https://github.com/PennyLaneAI/pennylane-lightning.git tmp\ && mv tmp/* /opt/pennylane-lightning && rm -rf tmp -RUN pip install --no-cache-dir wheel -RUN pip install --no-cache-dir -r requirements-dev.txt -RUN pip install --no-cache-dir -r doc/requirements.txt +RUN pip install --no-cache-dir cmake ninja pybind11 wheel # Download Lightning release and build lightning-qubit backend FROM base-build-python AS build-wheel-lightning-qubit @@ -85,44 +84,22 @@ RUN python setup.py bdist_wheel FROM base-runtime AS wheel-lightning-qubit COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ / RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl -RUN pip install --no-cache-dir -U pennylane - -# Download Kokkos release and build OpenMP backend -FROM base-build as build-kokkos-openmp -WORKDIR /opt/kokkos-${KOKKOS_VERSION} -RUN wget --progress=dot:giga https://github.com/kokkos/kokkos/archive/refs/tags/${KOKKOS_VERSION}.tar.gz -RUN tar -zxf ${KOKKOS_VERSION}.tar.gz && mv /opt/kokkos-${KOKKOS_VERSION}/kokkos-${KOKKOS_VERSION}/* /opt/kokkos-${KOKKOS_VERSION} -RUN cmake -S /opt/kokkos-${KOKKOS_VERSION} -B /opt/kokkos-${KOKKOS_VERSION}/build \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/kokkos \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DKokkos_ENABLE_SERIAL:BOOL=ON \ - -DKokkos_ENABLE_OPENMP:BOOL=ON \ - -DCMAKE_CXX_STANDARD=20 \ - -DKokkos_ENABLE_EXAMPLES:BOOL=OFF \ - -DKokkos_ENABLE_TESTS:BOOL=OFF \ - -DKokkos_ENABLE_LIBDL:BOOL=OFF -RUN cmake --build /opt/kokkos-${KOKKOS_VERSION}/build -RUN cmake --install /opt/kokkos-${KOKKOS_VERSION}/build +RUN pip install --no-cache-dir git+https://github.com/PennyLaneAI/pennylane.git@${PENNYLANE_VERSION} # Download Lightning release and build lightning-kokkos backend with Kokkos-OpenMP FROM base-build-python AS build-wheel-lightning-kokkos-openmp WORKDIR /opt/pennylane-lightning -COPY --from=build-kokkos-openmp /opt/kokkos /opt/kokkos -ENV CMAKE_PREFIX_PATH=/opt/kokkos:$CMAKE_PREFIX_PATH +ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning -RUN PL_BACKEND=lightning_kokkos python setup.py build_ext -RUN PL_BACKEND=lightning_kokkos python setup.py bdist_wheel +RUN python setup.py build_ext -i --define="Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON" +RUN python setup.py bdist_wheel # Install lightning-kokkos OpenMP backend FROM base-runtime AS wheel-lightning-kokkos-openmp -COPY --from=build-kokkos-openmp /opt/kokkos /opt/kokkos COPY --from=build-wheel-lightning-kokkos-openmp /opt/pennylane-lightning/dist/ / COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ / RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl -RUN pip install --no-cache-dir -U pennylane +RUN pip install --no-cache-dir git+https://github.com/PennyLaneAI/pennylane.git@${PENNYLANE_VERSION} # Install CUDA-12 in build venv image FROM base-build-python as base-build-cuda @@ -133,45 +110,23 @@ RUN ./cuda-install.run --silent --toolkit --toolkitpath=/usr/local/cuda-$(echo $ ENV PATH=/usr/local/cuda/bin:${PATH} ENV LD_LIBRARY_PATH=/usr/local/cuda/lib64:${LD_LIBRARY_PATH} -# Download Kokkos release and build CUDA backend -FROM base-build-cuda as build-kokkos-cuda -WORKDIR /opt/kokkos-${KOKKOS_VERSION} -# RUN wget --progress=dot:giga https://github.com/kokkos/kokkos/archive/refs/tags/${KOKKOS_VERSION}.tar.gz -# RUN tar -zxf ${KOKKOS_VERSION}.tar.gz && mv /opt/kokkos-${KOKKOS_VERSION}/kokkos-${KOKKOS_VERSION}/* /opt/kokkos-${KOKKOS_VERSION} -RUN git clone --branch lightning https://github.com/vincentmr/kokkos.git /opt/kokkos-${KOKKOS_VERSION} -RUN cmake -S /opt/kokkos-${KOKKOS_VERSION} -B /opt/kokkos-${KOKKOS_VERSION}/build \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/kokkos \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DKokkos_ENABLE_SERIAL:BOOL=ON \ - -DKokkos_ENABLE_OPENMP:BOOL=ON \ - -DCMAKE_CXX_STANDARD=20 \ - -DKokkos_ENABLE_EXAMPLES:BOOL=OFF \ - -DKokkos_ENABLE_TESTS:BOOL=OFF \ - -DKokkos_ENABLE_LIBDL:BOOL=OFF \ - -DKokkos_ENABLE_CUDA:BOOL=ON \ - -DKokkos_ARCH_${CUDA_ARCH}=ON -RUN cmake --build /opt/kokkos-${KOKKOS_VERSION}/build -RUN cmake --install /opt/kokkos-${KOKKOS_VERSION}/build - # Download Lightning release and build lightning-kokkos backend with Kokkos-CUDA FROM base-build-cuda AS build-wheel-lightning-kokkos-cuda WORKDIR /opt/pennylane-lightning -COPY --from=build-kokkos-cuda /opt/kokkos /opt/kokkos -ENV CMAKE_PREFIX_PATH=/opt/kokkos:$CMAKE_PREFIX_PATH +ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning RUN echo >> cmake/support_kokkos.cmake && echo "find_package(CUDAToolkit REQUIRED)" >> cmake/support_kokkos.cmake -RUN PL_BACKEND=lightning_kokkos python setup.py build_ext -RUN PL_BACKEND=lightning_kokkos python setup.py bdist_wheel +RUN python setup.py build_ext -i --define="Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON;Kokkos_ENABLE_CUDA:BOOL=ON;Kokkos_ARCH_${CUDA_ARCH}=ON" +RUN python setup.py bdist_wheel # Install python3 and setup runtime virtual env in CUDA-12-runtime image (includes CUDA runtime and math libraries) # Install lightning-kokkos CUDA backend FROM nvidia/cuda:12.2.0-base-ubuntu22.04 AS wheel-lightning-kokkos-cuda +ARG PENNYLANE_VERSION=v0.36.0 RUN apt-get update \ && apt-get install --no-install-recommends -y \ libgomp1 \ + git \ python3 \ python3-pip \ python3-venv \ @@ -180,11 +135,10 @@ RUN apt-get update \ ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -COPY --from=build-kokkos-cuda /opt/kokkos /opt/kokkos COPY --from=build-wheel-lightning-kokkos-cuda /opt/pennylane-lightning/dist/ / COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ / RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl -RUN pip install --no-cache-dir -U pennylane +RUN pip install --no-cache-dir git+https://github.com/PennyLaneAI/pennylane.git@${PENNYLANE_VERSION} # Download and build Lightning-GPU release FROM base-build-cuda AS build-wheel-lightning-gpu @@ -192,13 +146,15 @@ WORKDIR /opt/pennylane-lightning RUN pip install --no-cache-dir wheel custatevec-cu12 RUN pip uninstall -y pennylane-lightning RUN CUQUANTUM_SDK=$(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')") PL_BACKEND=lightning_gpu python setup.py build_ext -RUN PL_BACKEND=lightning_gpu python setup.py bdist_wheel +RUN python setup.py bdist_wheel # Install python3 and setup runtime virtual env in CUDA-12-runtime image (includes CUDA runtime and math libraries) # Install lightning-kokkos CUDA backend FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 AS wheel-lightning-gpu +ARG PENNYLANE_VERSION=v0.36.0 RUN apt-get update \ && apt-get install --no-install-recommends -y \ + git \ libgomp1 \ python3 \ python3-pip \ @@ -213,7 +169,7 @@ ENV LD_LIBRARY_PATH="$VIRTUAL_ENV/lib/python3.10/site-packages/cuquantum/lib:$LD COPY --from=build-wheel-lightning-gpu /opt/pennylane-lightning/dist/ / COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ / RUN pip install --no-cache-dir --force-reinstall PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl -RUN pip install --no-cache-dir -U pennylane +RUN pip install --no-cache-dir git+https://github.com/PennyLaneAI/pennylane.git@${PENNYLANE_VERSION} # Install ROCm in build venv image FROM base-build-python as base-build-rocm @@ -226,44 +182,22 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* RUN amdgpu-install -y --accept-eula --usecase=rocm,hiplibsdk --no-dkms -# Download Kokkos release and build HIP backend -FROM base-build-rocm as build-kokkos-rocm -WORKDIR /opt/kokkos-${KOKKOS_VERSION} -ENV LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH -# RUN wget --progress=dot:giga https://github.com/kokkos/kokkos/archive/refs/tags/${KOKKOS_VERSION}.tar.gz -# RUN tar -zxf ${KOKKOS_VERSION}.tar.gz && mv /opt/kokkos-${KOKKOS_VERSION}/kokkos-${KOKKOS_VERSION}/* /opt/kokkos-${KOKKOS_VERSION} -RUN git clone --branch fix-rtld-deepbind https://github.com/cz4rs/kokkos.git /opt/kokkos-${KOKKOS_VERSION} -RUN CXX=hipcc cmake -S /opt/kokkos-${KOKKOS_VERSION} -B /opt/kokkos-${KOKKOS_VERSION}/build \ - -G Ninja \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_INSTALL_PREFIX=/opt/kokkos \ - -DBUILD_SHARED_LIBS:BOOL=ON \ - -DBUILD_TESTING:BOOL=OFF \ - -DKokkos_ENABLE_SERIAL:BOOL=ON \ - -DKokkos_ENABLE_OPENMP:BOOL=ON \ - -DCMAKE_CXX_STANDARD=20 \ - -DKokkos_ENABLE_EXAMPLES:BOOL=OFF \ - -DKokkos_ENABLE_TESTS:BOOL=OFF \ - -DKokkos_ENABLE_LIBDL:BOOL=OFF \ - -DKokkos_ENABLE_HIP:BOOL=ON \ - -DKokkos_ARCH_${AMD_ARCH}=ON -RUN cmake --build /opt/kokkos-${KOKKOS_VERSION}/build -RUN cmake --install /opt/kokkos-${KOKKOS_VERSION}/build - # Download Lightning release and build lightning-kokkos backend with Kokkos-ROCm FROM base-build-rocm AS build-wheel-lightning-kokkos-rocm WORKDIR /opt/pennylane-lightning -COPY --from=build-kokkos-rocm /opt/kokkos /opt/kokkos +ENV CMAKE_PREFIX_PATH=/opt/rocm:$CMAKE_PREFIX_PATH ENV CXX=hipcc -ENV CMAKE_PREFIX_PATH=/opt/kokkos:$CMAKE_PREFIX_PATH +ENV PL_BACKEND=lightning_kokkos RUN pip uninstall -y pennylane-lightning -RUN PL_BACKEND=lightning_kokkos python setup.py build_ext -RUN PL_BACKEND=lightning_kokkos python setup.py bdist_wheel +RUN python setup.py build_ext -i --define="PL_BACKEND=lightning_kokkos;Kokkos_ENABLE_SERIAL:BOOL=ON;Kokkos_ENABLE_OPENMP:BOOL=ON;Kokkos_ENABLE_HIP:BOOL=ON;Kokkos_ARCH_${AMD_ARCH}=ON" +RUN python setup.py bdist_wheel # Install lightning-kokkos HIP backend FROM rocm/dev-ubuntu-22.04:5.7 AS wheel-lightning-kokkos-rocm +ARG PENNYLANE_VERSION=v0.36.0 RUN apt-get update \ && apt-get install --no-install-recommends -y \ + git \ libgomp1 \ python3 \ python3-pip \ @@ -273,8 +207,7 @@ RUN apt-get update \ ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv $VIRTUAL_ENV ENV PATH="$VIRTUAL_ENV/bin:$PATH" -COPY --from=build-kokkos-rocm /opt/kokkos /opt/kokkos COPY --from=build-wheel-lightning-kokkos-rocm /opt/pennylane-lightning/dist/ / COPY --from=build-wheel-lightning-qubit /opt/pennylane-lightning/dist/ / RUN pip install --force-reinstall --no-cache-dir PennyLane_Lightning*.whl && rm PennyLane_Lightning*.whl -RUN pip install --no-cache-dir -U pennylane +RUN pip install --no-cache-dir git+https://github.com/PennyLaneAI/pennylane.git@${PENNYLANE_VERSION} diff --git a/pennylane_lightning/core/_version.py b/pennylane_lightning/core/_version.py index 46f1c1e8ff..f288d1200e 100644 --- a/pennylane_lightning/core/_version.py +++ b/pennylane_lightning/core/_version.py @@ -16,4 +16,4 @@ Version number (major.minor.patch[-label]) """ -__version__ = "0.37.0-dev44" +__version__ = "0.37.0-dev45" diff --git a/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp b/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp index ff125469e4..c8fee3f66b 100644 --- a/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp +++ b/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGateFunctors.hpp @@ -100,8 +100,10 @@ void applyPauliZ(Kokkos::View *> arr_, applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0, - const std::size_t i1) { arr(i1) *= -1.0; }); + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] const auto i0_ = i0; + arr(i1) *= -1.0; + }); } template @@ -113,8 +115,8 @@ void applyHadamard( applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0, - const std::size_t i1) { + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] const auto i0_ = i0; const Kokkos::complex v0 = arr(i0); const Kokkos::complex v1 = arr(i1); arr(i0) = M_SQRT1_2 * v0 + @@ -135,8 +137,10 @@ void applyS(Kokkos::View *> arr_, applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0, - const std::size_t i1) { arr(i1) *= shift; }); + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] const auto i0_ = i0; + arr(i1) *= shift; + }); } template @@ -152,8 +156,10 @@ void applyT(Kokkos::View *> arr_, applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0, - const std::size_t i1) { arr(i1) *= shift; }); + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] const auto i0_ = i0; + arr(i1) *= shift; + }); } template @@ -169,8 +175,10 @@ void applyPhaseShift(Kokkos::View *> arr_, applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0, - const std::size_t i1) { arr(i1) *= shift; }); + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] const auto i0_ = i0; + arr(i1) *= shift; + }); } template @@ -315,9 +323,11 @@ void applyCNOT(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; + kokkos_swap(arr(i10), arr(i11)); }); } @@ -331,9 +341,10 @@ void applyCY(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; Kokkos::complex v10 = arr(i10); arr(i10) = Kokkos::complex{imag(arr(i11)), -real(arr(i11))}; @@ -350,10 +361,13 @@ void applyCZ(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, - [[maybe_unused]] const std::size_t i10, - const std::size_t i11) { arr(i11) *= -1; }); + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; + [[maybe_unused]] const auto i10_ = i10; + arr(i11) *= -1; + }); } template @@ -365,9 +379,11 @@ void applySWAP(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + kokkos_swap(arr(i10), arr(i01)); }); } @@ -385,10 +401,13 @@ void applyControlledPhaseShift(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, - [[maybe_unused]] const std::size_t i10, - const std::size_t i11) { arr(i11) *= s; }); + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; + [[maybe_unused]] const auto i10_ = i10; + arr(i11) *= s; + }); } template @@ -403,9 +422,10 @@ void applyCRX(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; const Kokkos::complex v10 = arr(i10); const Kokkos::complex v11 = arr(i11); arr(i10) = Kokkos::complex{ @@ -426,9 +446,10 @@ void applyCRY(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; const Kokkos::complex v10 = arr(i10); const Kokkos::complex v11 = arr(i11); arr(i10) = c * v10 - s * v11; @@ -450,9 +471,11 @@ void applyCRZ(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; + arr(i10) *= shift_0; arr(i11) *= shift_1; }); @@ -476,9 +499,10 @@ void applyCRot(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - [[maybe_unused]] const std::size_t i01, + const std::size_t i00, const std::size_t i01, const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i01_ = i01; const Kokkos::complex v0 = arr(i10); const Kokkos::complex v1 = arr(i11); arr(i10) = mat_0b00 * v0 + mat_0b01 * v1; @@ -620,9 +644,11 @@ void applySingleExcitation(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + const Kokkos::complex v01 = arr(i01); const Kokkos::complex v10 = arr(i10); arr(i01) = cr * v01 - sj * v10; @@ -672,9 +698,11 @@ void applySingleExcitationPlus(Kokkos::View *> arr_, applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + const Kokkos::complex v01 = arr(i01); const Kokkos::complex v10 = arr(i10); arr(i00) *= e; @@ -758,13 +786,17 @@ void applyCSWAP(Kokkos::View *> arr_, applyNC3Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i000, - [[maybe_unused]] const std::size_t i001, - [[maybe_unused]] const std::size_t i010, - [[maybe_unused]] const std::size_t i011, - [[maybe_unused]] const std::size_t i100, - const std::size_t i101, const std::size_t i110, - [[maybe_unused]] const std::size_t i111) { + const std::size_t i000, const std::size_t i001, + const std::size_t i010, const std::size_t i011, + const std::size_t i100, const std::size_t i101, + const std::size_t i110, const std::size_t i111) { + [[maybe_unused]] const auto i000_ = i000; + [[maybe_unused]] const auto i001_ = i001; + [[maybe_unused]] const auto i010_ = i010; + [[maybe_unused]] const auto i011_ = i011; + [[maybe_unused]] const auto i100_ = i100; + [[maybe_unused]] const auto i111_ = i111; + kokkos_swap(arr(i101), arr(i110)); }); } @@ -778,13 +810,17 @@ void applyToffoli(Kokkos::View *> arr_, applyNC3Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i000, - [[maybe_unused]] const std::size_t i001, - [[maybe_unused]] const std::size_t i010, - [[maybe_unused]] const std::size_t i011, - [[maybe_unused]] const std::size_t i100, - [[maybe_unused]] const std::size_t i101, + const std::size_t i000, const std::size_t i001, + const std::size_t i010, const std::size_t i011, + const std::size_t i100, const std::size_t i101, const std::size_t i110, const std::size_t i111) { + [[maybe_unused]] const auto i000_ = i000; + [[maybe_unused]] const auto i001_ = i001; + [[maybe_unused]] const auto i010_ = i010; + [[maybe_unused]] const auto i011_ = i011; + [[maybe_unused]] const auto i100_ = i100; + [[maybe_unused]] const auto i101_ = i101; + kokkos_swap(arr(i111), arr(i110)); }); } @@ -914,22 +950,29 @@ void applyDoubleExcitation(Kokkos::View *> arr_, (inverse) ? -std::sin(angle / 2) : std::sin(angle / 2); applyNC4Functor( ExecutionSpace{}, arr_, num_qubits, wires, - KOKKOS_LAMBDA( - Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0000, - [[maybe_unused]] const std::size_t i0001, - [[maybe_unused]] const std::size_t i0010, const std::size_t i0011, - [[maybe_unused]] const std::size_t i0100, - [[maybe_unused]] const std::size_t i0101, - [[maybe_unused]] const std::size_t i0110, - [[maybe_unused]] const std::size_t i0111, - [[maybe_unused]] const std::size_t i1000, - [[maybe_unused]] const std::size_t i1001, - [[maybe_unused]] const std::size_t i1010, - [[maybe_unused]] const std::size_t i1011, const std::size_t i1100, - [[maybe_unused]] const std::size_t i1101, - [[maybe_unused]] const std::size_t i1110, - [[maybe_unused]] const std::size_t i1111) { + KOKKOS_LAMBDA(Kokkos::View *> arr, + const std::size_t i0000, const std::size_t i0001, + const std::size_t i0010, const std::size_t i0011, + const std::size_t i0100, const std::size_t i0101, + const std::size_t i0110, const std::size_t i0111, + const std::size_t i1000, const std::size_t i1001, + const std::size_t i1010, const std::size_t i1011, + const std::size_t i1100, const std::size_t i1101, + const std::size_t i1110, const std::size_t i1111) { + [[maybe_unused]] const auto i0000_ = i0000; + [[maybe_unused]] const auto i0001_ = i0001; + [[maybe_unused]] const auto i0010_ = i0010; + [[maybe_unused]] const auto i0100_ = i0100; + [[maybe_unused]] const auto i0101_ = i0101; + [[maybe_unused]] const auto i0110_ = i0110; + [[maybe_unused]] const auto i0111_ = i0111; + [[maybe_unused]] const auto i1000_ = i1000; + [[maybe_unused]] const auto i1001_ = i1001; + [[maybe_unused]] const auto i1010_ = i1010; + [[maybe_unused]] const auto i1011_ = i1011; + [[maybe_unused]] const auto i1101_ = i1101; + [[maybe_unused]] const auto i1110_ = i1110; + [[maybe_unused]] const auto i1111_ = i1111; const Kokkos::complex v3 = arr(i0011); const Kokkos::complex v12 = arr(i1100); arr(i0011) = cr * v3 - sj * v12; diff --git a/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp b/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp index 33a78aae74..af461e5b88 100644 --- a/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp +++ b/pennylane_lightning/core/src/simulators/lightning_kokkos/gates/BasicGeneratorFunctors.hpp @@ -39,8 +39,8 @@ void applyGenPhaseShift( applyNC1Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - const std::size_t i0, - [[maybe_unused]] const std::size_t i1) { + const std::size_t i0, const std::size_t i1) { + [[maybe_unused]] auto i1_ = i1; arr(i0) = 0.0; }); } @@ -55,8 +55,9 @@ void applyGenControlledPhaseShift( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, const std::size_t i00, const std::size_t i01, - const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i11_ = i11; + arr(i00) = 0.0; arr(i01) = 0.0; arr(i10) = 0.0; @@ -110,8 +111,8 @@ void applyGenCRZ(Kokkos::View *> arr_, ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, const std::size_t i00, const std::size_t i01, - [[maybe_unused]] const std::size_t i10, - const std::size_t i11) { + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i10_ = i10; arr(i00) = 0.0; arr(i01) = 0.0; arr(i11) *= -1; @@ -178,9 +179,11 @@ void applyGenIsingZZ( applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + arr(i10) *= -1; arr(i01) *= -1; }); @@ -214,9 +217,11 @@ void applyGenSingleExcitationMinus( applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + arr(i01) *= Kokkos::complex{0.0, 1.0}; arr(i10) *= Kokkos::complex{0.0, -1.0}; kokkos_swap(arr(i10), arr(i01)); @@ -232,9 +237,11 @@ void applyGenSingleExcitationPlus( applyNC2Functor( ExecutionSpace{}, arr_, num_qubits, wires, KOKKOS_LAMBDA(Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i00, - const std::size_t i01, const std::size_t i10, - [[maybe_unused]] const std::size_t i11) { + const std::size_t i00, const std::size_t i01, + const std::size_t i10, const std::size_t i11) { + [[maybe_unused]] const auto i00_ = i00; + [[maybe_unused]] const auto i11_ = i11; + arr(i00) *= -1; arr(i01) *= Kokkos::complex{0.0, 1.0}; arr(i10) *= Kokkos::complex{0.0, -1.0}; @@ -289,22 +296,29 @@ void applyGenDoubleExcitationMinus( [[maybe_unused]] const std::vector ¶ms = {}) { applyNC4Functor( ExecutionSpace{}, arr_, num_qubits, wires, - KOKKOS_LAMBDA( - Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0000, - [[maybe_unused]] const std::size_t i0001, - [[maybe_unused]] const std::size_t i0010, const std::size_t i0011, - [[maybe_unused]] const std::size_t i0100, - [[maybe_unused]] const std::size_t i0101, - [[maybe_unused]] const std::size_t i0110, - [[maybe_unused]] const std::size_t i0111, - [[maybe_unused]] const std::size_t i1000, - [[maybe_unused]] const std::size_t i1001, - [[maybe_unused]] const std::size_t i1010, - [[maybe_unused]] const std::size_t i1011, const std::size_t i1100, - [[maybe_unused]] const std::size_t i1101, - [[maybe_unused]] const std::size_t i1110, - [[maybe_unused]] const std::size_t i1111) { + KOKKOS_LAMBDA(Kokkos::View *> arr, + const std::size_t i0000, const std::size_t i0001, + const std::size_t i0010, const std::size_t i0011, + const std::size_t i0100, const std::size_t i0101, + const std::size_t i0110, const std::size_t i0111, + const std::size_t i1000, const std::size_t i1001, + const std::size_t i1010, const std::size_t i1011, + const std::size_t i1100, const std::size_t i1101, + const std::size_t i1110, const std::size_t i1111) { + [[maybe_unused]] const auto i0000_ = i0000; + [[maybe_unused]] const auto i0001_ = i0001; + [[maybe_unused]] const auto i0010_ = i0010; + [[maybe_unused]] const auto i0100_ = i0100; + [[maybe_unused]] const auto i0101_ = i0101; + [[maybe_unused]] const auto i0110_ = i0110; + [[maybe_unused]] const auto i0111_ = i0111; + [[maybe_unused]] const auto i1000_ = i1000; + [[maybe_unused]] const auto i1001_ = i1001; + [[maybe_unused]] const auto i1010_ = i1010; + [[maybe_unused]] const auto i1011_ = i1011; + [[maybe_unused]] const auto i1101_ = i1101; + [[maybe_unused]] const auto i1110_ = i1110; + [[maybe_unused]] const auto i1111_ = i1111; arr(i0011) *= Kokkos::complex{0.0, 1.0}; arr(i1100) *= Kokkos::complex{0.0, -1.0}; kokkos_swap(arr(i1100), arr(i0011)); @@ -319,22 +333,29 @@ void applyGenDoubleExcitationPlus( [[maybe_unused]] const std::vector ¶ms = {}) { applyNC4Functor( ExecutionSpace{}, arr_, num_qubits, wires, - KOKKOS_LAMBDA( - Kokkos::View *> arr, - [[maybe_unused]] const std::size_t i0000, - [[maybe_unused]] const std::size_t i0001, - [[maybe_unused]] const std::size_t i0010, const std::size_t i0011, - [[maybe_unused]] const std::size_t i0100, - [[maybe_unused]] const std::size_t i0101, - [[maybe_unused]] const std::size_t i0110, - [[maybe_unused]] const std::size_t i0111, - [[maybe_unused]] const std::size_t i1000, - [[maybe_unused]] const std::size_t i1001, - [[maybe_unused]] const std::size_t i1010, - [[maybe_unused]] const std::size_t i1011, const std::size_t i1100, - [[maybe_unused]] const std::size_t i1101, - [[maybe_unused]] const std::size_t i1110, - [[maybe_unused]] const std::size_t i1111) { + KOKKOS_LAMBDA(Kokkos::View *> arr, + const std::size_t i0000, const std::size_t i0001, + const std::size_t i0010, const std::size_t i0011, + const std::size_t i0100, const std::size_t i0101, + const std::size_t i0110, const std::size_t i0111, + const std::size_t i1000, const std::size_t i1001, + const std::size_t i1010, const std::size_t i1011, + const std::size_t i1100, const std::size_t i1101, + const std::size_t i1110, const std::size_t i1111) { + [[maybe_unused]] const auto i0000_ = i0000; + [[maybe_unused]] const auto i0001_ = i0001; + [[maybe_unused]] const auto i0010_ = i0010; + [[maybe_unused]] const auto i0100_ = i0100; + [[maybe_unused]] const auto i0101_ = i0101; + [[maybe_unused]] const auto i0110_ = i0110; + [[maybe_unused]] const auto i0111_ = i0111; + [[maybe_unused]] const auto i1000_ = i1000; + [[maybe_unused]] const auto i1001_ = i1001; + [[maybe_unused]] const auto i1010_ = i1010; + [[maybe_unused]] const auto i1011_ = i1011; + [[maybe_unused]] const auto i1101_ = i1101; + [[maybe_unused]] const auto i1110_ = i1110; + [[maybe_unused]] const auto i1111_ = i1111; arr(i0011) *= Kokkos::complex{0.0, -1.0}; arr(i1100) *= Kokkos::complex{0.0, 1.0}; kokkos_swap(arr(i1100), arr(i0011)); From 76acd34662f485153189856aa761234c139592f2 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:42:30 -0400 Subject: [PATCH 14/16] Update changelog --- .github/CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 4e7b73b709..84d4c75b4d 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -35,7 +35,6 @@ ### Improvements - * Release candidate branches are automatically switched over to using the new large GitHub runner pool. [(#769)](https://github.com/PennyLaneAI/pennylane-lightning/pull/769) @@ -99,6 +98,9 @@ ### Bug fixes +* Fix regex matching issue with auto on-boarding of release candidate branch to using the large runner queue + [(#774)](https://github.com/PennyLaneAI/pennylane-lightning/pull/774) + * Fix random CI failures for `lightning.tensor` python unit tests and ignore `lightning_tensor` paths. [(#761)](https://github.com/PennyLaneAI/pennylane-lightning/pull/761) From 555ffa9d69e2b34ecb6697a985a1091e0e082b88 Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:43:45 -0400 Subject: [PATCH 15/16] Address PR comments --- .github/workflows/determine-workflow-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/determine-workflow-runner.yml b/.github/workflows/determine-workflow-runner.yml index bd2d0b4afc..981c45f7d9 100644 --- a/.github/workflows/determine-workflow-runner.yml +++ b/.github/workflows/determine-workflow-runner.yml @@ -41,7 +41,7 @@ jobs: RC_BRANCH_FORMAT_REGEX: v[0-9]+\.[0-9]+\.[0-9]+-rc[0-9]? REPO_FULL_NAME: PennyLaneAI/pennylane-lightning run: | - if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && "${{ github.event.pull_request.head.ref }}" =~ $RC_BRANCH_FORMAT_REGEX) ]]; then + if [[ '${{ contains(github.event.pull_request.labels.*.name, 'urgent') }}' == 'true' || ('${{ github.event.pull_request.head.repo.full_name }}' == "$REPO_FULL_NAME" && '${{ github.event.pull_request.head.ref }}' =~ $RC_BRANCH_FORMAT_REGEX) ]]; then echo "This job requires usage of the large runner group '$LARGE_RUNNER_GROUP_NAME'"; echo "runner_group=$LARGE_RUNNER_GROUP_NAME" >> $GITHUB_OUTPUT else From 0efacfef4a3a3f3d19dcb3166c7de92f6b8d440a Mon Sep 17 00:00:00 2001 From: Rashid N H M <95639609+rashidnhm@users.noreply.github.com> Date: Fri, 21 Jun 2024 15:43:26 -0400 Subject: [PATCH 16/16] Update .github/CHANGELOG.md Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com> --- .github/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md index 84d4c75b4d..e694d46ee1 100644 --- a/.github/CHANGELOG.md +++ b/.github/CHANGELOG.md @@ -98,7 +98,7 @@ ### Bug fixes -* Fix regex matching issue with auto on-boarding of release candidate branch to using the large runner queue +* Fix regex matching issue with auto on-boarding of release candidate branch to using the large runner queue. [(#774)](https://github.com/PennyLaneAI/pennylane-lightning/pull/774) * Fix random CI failures for `lightning.tensor` python unit tests and ignore `lightning_tensor` paths.