A multi-language auto-differentiation module and its application to a parallel particle-in-cell code on distributed computers
Ji Qianga, Yue Hao, Allen Qiang, Jinyu Wan
TL;DR
This work tackles the need for efficient, transparent auto-differentiation in large-scale accelerator simulations by developing a fast forward-mode TPSA-based AD module that stores first derivatives in a compact array and supports multi-language implementations. The module is integrated into a two-dimensional MPI-based parallel PIC code to enable sensitivity analysis and gradient-based optimization of lattice parameters under space-charge effects, with demonstrated accuracy against finite-difference methods and substantial speedups over traditional TPSA approaches. The approach facilitates in-situ computation of derivatives during simulation, enabling practical optimization workflows for accelerator design in distributed computing environments. Overall, the paper provides a portable, low-overhead tool for differentiable simulations that can enhance design, control, and optimization in beam dynamics and related fields.
Abstract
The auto differentiable simulation is a type of simulation that outputs of the simulation include not only the simulation result itself, but also their derivatives with respect to various input parameters. It provides an efficient method to study sensitivity of the simulation results with respect to the input parameters. Furthermore, it can be used in gradient based optimization methods for rapidly optimizing design parameters. In this paper, we present the development of a fast and transparent auto-differentiation module/class designed for easy integration into numerous simulation codes. As an application, this auto-differentiation module is integrated into a parallel particle-in-cell code with message passing interface (MPI) on distributed memory computers.
