Skip to main content

PennyLane plugin for the Maestro quantum simulator by Qoro Quantum

Project description

pennylane-maestro

PyPI version Tests License: GPL v3

A PennyLane plugin for the Maestro quantum simulator by Qoro Quantum.

Run your PennyLane circuits on Maestro's high-performance C++ backend — drop-in, one-line device change, no code rewrite.

Performance Highlights

Benchmarked on PennyLane 0.44.1. Run examples/benchmark_lightning_vs_maestro.py to reproduce.

Statevector — Variational Circuit (analytic, ⟨Z₀⟩)

Qubits default.qubit lightning.qubit maestro.qubit vs dq vs lq
20 977 ms 115 ms 45 ms 22× 2.6×
22 4.31 s 543 ms 184 ms 23× 3.0×
24 10.5 s 2.36 s 820 ms 13× 2.9×
26 DNF 10.1 s 3.56 s 2.8×

MPS — Scaling to 1000 Qubits (analytic, bond dim = 128)

Qubits default.qubit default.tensor (quimb) maestro.qubit (MPS) vs quimb
100 OOM 90 ms 11 ms
500 OOM 689 ms 90 ms 7.7×
1000 OOM 1.96 s 207 ms 9.5×

MPS Shot Sampling — 10,000 shots (only Maestro supports this)

Qubits maestro.qubit (MPS) Unique Samples
100 259 ms 10,000
500 1.22 s 10,000
1000 2.43 s 10,000

Neither default.tensor nor Qiskit Aer MPS support shot-based sampling through PennyLane.

Installation

pip install pennylane-maestro

This automatically installs pennylane (≥0.38) and qoro-maestro (≥0.2.8).

Quick Start

import pennylane as qml
import numpy as np

dev = qml.device("maestro.qubit", wires=2)

@qml.qnode(dev)
def circuit(theta):
    qml.RX(theta, wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.expval(qml.PauliZ(1))

result = circuit(np.pi / 4)
print(result)

Switching Backends

All backends are selected via keyword arguments to qml.device:

# ── CPU Statevector (default) ──
dev = qml.device("maestro.qubit", wires=20)

# ── GPU Statevector ──
dev = qml.device("maestro.qubit", wires=20, simulator_type="Gpu")

# ── GPU with Double Precision ──
dev = qml.device("maestro.qubit", wires=20,
                 simulator_type="Gpu", use_double_precision=True)

# ── MPS for 100+ qubits ──
dev = qml.device("maestro.qubit", wires=100,
                 simulation_type="MatrixProductState",
                 max_bond_dimension=256)

# ── Stabilizer for Clifford circuits ──
dev = qml.device("maestro.qubit", wires=1000,
                 simulation_type="Stabilizer")

# ── Finite shots ──
dev = qml.device("maestro.qubit", wires=10, shots=10_000)

Available Options

simulator_type Description
"QCSim" Qoro's optimised CPU simulator (default)
"Gpu" CUDA-accelerated GPU simulator
"CompositeQCSim" Multi-node distributed CPU
"QuestSim" QuEST-based reference simulator
simulation_type Description
"Statevector" Full statevector (default)
"MatrixProductState" MPS / tensor-train for large qubit counts
"Stabilizer" Clifford-only stabilizer
"TensorNetwork" General tensor network
"PauliPropagator" Pauli propagation
"ExtendedStabilizer" Extended stabilizer

Hamiltonian VQE Example

Hamiltonians are evaluated natively via Maestro's batched estimate() — all Pauli terms in a single C++ call:

import pennylane as qml
import numpy as np

n_qubits = 20
H = qml.Hamiltonian(
    [0.5] * (n_qubits - 1) + [0.3] * n_qubits,
    [qml.PauliZ(i) @ qml.PauliZ(i+1) for i in range(n_qubits - 1)] +
    [qml.PauliX(i) for i in range(n_qubits)]
)

dev = qml.device("maestro.qubit", wires=n_qubits)

@qml.qnode(dev, diff_method="parameter-shift")
def vqe_circuit(params):
    for i in range(n_qubits):
        qml.RY(params[i], wires=i)
    for i in range(n_qubits - 1):
        qml.CNOT(wires=[i, i + 1])
    return qml.expval(H)

params = np.random.random(n_qubits)
energy = vqe_circuit(params)
gradient = qml.grad(vqe_circuit)(params)

Supported Operations

The plugin delegates execution to Maestro. If you use an operation not directly implemented in Maestro (e.g. Rot), PennyLane automatically decomposes it into supported gates.

GPU Acceleration

Maestro supports CUDA-accelerated simulation via a dynamically-loaded GPU backend.

Note: The GPU backend is not included in the open-source version of Maestro. Contact Qoro Quantum for access to the GPU release bundle and a license key.

Setup

  1. Obtain the GPU release bundle from Qoro Quantum (team@qoroquantum.de). It contains:

    • libmaestro_gpu_simulators.so — the GPU simulator library
    • libLexActivator.so — license validation library
  2. Install the libraries into your environment:

    cp libmaestro_gpu_simulators.so $CONDA_PREFIX/lib/
    cp libLexActivator.so $CONDA_PREFIX/lib/
    
  3. Set your license key (provided by Qoro Quantum):

    export MAESTRO_LICENSE_KEY="XXXX-XXXX-XXXX-XXXX"
    

    To persist across sessions:

    echo 'export MAESTRO_LICENSE_KEY="XXXX-XXXX-XXXX-XXXX"' >> ~/.bashrc
    source ~/.bashrc
    

    The first run requires an internet connection for license activation. After that, the license is cached locally for 30 days of offline use.

  4. Use the GPU device in PennyLane:

    import maestro
    import pennylane as qml
    
    # Initialize GPU backend (required once per session)
    assert maestro.init_gpu(), "GPU init failed — check library path and CUDA install"
    
    # GPU Statevector
    dev = qml.device("maestro.qubit", wires=28,
                     simulator_type="Gpu",
                     use_double_precision=True)
    
    # GPU MPS for large circuits
    dev_mps = qml.device("maestro.qubit", wires=200,
                         simulator_type="Gpu",
                         simulation_type="MatrixProductState",
                         max_bond_dimension=256)
    

GPU-Supported Simulation Modes

Simulation Type GPU Support
Statevector
MPS
Tensor Network
Pauli Propagator
Stabilizer
Extended Stabilizer

Requirements: Linux with NVIDIA GPU (Ampere/Hopper recommended), CUDA 13.0+, and cuQuantum (conda install -c conda-forge cuquantum).

Authors & License

Maintained by Qoro Quantum (team@qoroquantum.de).

Licensed under GPL-3.0. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pennylane_maestro-0.1.0.tar.gz (29.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pennylane_maestro-0.1.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file pennylane_maestro-0.1.0.tar.gz.

File metadata

  • Download URL: pennylane_maestro-0.1.0.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pennylane_maestro-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7394dee2fbea33f16554f333e4433391c36bcf14b21a79607cb6bc3d61524017
MD5 4a87cd8acecdc23f064999fbab701bea
BLAKE2b-256 16287fbddab4c927771b810feca184a2c02e4a849fba25118339b97b895ea28b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_maestro-0.1.0.tar.gz:

Publisher: publish.yml on QoroQuantum/pennylane-maestro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_maestro-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pennylane_maestro-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 076bd9c47a516799b5376999875997c08251dd277e685a2c03d4eaacc17d80a5
MD5 349765073625865a5a352f4cf28137de
BLAKE2b-256 26c8b202de64f14ddb88ce0a49189107235b3317549a48346c4a60cc0f68444f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_maestro-0.1.0-py3-none-any.whl:

Publisher: publish.yml on QoroQuantum/pennylane-maestro

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page