cudaq-gpu-kernelslisted
Install: claude install-skill rustcircle/c101
# CUDA-Q GPU kernels
CUDA-Q compiles typed quantum kernels and runs them on interchangeable targets: CPU and GPU
statevector, multi-GPU pooled memory, one virtual QPU per GPU, tensor networks, density matrices
and hardware. Pick the target from memory math, batch work across QPUs asynchronously, and check
conventions (bit order, exp_pauli sign) once per project. Facts marked verified were checked on
CUDA-Q 0.16 (CPU build); GPU targets exist only in CUDA-enabled Linux builds, so confirm them with
`cudaq.get_targets()` on the machine. Simulator choice beyond CUDA-Q: `quantum-circuit-simulators`.
## 1. Kernel model
```python
import cudaq
@cudaq.kernel
def ghz(n: int):
q = cudaq.qvector(n)
h(q[0])
for i in range(n - 1):
x.ctrl(q[i], q[i + 1])
mz(q)
@cudaq.kernel
def ansatz(theta: float): # every argument annotated: int, float, bool, list[float], cudaq.pauli_word, ...
q = cudaq.qvector(4)
x(q[0])
x(q[1])
exp_pauli(theta, q, "XXXY")
```
- Gates: `h x y z s t rx ry rz r1 u3 swap`, controlled `x.ctrl(c, t)`, adjoint `t.adj(q)`,
measurement `mz mx my`, Pauli exponentials `exp_pauli(theta, qubits, word)`; kernels can call
other kernels and use `cudaq.control` / `cudaq.adjoint`.
- Control flow: `for` over `range`, `if` on mid-circuit measurement results, kernel arguments.
- Restrictions: kernels are a statically compiled Python subset. No general Python objects,
external libraries, exceptions or untyped containers inside;