Benchmarks
The following benchmarks demonstrate the performance of the pytket-custatevec backend compared to other statevector simulators within the pytket ecosystem.
Comparison Scope
These tests compare pytket-custatevec against pytket-qiskit and pytket-qulacs.
All simulations are performed via the abstract pytket Backend interface to demonstrate the speedup available to users simply by switching their backend instance.
Methodology
The Circuit
We use a Random Line Circuit to ensure a fair stress test. This structure creates a highly entangled state that is difficult to simplify or optimize trivially.
- Structure: Linear connectivity (1D chain).
- Depth: Fixed at 10 layers.
- Gates: Random
TK1(single qubit) gates followed byCX(two-qubit) gates between neighbors.
def random_line_circuit(n_qubits: int, layers: int) -> Circuit:
c = Circuit(n_qubits)
for i in range(layers):
# 1. Random Single Qubit Rotations
for q in range(n_qubits):
c.TK1(np.random.rand(), np.random.rand(), np.random.rand(), q)
# 2. Linear Entanglement (Alternating Even/Odd links)
offset = np.mod(i, 2)
qubit_pairs = [[c.qubits[i], c.qubits[i+1]] for i in range(offset, n_qubits-1, 2)]
for pair in qubit_pairs:
c.CX(pair[0], pair[1])
return c
1. Statevector Simulation
This benchmark measures the time required to calculate the full statevector (\(2^n\) complex amplitudes).
2. Shot-based Sampling
This benchmark measures the time to simulate measurement outcomes (1000 shots) for the same random circuits.
Environment
The results above were auto-generated by our CI pipeline using the following environment:
| Component | Specification / Version |
|---|---|
| GPU | Tesla T4 |
| CPU | Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz |
| Python | 3.12.11 |
| OS | Linux 6.8.0-1024-aws |
| pytket | 2.11.0 |
| pytket-custatevec | 0.0.1 |
| pytket-qulacs | 0.41.0 |
| pytket-qiskit | 0.74.0 |
| cuquantum-python | N/A |
Reproduce this Benchmark
You can find the source code for these benchmarks in our repository: