Lightning Tensor device¶
The lightning.tensor
device is a tensor network simulator device. The device is built on top of the cutensornet from the NVIDIA cuQuantum SDK, enabling GPU-accelerated simulation of quantum tensor network evolution.
A lightning.tensor
device can be loaded simply using:
import pennylane as qml
dev = qml.device("lightning.tensor", wires=100)
By default, the device represents the quantum state approximated as a Matrix Product State (MPS). The default setup for the MPS tensor network approximation is:
max_bond_dim
(maximum bond dimension) defaults to128
.
cutoff
(singular value truncation threshold) defaults to0
.
cutoff_mode
(singular value truncation mode) defaults toabs
, considering the absolute values of the singular values; Alternatively, users can opt to setcutoff_mode
torel
to consider the relative values of the singular values.
The lightning.tensor
device dispatches all operations to be performed on a CUDA-capable GPU of generation SM 7.0 (Volta)
and greater.
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.
Users also have the flexibility to customize these parameters according to their specific needs with:
import pennylane as qml
import numpy as np
num_qubits = 100
device_kwargs_mps = {
"max_bond_dim": 64,
"cutoff": 1e-10,
"cutoff_mode": "abs",
}
dev = qml.device("lightning.tensor", wires=num_qubits, method="mps", **device_kwargs_mps)
The lightning.tensor
device allows users to get quantum circuit gradients using the parameter-shift
method. This can be enabled at the PennyLane QNode
level with:
@qml.qnode(dev, diff_method="parameter-shift")
def circuit(params):
...
Check out the Lightning-Tensor installation guide for more information.
See also
DefaultTensor for a CPU only tensor network simulator device.
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.
Supported operations:
Prepares a single computational basis state. |
|
The controlled-NOT operator |
|
A qubit controlled phase shift. |
|
Apply an arbitrary fixed unitary to |
|
The controlled-Rot operator |
|
The controlled-RX operator |
|
The controlled-RY operator |
|
The controlled-RZ operator |
|
The controlled-swap operator |
|
The controlled-Y operator |
|
The controlled-Z operator |
|
Apply an arbitrary diagonal unitary matrix with a dimension that is a power of two. |
|
Double excitation rotation. |
|
An echoed RZX(pi/2) gate. |
|
The Hadamard operator |
|
The Identity operator |
|
Ising XX coupling gate |
|
Ising (XX + YY) coupling gate |
|
Ising YY coupling gate |
|
Ising ZZ coupling gate |
|
The i-swap operator |
|
Spin-adapted spatial orbital rotation. |
|
The Pauli X operator |
|
The Pauli Y operator |
|
The Pauli Z operator |
|
Arbitrary single qubit local phase shift |
|
Phase SWAP gate |
|
Apply a quantum Fourier transform (QFT). |
|
Apply the |
|
Apply a |
|
Apply an arbitrary unitary matrix with a dimension that is a power of two. |
|
Arbitrary single qubit rotation |
|
The single qubit X rotation |
|
The single qubit Y rotation |
|
The single qubit Z rotation |
|
The single-qubit phase gate |
|
Single excitation rotation. |
|
Single excitation rotation with negative phase-shift outside the rotation subspace. |
|
Single excitation rotation with positive phase-shift outside the rotation subspace. |
|
The square root of i-swap operator. |
|
alias of |
|
The swap operator |
|
The single-qubit Square-Root X operator. |
|
The single-qubit T gate |
|
Toffoli (controlled-controlled-X) gate. |
Unsupported operations:
Prepare subsystems using the given ket vector in the computational basis. |
|
Double excitation rotation with negative phase-shift outside the rotation subspace. |
|
Double excitation rotation with positive phase-shift outside the rotation subspace. |
|
A global phase operation that multiplies all components of the state by \(e^{-i \phi}\). |
|
Construct a unitary \(U(A)\) such that an arbitrary matrix \(A\) is encoded in the top-left block. |
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
.
Users can not create a Hamiltonian
or Prod
observable from Hamiltonian
observables.
A symbolic operator representing the exponential of a operator. |
|
The Hadamard operator |
|
alias of |
|
An arbitrary Hermitian observable. |
|
The Identity operator |
|
The Pauli X operator |
|
The Pauli Y operator |
|
The Pauli Z operator |
|
Symbolic operator representing the product of operators. |
|
Arithmetic operator representing the scalar product of an operator with the given scalar. |
|
Symbolic operator representing the sum of operators. |
Unsupported observables:
A Hamiltonian represented directly as a sparse matrix in Compressed Sparse Row (CSR) format. |
|
Observable corresponding to the state projector \(P=\ket{\phi}\bra{\phi}\). |