SDKBench
Reproducible SDK performance and correctness benchmarks, starting with quantum development kits.
SDKBench generates deterministic circuit workloads, runs them through native SDK APIs, records raw timings and summary statistics, and checks results against an independent NumPy statevector oracle. The first release supports Qiskit and Cirq, with a built-in reference adapter for validation and harness development.
Version 0.1.0 provides working benchmarks, not a comprehensive SDK ranking. The generators, evaluator and SDK adapters are independently implemented in this repository. No cloud account, API key, quantum device or network access is required to run benchmarks.
Install
Python 3.11 or newer is required.
# Core harness and NumPy reference adapter.
pip install sdkbench
# Optional real SDK adapters.
pip install 'sdkbench[qiskit]'
pip install 'sdkbench[cirq]'
pip install 'sdkbench[all]'
Optional SDKs are imported only when selected. The reference adapter is an oracle and smoke-test baseline; its timings are not a substitute for a production quantum SDK.
Quick start
sdkbench list
# Runs without either optional SDK; compilation is explicitly skipped.
sdkbench run --qubits 4 --repeats 3 --output reference.json
# Same circuits and operations through two real SDKs.
sdkbench run --sdk qiskit --sdk cirq --qubits 8 --depth 4 \
--seed 42 --repeats 10 --warmups 2 \
--output results.json --csv results.csv
# Select a workload and operation; these flags may be repeated.
sdkbench run --sdk qiskit --workload brickwork --operation compile \
--qubits 6 --depth 8 --output compile.json
# Compare matching configurations across runs or SDK versions.
sdkbench compare baseline.json candidate.json --output comparison.json
Without --output, run writes the full JSON report to stdout. With it, stdout contains a status summary. CSV is an additional flat export. A completed run exits 0 if at least one case passes and no cases fail or error. Missing optional SDKs and unsupported operations are reported as skipped; an entirely skipped run exits 1. Correctness failures or runtime errors exit 1. Invalid parameters, malformed comparison input and file errors exit 2.
Workloads
| Workload | Circuit |
|---|---|
ghz |
H on logical qubit 0, followed by a nearest-neighbor CNOT chain |
qft |
Forward QFT with controlled phases and no final bit-reversal swaps |
brickwork |
Seeded RY/RZ layers with alternating nearest-neighbor CNOT pairs |
echo |
A brickwork circuit followed by its exact inverse |
All SDKs receive the same ordered gate sequence. Logical qubit 0 is the least significant bit of statevector indices; Cirq qubit ordering is explicitly adapted. Angles are in radians. --depth controls brickwork layers and the forward half of echo; it does not change GHZ or QFT. The seed fixes circuit angles, validation probes and Qiskit's compiler seed. Width is restricted to 2–16 qubits to keep statevector validation bounded; depth is 1–256. The suite is designed for small, locally verifiable experiments in this first release.
Measured operations
| Operation | Timed work | Validation |
|---|---|---|
build |
Construct a fresh native circuit from the shared gate sequence | Native output statevectors versus the original circuit |
inverse |
Construct the native circuit inverse | Versus the reference inverse |
compose |
Compose the native circuit with itself | Versus two sequential applications |
simulate |
Evolve the all-zero state, including its allocation, to a complex128 statevector | Versus reference simulation |
compile |
Native compilation to full CZ gates and arbitrary one-qubit gates | Versus the original circuit |
SDK imports, workload generation, initial native circuit preparation, correctness checks and report writing are outside the timing intervals. Operations return fresh outputs; warmups run before recorded samples. simulate includes state allocation and native simulation setup performed by the adapter. Cirq's simulator object is constructed once outside timing. Garbage collection and SDK caching use their normal process settings; warmups do not imply a cold start.
Compilation uses all-to-all connectivity, no measurements, no noise and no hardware routing. Qiskit uses basis ['u', 'cz'], optimization level 2 and seed_transpiler; Cirq uses CZTargetGateset(allow_partial_czs=False). They target the same primitive family but use different optimization algorithms and native single-qubit representations. Output gate counts, two-qubit gate counts and SDK-native circuit depth are recorded. Depth definitions and scheduling may differ by SDK, and native gate count alone is not a quality ranking. The reference adapter has no compiler and reports this as skipped.
Correctness and reporting
Every measured case is checked after timing on three inputs: all-zero, all-one and a seeded normalized complex random state. Outputs must be finite, normalized and equal to the reference up to a global phase, with absolute tolerance 1e-8. The timed simulation output is checked directly for the all-zero input. These probe checks detect practical adapter and transformation errors; they are not a proof of unitary equivalence on every possible input. Tests additionally check every computational basis state for three-qubit workloads and use analytic checks of GHZ, QFT and individual gates.
JSON reports include:
- Schema/package versions, UTC timestamp, Python/OS/architecture and available processor metadata.
- NumPy and selected SDK versions, compiler settings and selected thread environment variables.
- Complete run configuration and SHA-256 fingerprints of input gate sequences.
- Raw nanosecond samples, minimum, median, mean, maximum, sample standard deviation and linearly interpolated p95.
- Correctness status, validation settings, native output metrics and explicit failure/skip reasons.
compare requires identical configurations, matching result keys and matching input fingerprints. It compares only passed cases and reports speedup = baseline_median / candidate_median: values above 1 mean a faster candidate. Failed and skipped cases retain their statuses. SDK versions may differ intentionally for regression checks. Environment differences are flagged using the recorded metadata; this is not a hardware equivalence guarantee or statistical significance test.
Run benchmarks serially on an otherwise idle machine. Record thread settings, dependencies, power settings and hardware when sharing results. For example, set OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 before launching a process if a single-thread experiment is intended. SDKBench records selected settings but does not impose a universal thread policy or publish leaderboard claims.
Python API
from sdkbench import run_benchmarks, write_json, write_csv, compare_reports
report = run_benchmarks(
sdks=['qiskit', 'cirq'],
workloads=['ghz', 'brickwork'],
operations=['build', 'simulate', 'compile'],
n_qubits=6, depth=4, seed=42, repeats=5, warmups=1,
)
write_json(report, 'results.json')
write_csv(report, 'results.csv')
print(report['summary'])
For local circuit experiments, Circuit, Gate and make_workload expose the immutable shared representation; sdkbench.reference.simulate provides the little-endian oracle. The reference simulator supports H, X, RY, RZ, CNOT and controlled-phase gates. This release focuses on ideal unitary circuits; noisy channels, shot-based sampling and remote execution are not measured.
Development
python -m pip install -e '.[all,dev]'
python -m pytest -q
python -m build
python -m twine check --strict dist/*
Real SDK integration tests are skipped if that SDK is absent. CI includes both a core-only environment and environments with both adapters installed. See CONTRIBUTING.md and RELEASING.md. Code and original workloads are licensed under Apache-2.0.
Roadmap
Additional SDK adapters, larger construction-only workloads, hardware-constrained routing, parameter binding, serialization, Hamiltonian/observable workloads, memory measurements and stronger isolated-process measurements. New workload domains can extend the same timing and reporting approach.
中文说明
SDKBench 是面向 SDK 的性能与正确性测评工具,首期聚焦量子开发套件。首版已接入 Qiskit、Cirq,提供确定性电路生成、构建/求逆/组合/模拟/编译计时、独立状态向量校验、JSON/CSV 报告和历史结果比较。基础安装即可使用 NumPy 校验基线;测评真实 SDK 时安装对应可选依赖。当前面向小规模、可本地验证的实验,尚不构成完整的 SDK 综合排名。
Metadata
Release files for sdkbench 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sdkbench-0.1.0.tar.gz | 26.4 kB | Without provenance | Details for sdkbench-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sdkbench-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sdkbench-0.1.0-py3-none-any.whl |
Total release size: 46.3 kB
Release files / sdkbench-0.1.0.tar.gz
| Download URL | sdkbench-0.1.0.tar.gz |
|---|---|
| Size | 26.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07b53019802871f6fce08c40d977230bbd5693c9b58032e849a38dd29e80f85d
|
|
BLAKE2b-256 checksum How to use checksums |
2992eaaecffb35ea31d89526f5985b1f033c501ab7708b4d648dd0fbf2565a9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Release files / sdkbench-0.1.0-py3-none-any.whl
| Download URL | sdkbench-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f69ded3b32b28d2f04e189a877cbe3373e2618ff8bc63ea817a18fc47b166936
|
|
BLAKE2b-256 checksum How to use checksums |
875bb9db08a3a10d224c215dcc3210eea9cf36870525b9ea686c11989b7e3f4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|
Security for sdkbench 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.