Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lightning.tensor docs #909

Merged
merged 23 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a8deb1f
Initial commit
multiphaseCFD Sep 16, 2024
50443c2
Auto update version from '0.39.0-dev23' to '0.39.0-dev24'
ringo-but-quantum Sep 16, 2024
deea759
Add changelog
multiphaseCFD Sep 16, 2024
7b78d01
update about
multiphaseCFD Sep 16, 2024
d02f463
update bullet points
multiphaseCFD Sep 16, 2024
e768bb8
Merge branch 'master' into update_mps_docs
multiphaseCFD Sep 16, 2024
069bb15
fix typo
multiphaseCFD Sep 16, 2024
2e9962b
Auto update version from '0.39.0-dev24' to '0.39.0-dev25'
ringo-but-quantum Sep 16, 2024
87a3bf1
apply some comments
multiphaseCFD Sep 18, 2024
f145604
Auto update version from '0.39.0-dev25' to '0.39.0-dev27'
ringo-but-quantum Sep 18, 2024
336ce5f
Update doc/lightning_tensor/device.rst
multiphaseCFD Sep 18, 2024
0ea1a8e
update changelog
multiphaseCFD Sep 18, 2024
4680444
Merge branch 'master' into update_mps_docs
multiphaseCFD Sep 18, 2024
43e8f6d
Auto update version from '0.39.0-dev26' to '0.39.0-dev27'
ringo-but-quantum Sep 18, 2024
8d46109
fix typo
multiphaseCFD Sep 18, 2024
946d524
Update doc/lightning_tensor/device.rst
multiphaseCFD Sep 19, 2024
8b991ad
apply Korbinian's comments
multiphaseCFD Sep 19, 2024
247e3ad
explain the reason of disable new_opmath
multiphaseCFD Sep 19, 2024
26b56cc
Update doc/lightning_tensor/device.rst
multiphaseCFD Sep 19, 2024
3f2b60f
tidy up
multiphaseCFD Sep 20, 2024
cc3dc52
Auto update version from '0.39.0-dev27' to '0.39.0-dev29'
ringo-but-quantum Sep 20, 2024
6812bc8
Merge branch 'master' into update_mps_docs
multiphaseCFD Sep 20, 2024
f52a43d
Auto update version from '0.39.0-dev28' to '0.39.0-dev29'
ringo-but-quantum Sep 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@

### Documentation

* Update ``lightning.tensor`` documentation to include all the new features added since pull request #756. The new features are: 1, Finite-shot measurements; 2. Expval-base quantities; 3. Support for ``qml.state()`` and ``qml.stateprep()``; 4. Support for all gates support via Matrix Product Operator (MPO).
[(#909)](https://github.com/PennyLaneAI/pennylane-lightning/pull/909)

### Bug fixes

* Bug fix for analytic `probs` in the `lightning.tensor` C++ layer.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET "11" CACHE STRING "Minimum OS X deployment versi
set(CMAKE_CXX_STANDARD 20) # At least C++20 is required

project(pennylane_lightning
DESCRIPTION "C++ suite of state-vector simulators bindings for PennyLane. "
DESCRIPTION "C++ suite of state-vector and tensor network simulators bindings for PennyLane. "
LANGUAGES CXX
)

Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Lightning Plugins

.. header-start-inclusion-marker-do-not-remove

The Lightning plugin ecosystem provides fast state-vector simulators written in C++.
The Lightning plugin ecosystem provides fast state-vector and tensor network simulators written in C++.

`PennyLane <https://docs.pennylane.ai>`_ is a cross-platform Python library for quantum machine
learning, automatic differentiation, and optimization of hybrid quantum-classical computations.
Expand All @@ -49,8 +49,7 @@ PennyLane-Lightning high performance simulators include the following backends:
* ``lightning.qubit``: is a fast state-vector simulator written in C++.
* ``lightning.gpu``: is a state-vector simulator based on the `NVIDIA cuQuantum SDK <https://developer.nvidia.com/cuquantum-sdk>`_. It notably implements a distributed state-vector simulator based on MPI.
* ``lightning.kokkos``: is a state-vector simulator written with `Kokkos <https://kokkos.github.io/kokkos-core-wiki/index.html>`_. It can exploit the inherent parallelism of modern processing units supporting the `OpenMP <https://www.openmp.org/>`_, `CUDA <https://developer.nvidia.com/cuda-toolkit>`_ or `HIP <https://docs.amd.com/projects/HIP/en/docs-5.3.0/index.html>`_ programming models.
* ``lightning.tensor``: is a tensor network simulator based on the `NVIDIA cuQuantum SDK <https://developer.nvidia.com/cuquantum-sdk>`_ (requires NVIDIA GPUs with SM 7.0 or greater). This device is designed to simulate large-scale quantum circuits using tensor networks. For small circuits, state-vector simulator plugins may be more suitable. The supported method is Matrix Product State (MPS). This device does not currently support finite shots. Currently, the supported measurement types are expectation values and the supported differentiation methods are ``parameter-shift`` and ``finite-diff``. Note that only 1,2-wire gates and gates that can be decomposed by PennyLane into 1,2-wire gates are supported.

* ``lightning.tensor``: is a tensor network simulator based on the `NVIDIA cuQuantum SDK <https://developer.nvidia.com/cuquantum-sdk>`_ (requires NVIDIA GPUs with SM 7.0 or greater). The supported method is Matrix Product State (MPS).
.. header-end-inclusion-marker-do-not-remove

The following table summarizes the supported platforms and the primary installation mode:
Expand Down
46 changes: 15 additions & 31 deletions doc/lightning_tensor/device.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Lightning Tensor device
=======================

The ``lightning.tensor`` device is a tensor network simulator device. The device is built on top of the `cutensornet <https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html>`__ from the NVIDIA cuQuantum SDK, enabling GPU-accelerated simulation of quantum tensor network evolution.
The ``lightning.tensor`` device is a tensor network simulator device. The device is built on top of the `cutensornet <https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/index.html>`__ from the NVIDIA cuQuantum SDK, enabling GPU-accelerated simulation of quantum tensor network evolution. This device is designed to simulate large-scale quantum circuits using tensor networks. For small circuits, state-vector simulator plugins may be more suitable.

A ``lightning.tensor`` device can be loaded simply using:

Expand All @@ -14,17 +14,15 @@ By default, the device represents the quantum state approximated as a Matrix Pro
The default setup for the MPS tensor network approximation is:
- ``max_bond_dim`` (maximum bond dimension) defaults to ``128`` .
- ``cutoff`` (singular value truncation threshold) defaults to ``0`` .
- ``cutoff_mode`` (singular value truncation mode) defaults to ``abs`` , considering the absolute values of the singular values; Alternatively, users can opt to set ``cutoff_mode`` to ``rel`` to consider the relative values of the singular values.
- ``cutoff_mode`` (singular value truncation mode) defaults to ``abs`` , considering the absolute values of the singular values; Alternatively, users can opt to set ``cutoff_mode`` to ``rel`` to consider the relative values of the singular values.
Note that the ``cutensornet`` will automatically determine the reduced extent of the bond dimension based on the lowest among the multiple truncation cutoffs (``max_bond_dim``, ``cutoff-abs`` and ``cutoff-rel``). For more details on how the ``cutoff`` works, please check it out the `cuQuantum documentation <https://docs.nvidia.com/cuda/cuquantum/latest/cutensornet/api/types.html#cutensornettensorsvdconfigattributes-t>`__.

The ``lightning.tensor`` device dispatches all operations to be performed on a CUDA-capable GPU of generation SM 7.0 (Volta)
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved
and greater.
and greater. This device supports both exact and finite shots measurements. Currently, the supported differentiation methods are parameter-shift and finite-diff. Note that the MPS backend of lightning.tensor supports multi-wire gates via Matrix Product Operators (MPO).

.. note::
Given the inherent parallelism of GPUs, simulations with intensive parallel computation, such as those with larger maximum
bond dimensions, stand to gain the most from the computational power offered by GPU and those simulations can benifit from the
``lightning.tensor`` device. It's worth noting that if the bond dimension used in the simulation is small, the ``lightning.tensor``
device with ``MPS`` running a GPU may perform slower compared to a ``default.tensor`` device with ``MPS`` running on a CPU. For more details
on how bond dimension affects the simulation performance, please refer to the ``Approximate Tensor Network Methods`` section in the `cuQuantum SDK <https://developer.nvidia.com/cuquantum-sdk>`__.
The ``lightning.tensor`` device is designed for expectation value calculations. Measurements of ``qml.probs()`` or ``qml.state()`` return dense vectors of dimension :math:`2^{n_\text{qubits}}`, so they should only be used for small systems. When using finite shots, ``qml.probs()`` can be used to get individual samples.
Qottmann marked this conversation as resolved.
Show resolved Hide resolved

.. note:: ``qml.Hermitian`` is currently only supported for single wires. You can use ``qml.pauli_decompose`` on smaller matrices to obtain a compatible Pauli decomposition in the meantime. As a result, it is advisable to disable ``new_opmath`` for the ``lightning.tensor`` device to prevent the implicit conversion of Pauli words to multi-wire Hermitian observables. This limitation will be addressed once multi-wires Hermitian observables can be supported with ``cutensornet``.
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved

Users also have the flexibility to customize these parameters according to their specific needs with:

Expand Down Expand Up @@ -58,7 +56,7 @@ Check out the :doc:`/lightning_tensor/installation` guide for more information.
Operations and observables support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The "lightning.tensor" supports 1- and 2-wire gate operations and all other operations that can be decomposed to that by PennyLane.
The "lightning.tensor" supports all gate operations supported by PennyLane.
multiphaseCFD marked this conversation as resolved.
Show resolved Hide resolved

**Supported operations:**

Expand All @@ -70,6 +68,7 @@ The "lightning.tensor" supports 1- and 2-wire gate operations and all other oper
:nosignatures:

~pennylane.BasisState
~pennylane.BlockEncode
~pennylane.CNOT
~pennylane.ControlledPhaseShift
~pennylane.ControlledQubitUnitary
Expand All @@ -82,7 +81,10 @@ The "lightning.tensor" supports 1- and 2-wire gate operations and all other oper
~pennylane.CZ
~pennylane.DiagonalQubitUnitary
~pennylane.DoubleExcitation
~pennylane.DoubleExcitationMinus
~pennylane.DoubleExcitationPlus
~pennylane.ECR
~pennylane.GlobalPhase
~pennylane.Hadamard
~pennylane.Identity
~pennylane.IsingXX
Expand All @@ -98,6 +100,7 @@ The "lightning.tensor" supports 1- and 2-wire gate operations and all other oper
~pennylane.PSWAP
~pennylane.QFT
~pennylane.QubitCarry
~pennylane.QubitStateVector
~pennylane.QubitSum
~pennylane.QubitUnitary
~pennylane.Rot
Expand All @@ -108,6 +111,7 @@ The "lightning.tensor" supports 1- and 2-wire gate operations and all other oper
~pennylane.SingleExcitation
~pennylane.SingleExcitationMinus
~pennylane.SingleExcitationPlus
~pennylane.StatePrep
~pennylane.SISWAP
~pennylane.SQISW
~pennylane.SWAP
Expand All @@ -119,30 +123,10 @@ The "lightning.tensor" supports 1- and 2-wire gate operations and all other oper

</div>

**Unsupported operations:**

.. raw:: html

<div class="summary-table">

.. autosummary::
:nosignatures:

~pennylane.StatePrep
~pennylane.QubitStateVector
~pennylane.DoubleExcitationMinus
~pennylane.DoubleExcitationPlus
~pennylane.GlobalPhase
~pennylane.BlockEncode


.. raw:: html

</div>

**Supported observables:**

The ``lightning.tensor`` supports all observables supported by the Lightning state-vector simulators, besides ``qml.SparseHamiltonian``, ``qml.Projector`` and limited support to ``qml.Hamiltonian``, ``qml.Prod``.
The ``lightning.tensor`` supports all observables supported by the Lightning state-vector simulators, besides ``qml.SparseHamiltonian``, ``qml.Projector`` and limited support to ``qml.Hamiltonian``, ``qml.Prod`` since ``lightning.tensor`` only supports 1-wire Hermitian observables.

Users can not create a ``Hamiltonian`` or ``Prod`` observable from ``Hamiltonian`` observables.

Expand Down
2 changes: 1 addition & 1 deletion pennylane_lightning/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
Version number (major.minor.patch[-label])
"""

__version__ = "0.39.0-dev26"
__version__ = "0.39.0-dev27"
Loading