CuAD: Source-to-Source Automatic Differentiation of CUDA Kernels for Discrete Adjoints in Computational Fluid Dynamics
Seunghyun Joo
Key points
From the paper's conclusion- We evaluate CuAD on four kernels from simple flow models: a viscous Burgers residual, a two-dimensional advection-diffusion residual, a quasi-one-dimensional Euler residual and a Biot-Savart summation over point vortices.
Abstract
Discrete adjoint methods give the sensitivities that aerodynamic design and data assimilation require, but they remain hard to obtain for flow solvers that run on graphics processors. This paper presents CuAD, a source-to-source automatic differentiation tool that reads CUDA kernels and writes their tangent and adjoint versions as ordinary CUDA source. Its reverse mode is organised around the GPU thread and exploits the structure of flow-solver kernels: pure accumulations need no tape, the remaining intermediate values are recomputed rather than stored, and adjoint updates are atomic only where several threads reach the same memory. We evaluate CuAD on four kernels from simple flow models: a viscous Burgers residual, a two-dimensional advection-diffusion residual, a quasi-one-dimensional Euler residual and a Biot-Savart summation over point vortices. All generated derivatives agree with finite differences and pass adjoint dot-product tests to round-off, while the adjoint kernels cost two to six times the primal kernels. Compared with the compiler-based tool Clad under the same compiler, CuAD gives identical results at identical cost on the stencil kernels and is 16 to 470 times faster on the summation kernel because it stores no tape. A steady Burgers study shows that in single precision the adjoint gradient of a finite-difference Jacobian reaches errors of 45 to 75 per cent once the condition number grows to $2.5\times10^{5}$, whereas the CuAD Jacobian keeps the error below $5\times10^{-5}$. Four applications complete the evaluation: adjoint fields of the Burgers shock, the sensitivity of a scalar sensor in a cellular vortex, the inverse design of a transonic nozzle whose area is recovered to $2\times10^{-8}$, and an unsteady adjoint of the roll-up of a vortex sheet over 400 time steps.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- A GPU-efficient local ADER finite-difference method for compressible-flow DNSarXiv · 2026
- An Implicit Discrete Adjoint Unified Gas-Kinetic Scheme for Sensitivity Analysis and Shape Optimization in Multiscale Gas FlowsarXiv · 2026
- Backpropagation Through Compiled CodeACM Transactions on Mathematical Software · 2026
- TorchFDTD: Differentiable FDTD on a single GPUarXiv · 2026
- ADSPICE: A Method of Automatic Differentiation for Gradient-Based Lumped Circuit Optimization with Native SPICEarXiv · 2026
- A tensor-free parallel method for second-order flow-field sensitivities in transonic flowPhysics of Fluids · 2026