Performance¶
- Parameter binding: ~3x faster than Qiskit's
assign_parametersand, crucially, GIL-free — concurrent evaluation threads bind candidates truly in parallel (seebench_native_vs_qiskit.py). - Batched simulation: the local backend submits each evaluation batch (e.g. a whole DE population) in a single
AerSimulator.runcall, so Aer's C++ engine runs the experiments in parallel across cores with the GIL released (max_parallel_experimentsis bounded by the memory budget). Measured ~1.4–2.1x end-to-end training speedup vs per-circuit submission, growing with circuit size (seebench_batching.py). Distributed backends cap each wave's concurrency atn_qpusvia theirQuantumBackend::capabilities(BackendCapabilities::max_concurrency), which thePlannerenforces. - 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 polypushas no CPU or disk side effects: the first native simulation of a process —polypus.statevector, orrun_quantum_circuit/trainwithbackend="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$HOMEkeep 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_PROCIDorOMPI_COMM_WORLD_RANKset to anything but0skips 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, sopip install polypus-quantumwheel 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. SetPOLYPUS_NO_AUTOCALIBRATE=1to skip it entirely (CI, containers, reproducibility runs); you can also tune it explicitly at any time withpolypus.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.