Polypus
Polypus is a distributed quantum computing library designed to optimize the execution of quantum algorithms by distributing computation across available hardware resources. The core is written in Rust; Python bindings are provided via PyO3.
Polypus is agnostic to the underlying hardware infrastructure. Currently three
infrastructure values are supported:
- local: Runs on local infrastructure. Defaults to Qiskit AerSimulator
(
backend="aer"); passbackend="polypus"to run instead on the noiseless statevector simulator implemented natively in Rust (no Qiskit, no GIL). - cunqa: Distributed QPU platform developed by CESGA (https://github.com/CESGA-Quantum-Spain/cunqa).
- qmio: CESGA's real QPU, reached directly over its ZeroMQ wire protocol (
--features qmio).
Features
- Run a quantum circuit on one or multiple QPUs.
- Train variational quantum circuits using Differential Evolution, PSO or Quantum Natural Gradient.
- Unified
train()API — swap optimizers by changing a single argument.
Running a circuit
# Single QPU
=
# Distribute shots across multiple QPUs
=
Both calls return a RunResult: result.counts holds the payload (a
list[dict] for a single QPU, a merged dict for n_qpus > 1), plus
result.id / result.seed / result.backend / result.infrastructure
for logging and replay. Pass seed=... for reproducible shot noise on
every simulated backend (native, Aer, CUNQA); result.seed reports the
effective seed (None only for the "qmio" infrastructure, real hardware
that cannot be seeded).
Training a variational circuit
Pass a method object as the second argument to train(). The optimizer-specific
parameters are encapsulated in the method object; execution parameters are shared.
# Differential Evolution
=
# Particle Swarm Optimization
=
# Quantum Natural Gradient
=
train() returns a TrainResult exposing result.best_params
(list[float]) plus result.best_fitness, result.iterations_run,
result.converged, and the effective result.seed — the full optimization
outcome, not just the parameters. Pass seed=... (or set it on the
optimizer, e.g. polypus.DE(..., seed=42)) to reproduce a run.
Authors
Diego Beltrán Fernández Prada (diego.fernandez@bahiasoftware.es), Víctor Sóñora Pombo, Sergio Figueiras Gómez, Miguel Boubeta Martínez, Galicia Supercomputing Center (CESGA)
License
European Union Public Licence (EUPL), version 1.2 or – as soon as they will be approved by the European Commission – subsequent versions of the EUPL.