# Automatic Differentiation for Adjoint Stencil Loops

**Authors:** Jan H\"uckelheim, Navjot Kukreja, Sri Hari Krishna Narayanan, Fabio, Luporini, Gerard Gorman, Paul Hovland

arXiv: 1907.02818 · 2019-07-08

## TL;DR

This paper introduces a novel automatic differentiation technique that maintains the efficient, parallelisable stencil-like structure of loops, enabling high-performance gradient computations in scientific and neural network applications.

## Contribution

The paper presents a new method combining automatic differentiation with loop transformations to preserve stencil loop structures for efficient, parallelizable gradient computation.

## Key findings

- Implemented in the Python tool PerforAD
- Applied to seismic imaging and fluid dynamics
- Achieves stencil-like, parallelisable derivatives

## Abstract

Stencil loops are a common motif in computations including convolutional neural networks, structured-mesh solvers for partial differential equations, and image processing. Stencil loops are easy to parallelise, and their fast execution is aided by compilers, libraries, and domain-specific languages. Reverse-mode automatic differentiation, also known as algorithmic differentiation, autodiff, adjoint differentiation, or back-propagation, is sometimes used to obtain gradients of programs that contain stencil loops. Unfortunately, conventional automatic differentiation results in a memory access pattern that is not stencil-like and not easily parallelisable.   In this paper we present a novel combination of automatic differentiation and loop transformations that preserves the structure and memory access pattern of stencil loops, while computing fully consistent derivatives. The generated loops can be parallelised and optimised for performance in the same way and using the same tools as the original computation. We have implemented this new technique in the Python tool PerforAD, which we release with this paper along with test cases derived from seismic imaging and computational fluid dynamics applications.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1907.02818/full.md

## Figures

20 figures with captions in the complete paper: https://tomesphere.com/paper/1907.02818/full.md

## References

28 references — full list in the complete paper: https://tomesphere.com/paper/1907.02818/full.md

---
Source: https://tomesphere.com/paper/1907.02818