Skip to content

Performance

  • Parameter binding: ~3x faster than Qiskit's assign_parameters and, crucially, GIL-free — concurrent evaluation threads bind candidates truly in parallel (see bench_native_vs_qiskit.py).
  • Batched simulation: the local backend submits each evaluation batch (e.g. a whole DE population) in a single AerSimulator.run call, so Aer's C++ engine runs the experiments in parallel across cores with the GIL released (max_parallel_experiments is bounded by the memory budget). Measured ~1.4–2.1x end-to-end training speedup vs per-circuit submission, growing with circuit size (see bench_batching.py). Distributed backends cap each wave's concurrency at n_qpus via their QuantumBackend::capabilities (BackendCapabilities::max_concurrency), which the Planner enforces.
  • Native circuits shine brightest with backends that consume OpenQASM directly (e.g. CUNQA), where the Qiskit re-parse disappears entirely.
  • Automatic gate-parallel calibration: the native (backend="polypus") statevector simulator switches its gate kernels to the parallel path at a machine-specific qubit count. import polypus has no CPU or disk side effects: the first native simulation of a process — polypus.statevector, or run_quantum_circuit/train with backend="polypus" — measures that crossover once per machine (well under a second) just before it runs, and caches it under $XDG_CACHE_HOME/polypus/ if that is set, else, on Windows, under %LOCALAPPDATA%\polypus\, else under ~/.cache/polypus/; later processes reuse the cache with no measurement, and Aer, CUNQA and QMIO runs never trigger it. Entries are keyed by CPU fingerprint and thread count, so the nodes of a cluster sharing one $HOME keep separate entries, and concurrent writers are serialised by a lock with atomic writes. In a multi-process SLURM/OpenMPI job only rank 0 auto-calibrates (SLURM_PROCID or OMPI_COMM_WORLD_RANK set to anything but 0 skips it); on a heterogeneous allocation, calibrate every node explicitly once, e.g. srun --ntasks-per-node=1 python -c "import polypus; polypus.calibrate_parallel_threshold()". This runs on the real runtime hardware, so pip install polypus-quantum wheel users get a tuned threshold with no manual step. It fails safe — a read-only cache dir (containers/CI) falls back to the default threshold without error, and correctness is never affected. Set POLYPUS_NO_AUTOCALIBRATE=1 to skip it entirely (CI, containers, reproducibility runs); you can also tune it explicitly at any time with polypus.calibrate_parallel_threshold(), which ignores the opt-out and the rank check. Calibrate before the first native run of a process: the simulator reads the cache once per process.