Skip to content
This repository has been archived by the owner on Feb 5, 2024. It is now read-only.

Pin lightning.qubit dep to v0.31.0 #135

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
[(#127)] (https://github.com/PennyLaneAI/pennylane-lightning-gpu/pull/127)

### Breaking changes

* Rename `QubitStateVector` to `StatePrep` in the `LightningGPU` class.
[#134] (https://github.com/PennyLaneAI/pennylane-lightning-gpu/pull/134)

* Remove support for Python 3.8.
[(#135)](https://github.com/PennyLaneAI/pennylane-lightning-gpu/pull/135)

### Improvements

Expand All @@ -15,6 +21,10 @@
### Documentation

### Bug fixes

* Pin `lightning.qubit` build version to v0.31.0 due to new package architecture.
[(#135)](https://github.com/PennyLaneAI/pennylane-lightning-gpu/pull/135)

* `apply` no longer mutates the inputted list of operations and
add the missing `_dp` to the LightningGPU class with single GPU backend.
[(#133)] (https://github.com/PennyLaneAI/pennylane-lightning-gpu/pull/133)
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/build_wheel_manylinux2014.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Wheel::Linux::x86_64

# **What it does**: Builds python wheels for Linux (ubuntu-latest) architecture x86_64 and store it as artifacts.
# Python versions: 3.8, 3.9, 3.10, 3.11.
# Python versions: 3.9, 3.10, 3.11.
# **Why we have it**: To build wheels for pennylane-lightning-gpu installation.
# **Who does it impact**: Wheels to be uploaded to PyPI.

Expand All @@ -27,7 +27,7 @@ jobs:
os: [ubuntu-latest]
arch: [x86_64]
cibw_build: ${{ fromJson(needs.set_wheel_build_matrix.outputs.python_version) }}
name: ${{ matrix.os }} (Python ${{ fromJson('{"cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10","cp311-*":"3.11" }')[matrix.cibw_build] }})
name: ${{ matrix.os }} (Python ${{ fromJson('{"cp39-*":"3.9","cp310-*":"3.10","cp311-*":"3.11" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -42,7 +42,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: '3.9'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel~=2.11.0
Expand All @@ -56,7 +56,7 @@ jobs:

CIBW_SKIP: "*-musllinux*"

CIBW_CONFIG_SETTINGS: --global-option=build_ext --global-option=--define="CMAKE_CXX_COMPILER=$(which g++-11);CMAKE_C_COMPILER=$(which gcc-11);LIGHTNING_RELEASE_TAG=master"
CIBW_CONFIG_SETTINGS: --global-option=build_ext --global-option=--define="CMAKE_CXX_COMPILER=$(which g++-11);CMAKE_C_COMPILER=$(which gcc-11);LIGHTNING_RELEASE_TAG=v0.31.0"

# Python build settings
CIBW_BEFORE_BUILD: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

- name: Install dependencies
run:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests_linux_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLLGPU_BUILD_TESTS=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand All @@ -162,7 +162,7 @@ jobs:
-DPLLGPU_BUILD_TESTS=ON \
-DPLLGPU_ENABLE_COVERAGE=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -259,13 +259,13 @@ jobs:
python -m pip install pip~=22.0
python -m pip install ninja cmake custatevec-cu11 pytest pytest-mock flaky pytest-cov
# Sync with latest master branches
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning==0.32.0.dev5 --pre --force-reinstall --no-deps

- name: Build and install package
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
run: |
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});LIGHTNING_RELEASE_TAG=master;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});LIGHTNING_RELEASE_TAG=v0.31.0;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python -m pip install -e . --verbose

- name: Run PennyLane-Lightning-GPU unit tests
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests_linux_x86_mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -136,7 +136,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLLGPU_BUILD_TESTS=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand Down Expand Up @@ -168,7 +168,7 @@ jobs:
-DPLLGPU_BUILD_TESTS=ON \
-DPLLGPU_ENABLE_COVERAGE=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -275,13 +275,13 @@ jobs:
python -m pip install pip~=22.0
python -m pip install ninja cmake custatevec-cu11 pytest pytest-mock flaky pytest-cov mpi4py
# Sync with latest master branches
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning==0.32.0.dev5 --pre --force-reinstall --no-deps

- name: Build and install package (MPICH backend)
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
run: |
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});CMAKE_PREFIX_PATH=/opt/mpi/mpich;PLLGPU_ENABLE_MPI=On;LIGHTNING_RELEASE_TAG=master;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});CMAKE_PREFIX_PATH=/opt/mpi/mpich;PLLGPU_ENABLE_MPI=On;LIGHTNING_RELEASE_TAG=v0.31.0;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python -m pip install -e . --verbose

- name: Run PennyLane-Lightning-GPU unit tests (MPICH backend)
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/tests_linux_x86_openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPLLGPU_BUILD_TESTS=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
-DPLLGPU_BUILD_TESTS=ON \
-DPLLGPU_ENABLE_COVERAGE=ON \
-DCMAKE_CXX_COMPILER="$(which g++-${{ env.GCC_VERSION }})" \
-DLIGHTNING_RELEASE_TAG="master" \
-DLIGHTNING_RELEASE_TAG="v0.31.0" \
-DCMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" \
-DCMAKE_CUDA_ARCHITECTURES="86" \
-DPython_EXECUTABLE:FILE="${{ steps.python_path.outputs.python }}" \
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
id: setup_python
name: Install Python
with:
python-version: '3.8'
python-version: '3.9'

# Since the self-hosted runner can be re-used. It is best to set up all package
# installations in a virtual environment that gets cleaned at the end of each workflow run
Expand Down Expand Up @@ -247,13 +247,13 @@ jobs:
python -m pip install pip~=22.0
python -m pip install ninja cmake custatevec-cu11 pytest pytest-mock flaky pytest-cov mpi4py
# Sync with latest master branches
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning --pre --force-reinstall --no-deps
python -m pip install --index-url https://test.pypi.org/simple/ pennylane-lightning==0.32.0.dev5 --pre --force-reinstall --no-deps

- name: Build and install package (OpenMPI backend)
env:
CUQUANTUM_SDK: $(python -c "import site; print( f'{site.getsitepackages()[0]}/cuquantum/lib')")
run: |
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});CMAKE_PREFIX_PATH=/opt/mpi/openmpi;PLLGPU_ENABLE_MPI=On;LIGHTNING_RELEASE_TAG=master;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python setup.py build_ext -i --define="CMAKE_CXX_COMPILER=$(which g++-${{ env.GCC_VERSION }});CMAKE_PREFIX_PATH=/opt/mpi/openmpi;PLLGPU_ENABLE_MPI=On;LIGHTNING_RELEASE_TAG=v0.31.0;CMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc;CMAKE_CUDA_ARCHITECTURES=${{ env.CI_CUDA_ARCH }};Python_EXECUTABLE=${{ steps.python_path.outputs.python }}"
python -m pip install -e . --verbose

- name: Run PennyLane-Lightning-GPU unit tests (OpenMPI backend)
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ python:
build:
os: ubuntu-20.04
tools:
python: "3.8"
python: "3.9"
apt_packages:
- cmake
- build-essential
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ FetchContent_MakeAvailable(pybind11)

# Add PennyLane-Lightning
if (NOT DEFINED LIGHTNING_RELEASE_TAG)
set(LIGHTNING_RELEASE_TAG "latest_release")
set(LIGHTNING_RELEASE_TAG "v0.31.0")
endif()

# Disable non-required lengthy build-steps from PennyLane Lightning
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ifndef CUQUANTUM_SDK
@test $(CUQUANTUM_SDK)
endif
ifndef PYTHON3
@echo "To install PennyLane-Lightning-GPU you must have Python 3.8+ installed."
@echo "To install PennyLane-Lightning-GPU you must have Python 3.9+ installed."
endif
$(PYTHON) setup.py build_ext --cuquantum=$(CUQUANTUM_SDK) --verbose
$(PYTHON) setup.py install
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Features
Installation
============

PennyLane-Lightning-GPU requires Python version 3.8 and above. It can be installed using ``pip``:
PennyLane-Lightning-GPU requires Python version 3.9 and above. It can be installed using ``pip``:

.. code-block:: console

Expand Down Expand Up @@ -82,7 +82,7 @@ To build using Docker, run the following from the project root directory:

docker build . -f ./docker/Dockerfile -t "lightning-gpu-wheels"

This will build a Python wheel for Python 3.8 up to 3.11 inclusive, and be manylinux2014 (glibc 2.17) compatible.
This will build a Python wheel for Python 3.9 up to 3.11 inclusive, and be manylinux2014 (glibc 2.17) compatible.
To acquire the built wheels, use:

.. code-block:: console
Expand Down
2 changes: 1 addition & 1 deletion doc/devices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Supported operations and observables
~pennylane.PauliZ
~pennylane.PhaseShift
~pennylane.ControlledPhaseShift
~pennylane.QubitStateVector
~pennylane.StatePrep
~pennylane.Rot
~pennylane.RX
~pennylane.RY
Expand Down
6 changes: 3 additions & 3 deletions mpitests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def test_pauli_rotation_gradient(self, G, theta, tol, isBatch_obs, request):
dev_cpu = qml.device("default.qubit", wires=3)

with qml.tape.QuantumTape() as tape:
qml.QubitStateVector(np.array([1.0, -1.0]) / np.sqrt(2), wires=0)
qml.StatePrep(np.array([1.0, -1.0]) / np.sqrt(2), wires=0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we could parametrize the test over the state prep op since QubitStateVector should still be supported. If we go forward with #134, I will do that there.

G(theta, wires=[0])
qml.expval(qml.PauliZ(0))

Expand Down Expand Up @@ -218,7 +218,7 @@ def test_Rot_gradient(self, theta, tol, isBatch_obs, request):
params = np.array([theta, theta**3, np.sqrt(2) * theta])

with qml.tape.QuantumTape() as tape:
qml.QubitStateVector(np.array([1.0, -1.0]) / np.sqrt(2), wires=0)
qml.StatePrep(np.array([1.0, -1.0]) / np.sqrt(2), wires=0)
qml.Rot(*params, wires=[0])
qml.expval(qml.PauliZ(0))

Expand Down Expand Up @@ -760,7 +760,7 @@ def circuit_2(params, wires):

def circuit_ansatz(params, wires):
"""Circuit ansatz containing all the parametrized gates"""
qml.QubitStateVector(unitary_group.rvs(2**6, random_state=0)[0], wires=wires)
qml.StatePrep(unitary_group.rvs(2**6, random_state=0)[0], wires=wires)
qml.RX(params[0], wires=wires[0])
qml.RY(params[1], wires=wires[1])
qml.adjoint(qml.RX(params[2], wires=wires[2]))
Expand Down
18 changes: 9 additions & 9 deletions mpitests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def apply_operation_gates_qnode_param(tol, operation, par, Wires):
)

def circuit(*params):
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(*params, wires=Wires)
return qml.state()

Expand Down Expand Up @@ -105,7 +105,7 @@ def apply_operation_gates_apply_param(tol, operation, par, Wires):

@qml.qnode(dev_cpu)
def circuit(*params):
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(*params, wires=Wires)
return qml.state()

Expand Down Expand Up @@ -153,7 +153,7 @@ def apply_operation_gates_qnode_nonparam(tol, operation, Wires):
)

def circuit():
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(wires=Wires)
return qml.state()

Expand Down Expand Up @@ -186,7 +186,7 @@ def apply_operation_gates_apply_nonparam(tol, operation, Wires):

@qml.qnode(dev_cpu)
def circuit():
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(wires=Wires)
return qml.state()

Expand Down Expand Up @@ -225,7 +225,7 @@ def expval_single_wire_no_param(tol, obs):
dev_gpumpi = qml.device("lightning.gpu", wires=num_wires, mpi=True, c_dtype=np.complex128)

def circuit():
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
return qml.expval(obs)

cpu_qnode = qml.QNode(circuit, dev_cpu)
Expand All @@ -252,7 +252,7 @@ def apply_probs_nonparam(tol, operation, GateWires, Wires):
dev_gpumpi = qml.device("lightning.gpu", wires=num_wires, mpi=True, c_dtype=np.complex128)

def circuit():
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(wires=GateWires)
return qml.probs(wires=Wires)

Expand Down Expand Up @@ -292,7 +292,7 @@ def apply_probs_param(tol, operation, par, GateWires, Wires):
dev_gpumpi = qml.device("lightning.gpu", wires=num_wires, mpi=True, c_dtype=np.complex128)

def circuit():
qml.QubitStateVector(state_vector, wires=range(num_wires))
qml.StatePrep(state_vector, wires=range(num_wires))
operation(*par, wires=GateWires)
return qml.probs(wires=Wires)

Expand Down Expand Up @@ -501,7 +501,7 @@ def test_qubit_state_prep(self, tol, par, Wires):
dev_gpumpi = qml.device("lightning.gpu", wires=num_wires, mpi=True, c_dtype=np.complex128)

def circuit():
qml.QubitStateVector(par, wires=Wires)
qml.StatePrep(par, wires=Wires)
return qml.state()

cpu_qnode = qml.QNode(circuit, dev_cpu)
Expand Down Expand Up @@ -1152,7 +1152,7 @@ def test_prob_four_wire_param(self, tol, operation, par, GateWires, Wires):

def circuit_ansatz(params, wires):
"""Circuit ansatz containing all the parametrized gates"""
qml.QubitStateVector(unitary_group.rvs(2**numQubits, random_state=0)[0], wires=wires)
qml.StatePrep(unitary_group.rvs(2**numQubits, random_state=0)[0], wires=wires)
qml.RX(params[0], wires=wires[0])
qml.RY(params[1], wires=wires[1])
qml.adjoint(qml.RX(params[2], wires=wires[2]))
Expand Down
Loading
Loading