Cache-hierarchy and vectorization study of Lindblad master equation simulation for near-term quantum control. arXiv:2603.18052.
  • C 39.3%
  • TeX 28.8%
  • Python 22.3%
  • Shell 3.3%
  • Assembly 3%
  • Other 3.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-19 10:25:56 -06:00
.github/workflows feat(python): real NumPy extension with QuTiP cross-validation 2026-06-01 20:23:12 -06:00
analysis Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
benchmarks Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
cuda Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
docs Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
godbolt feat: initial project skeleton — C11 Lindblad library, benchmarks, tests, paper, analysis 2026-03-15 15:27:17 -04:00
include Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
paper Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
python feat(python): real NumPy extension with QuTiP cross-validation 2026-06-01 20:23:12 -06:00
reference Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
src fix(tests): pin deterministic tolerances, drop dead constants, order null check 2026-06-01 20:23:12 -06:00
tests fix(tests): pin deterministic tolerances, drop dead constants, order null check 2026-06-01 20:23:12 -06:00
.gitignore Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
AGENTS.md Preprint-ready: quantumarticle paper, GRAPE benchmark, cross-platform validation 2026-03-17 16:38:49 -04:00
CMakeLists.txt Add JCP benchmark pipeline and manuscript 2026-04-17 19:40:09 -04:00
pytest.ini feat(python): real NumPy extension with QuTiP cross-validation 2026-06-01 20:23:12 -06:00
README.md README: fill in real arXiv id (2603.18052) in citation 2026-06-19 10:25:56 -06:00

lindblad-bench

Cache hierarchy and vectorization analysis of Lindblad master equation simulation for near-term quantum control.

https://arxiv.org/abs/2603.18052

Overview

For open quantum system simulation at system sizes d = 327 — the regime relevant to near-term quantum control (single- and few-qubit transmon gates) — the dominant performance bottleneck is memory bandwidth at cache hierarchy boundaries, not arithmetic throughput. This repository provides:

  • A bare-metal C implementation of the Lindblad propagator (src/)
  • A Roofline model characterization across d = 3, 9, 27 (analysis/roofline.py)
  • Cache-pressure analysis: working set sizes vs L1/L2/L3 boundaries (analysis/cache_math.py)
  • Compiler-generated assembly analysis at multiple flag levels (godbolt/)
  • QuTiP reference implementation for validation and baseline comparison (reference/)
  • Timing benchmarks comparing scalar C, auto-vectorized C, and QuTiP (benchmarks/)

Background

The Lindblad master equation governs the evolution of an open quantum system:

dρ/dt = -i[H, ρ] + Σ_k (L_k ρ L_k† - ½{L_k†L_k, ρ})

For a d-level system, ρ is a d×d complex matrix. The superoperator L acts on the vectorized density matrix vec(ρ) ∈ ^(d²), making each propagation step a (d²)×(d²) matrix-vector multiply. At d=3 (single transmon), this is a 9×9 system. At d=9 (two-qubit), 81×81. At d=27 (three-qubit with leakage), 729×729.

The working set sizes — 1.3 KB, 105 KB, 8.5 MB — straddle the L1/L2/L3 boundaries of modern CPUs, making this an ideal case study in cache-hierarchy performance analysis.

Build

# Auto-vectorized build (default)
cmake -B build && cmake --build build

# Scalar-only build (for assembly comparison)
cmake -B build-scalar -DVECTORIZE=OFF && cmake --build build-scalar

# Run tests
cd build && ctest --output-on-failure

# Run a benchmark
./build/bench_propagate

Cross-validation against QuTiP

The C library is cross-validated against QuTiP through a NumPy extension. The static library must be built position-independent so it can link into the extension:

cmake -B build -DCMAKE_POSITION_INDEPENDENT_CODE=ON && cmake --build build
pip install numpy qutip pytest
pip install -e python/

# Compares lb_evolve against qutip.mesolve and qutip's exact propagator.
pytest python/test_crossval.py -m crossval

Repository Structure

src/            Bare-metal C library (expm, lindblad, propagate, evolve)
include/        Public API header
benchmarks/     Timing harness (POSIX clock_gettime)
reference/      QuTiP reference implementation
analysis/       Cache math, Roofline model, speedup plots
godbolt/        Compiler Explorer permalink catalog
python/         CPython C extension (NumPy interface) + QuTiP cross-validation
tests/          Correctness tests (trace preservation, unitarity)
paper/          LaTeX source

Dependencies

C library: C11, POSIX, -lm. No external dependencies.

Python analysis:

pip install -r reference/requirements.txt

Paper: LaTeX with revtex4-2 (PRA style) or IEEEtran.

Citation

@misc{malarchick2026lindblad,
  title  = {Cache Hierarchy and Vectorization Analysis of Lindblad Master Equation
             Simulation for Near-Term Quantum Control},
  author = {Malarchick, Rylan},
  year   = {2026},
  note   = {arXiv preprint, arXiv:2603.18052}
}

License

MIT