cuda-q-gpu-acceleration
Table of Contents
GPU Acceleration with cuQuantum
GPU acceleration via NVIDIA's cuQuantum enables simulation of large quantum systems (20+ qubits) with high performance. The GPU backend exploits parallelism in state vector operations.
#include "cudaq.h" // Large circuit: 25 qubits (requires GPU) struct LargeCircuit { void operator()() __qpu__ { int n = 25; cudaq::qvector q(n); // Hadamard layer: O(n) gates for (int i = 0; i < n; i++) { h(q[i]); } // Entangling layer: two-qubit gates for (int i = 0; i < n - 1; i++) { cx(q[i], q[i+1]); } // Rotation layer for (int i = 0; i < n; i++) { rz(0.5 * i, q[i]); } mz(q); } }; int main() { // Use GPU simulator cudaq::set_target("nvidia"); // 25 qubits = 2^25 = 33M complex numbers // GPU can handle this; classical simulation would be intractable printf("Simulating 25-qubit circuit on GPU...\n"); auto result = cudaq::sample<LargeCircuit>(1000); printf("Samples collected: %lu\n", result.size()); // Timing: GPU is ~100x faster than CPU for such sizes return 0; }
Performance
CPU: ~1 μs per gate operation (classical state vector)
GPU (cuQuantum): ~10 ns per gate (parallelized across many cores)
Practical limit: CPU ~20 qubits, GPU ~25–30 qubits (within seconds)
GPU acceleration is critical for testing algorithms before deploying to real hardware.
cuda-q-gpu-acceleration.md · Last modified: by 127.0.0.1
