catalyst.third_party.cuda.cudaqjit

cudaqjit(fn=None, **kwargs)[source]

A decorator for compiling PennyLane and JAX programs using CUDA Quantum.

Important

This feature currently only supports CUDA Quantum version 0.6.

Note

Currently, only the following devices are supported:

  • softwareq.qpp: a modern C++ statevector simulator

  • nvidia.statevec: The NVIDIA CuStateVec GPU simulator

    (with support for multi-gpu)

  • nvidia.tensornet: The NVIDIA CuTensorNet GPU simulator

    (with support for matrix product state)

Parameters

fn (Callable) – the quantum or classical function to compile

Returns

QJIT object.

Example

The compilation is triggered at the call site the when the quantum function is executed:

dev = qml.device("softwareq.qpp", wires=2)

@cudaqjit
@qml.qnode(dev)
def circuit(x):
    qml.RX(x[0], wires=0)
    qml.RY(x[1], wires=1)
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.PauliY(0))
>>> circuit(jnp.array([0.5, 1.4]))
-0.47244976756708373

From PennyLane, this functionality can also be accessed via

>>> @qml.qjit(compiler="cuda_quantum")

Note that CUDA Quantum compilation currently does not have feature parity with Catalyst compilation; in particular, AutoGraph, control flow, differentiation, and various measurement statistics (such as probabilities and variance) are not yet supported.