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 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.

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:

BasisState

Prepares a single computational basis state.

CNOT

The controlled-NOT operator

ControlledPhaseShift

A qubit controlled phase shift.

ControlledQubitUnitary

Apply an arbitrary fixed unitary to wires with control from the control_wires.

CRot

The controlled-Rot operator

CRX

The controlled-RX operator

CRY

The controlled-RY operator

CRZ

The controlled-RZ operator

CSWAP

The controlled-swap operator

CY

The controlled-Y operator

CZ

The controlled-Z operator

DiagonalQubitUnitary

Apply an arbitrary diagonal unitary matrix with a dimension that is a power of two.

DoubleExcitation

Double excitation rotation.

ECR

An echoed RZX(pi/2) gate.

Hadamard

The Hadamard operator

Identity

The Identity operator

IsingXX

Ising XX coupling gate

IsingXY

Ising (XX + YY) coupling gate

IsingYY

Ising YY coupling gate

IsingZZ

Ising ZZ coupling gate

ISWAP

The i-swap operator

OrbitalRotation

Spin-adapted spatial orbital rotation.

PauliX

The Pauli X operator

PauliY

The Pauli Y operator

PauliZ

The Pauli Z operator

PhaseShift

Arbitrary single qubit local phase shift

PSWAP

Phase SWAP gate

QFT

Apply a quantum Fourier transform (QFT).

QubitCarry

Apply the QubitCarry operation to four input wires.

QubitSum

Apply a QubitSum operation on three input wires.

QubitUnitary

Apply an arbitrary unitary matrix with a dimension that is a power of two.

Rot

Arbitrary single qubit rotation

RX

The single qubit X rotation

RY

The single qubit Y rotation

RZ

The single qubit Z rotation

S

The single-qubit phase gate

SingleExcitation

Single excitation rotation.

SingleExcitationMinus

Single excitation rotation with negative phase-shift outside the rotation subspace.

SingleExcitationPlus

Single excitation rotation with positive phase-shift outside the rotation subspace.

SISWAP

The square root of i-swap operator.

SQISW

alias of SISWAP

SWAP

The swap operator

SX

The single-qubit Square-Root X operator.

T

The single-qubit T gate

Toffoli

Toffoli (controlled-controlled-X) gate.

Unsupported operations:

StatePrep

Prepare subsystems using the given ket vector in the computational basis.

QubitStateVector

DoubleExcitationMinus

Double excitation rotation with negative phase-shift outside the rotation subspace.

DoubleExcitationPlus

Double excitation rotation with positive phase-shift outside the rotation subspace.

GlobalPhase

A global phase operation that multiplies all components of the state by \(e^{-i \phi}\).

BlockEncode

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.

Exp

A symbolic operator representing the exponential of a operator.

Hadamard

The Hadamard operator

Hamiltonian

alias of LinearCombination

Hermitian

An arbitrary Hermitian observable.

Identity

The Identity operator

PauliX

The Pauli X operator

PauliY

The Pauli Y operator

PauliZ

The Pauli Z operator

Prod

Symbolic operator representing the product of operators.

SProd

Arithmetic operator representing the scalar product of an operator with the given scalar.

Sum

Symbolic operator representing the sum of operators.

Unsupported observables:

SparseHamiltonian

A Hamiltonian represented directly as a sparse matrix in Compressed Sparse Row (CSR) format.

Projector

Observable corresponding to the state projector \(P=\ket{\phi}\bra{\phi}\).