01 · Task parallel
Many small circuits
Independent fragments, each happy with a slice of a GPU. Schedule them. Do not invent a bigger vector than the fragment needs.
HPC talk
Hybrid quantum programs, run as memory-bound kernels on CPUs, GPUs, and MPI jobs.
Based on Hybrid quantum programming with PennyLane Lightning on HPC platforms (arXiv:2403.02512).
The working set
Stated size, not bar height: 24 qubits and thousands of parameters can take hundreds of gigabytes.
Workload shapes
01 · Task parallel
Independent fragments, each happy with a slice of a GPU. Schedule them. Do not invent a bigger vector than the fragment needs.
02 · One device
One circuit owns the CPU socket or the local GPU. Kernel choice and overheads decide the runtime.
03 · Distributed
Multi-GPU or multi-node. The state is partitioned, and gates that touch remote amplitudes pay for the network.
The paper sets out to cover these three. A fourth, mixing them in one job, is left for later.
Kernel
Backends
lightning.qubit
C++17/20 on the CPU. OpenMP over observables, and optionally over the gate.
At runtime the x86_64 build picks a portable kernel, AVX2, or AVX-512. No recompile.
lightning.gpu
NVIDIA cuQuantum on CUDA compute capability 7.0 and newer.
The same API runs distributed, through MPI and cuStateVec, including adjoint gradients.
lightning.kokkos
The same kernels in Kokkos: OpenMP, CUDA from Pascal through Ampere, and ROCm on Instinct MI100 and MI200.
Useful when the CPU has many cores and few observables, or the GPU is not NVIDIA.
Every backend is templated on 32-bit or 64-bit floats, from Python down to the kernel. The benchmarks below are double precision.
CPU microbenchmark
perf c2c pointed at cache eviction from extra loads and stores._mm512_stream_pd in place of _mm512_store_pd) give AVX-512 the lead back when the thread count is high.Same machine, Hadamard, RX, and CNOT against other simulators: best single-thread time and the lowest variance. At the top thread count the spread is on the order of 10−3 seconds.
Why the 1-thread number matters
Adjoint
Adjoint differentiation applies each parametric gate a constant number of times. Parameter-shift and finite differences are quadratic in the parameter count.
OpenMP
The gradient farms observables out as OpenMP threads. Inside each thread the kernel is often single-threaded, so the 1-thread SIMD result is the one the pipeline multiplies.
Do not compare naively
A simulator without this gradient path is solving a harder loop. The paper treats that as an unfair comparison, not a missing speedup.
Single node · VQE
Task farm · Perlmutter
Distributed VQE · LUMI
This is task parallelism over the Hamiltonian, not one state vector sliced across ranks. The next slide is the other kind of MPI.
MPI state vector · Perlmutter
80 GB A100s, Cray MPICH, CUDA 11.7, December 2023. Elsewhere the paper’s examples reach 30 qubits on one device, a 36-qubit MPI illustration, and 41 qubits across nodes.
The distributed GPU backend returns that adjoint Jacobian. The paper presents it as the distributed state-vector implementation that supports this gradient.
Scheduling
| What you have | What the paper’s numbers say |
|---|---|
| Under 20 qubits | CPU. Overheads make the GPU slower. Thread the observables, and let the runtime pick AVX2 or AVX-512. |
| 20–24 qubits, thousands of terms | One GPU. About 2× at 20 qubits and 2,951 terms, around 7× at 24 qubits and 6,401 terms. |
| Tens of thousands of fragments | Batch them. 45,711 fragments reached about 80 circuits per second on 256 GPUs. On-demand allocation did worse. |
| One vector past a device | MPI. Budget for weak-scaling efficiency of 8% (sampling, 256 GPUs) or 30% (gradients, 512 GPUs), out to 41 qubits in these examples. |
Takeaways
Based on Hybrid quantum programming with PennyLane Lightning on HPC platforms (arXiv:2403.02512).