Fast Reverse-Mode Automatic Differentiation using Expression Templates in C++

2014 ◽  
Vol 40 (4) ◽  
pp. 1-16 ◽  
Author(s):  
Robin J. Hogan
Author(s):  
Wei Zhang ◽  
Dingxi Wang ◽  
Xiuquan Huang ◽  
Tianxiao Yang ◽  
Hong Yan ◽  
...  

The linear and nonlinear harmonic methods are efficient frequency domain methods for analyzing time periodic unsteady flow fields. They have been widely used in both academia and industry. But the cost and complexity of developing a linear harmonic solver has been limiting its wider applications. On the other hand, the automatic differentiation (AD) has long been used in the CFD community with a focus on generating adjoint codes in a reverse mode. All those AD tools can do a much better job in generating linearized codes in a tangent mode, but so far very little, if any, attention is paid to using AD for developing linear harmonic solvers. The linear harmonic method, in comparison with the harmonic balance method, has its own advantages. For example, it can capture small disturbances very effectively, and avoids aliasing errors which can lead to solution instability since each wave component is solved for separately. This paper presents the effort of using an AD tool to generate major source codes for the development of a linear harmonic solver for analyzing time periodic unsteady flows. It includes the procedures and advice of using AD for such a purpose. A case study is also presented to validate the developed linear harmonic solver.


Author(s):  
Johannes Blühdorn ◽  
Nicolas R. Gauger ◽  
Matthias Kabel

AbstractWe propose a universal method for the evaluation of generalized standard materials that greatly simplifies the material law implementation process. By means of automatic differentiation and a numerical integration scheme, AutoMat reduces the implementation effort to two potential functions. By moving AutoMat to the GPU, we close the performance gap to conventional evaluation routines and demonstrate in detail that the expression level reverse mode of automatic differentiation as well as its extension to second order derivatives can be applied inside CUDA kernels. We underline the effectiveness and the applicability of AutoMat by integrating it into the FFT-based homogenization scheme of Moulinec and Suquet and discuss the benefits of using AutoMat with respect to runtime and solution accuracy for an elasto-viscoplastic example.


2021 ◽  
Author(s):  
Yuxuan Jing ◽  
Rami M. Younis

Abstract Automatic differentiation software libraries augment arithmetic operations with their derivatives, thereby relieving the programmer of deriving, implementing, debugging, and maintaining derivative code. With this encapsulation however, the responsibility of code optimization relies more heavily on the AD system itself (as opposed to the programmer and the compiler). Moreover, given that there are multiple contexts in reservoir simulation software for which derivatives are required (e.g. property package and discrete operator evaluations), the AD infrastructure must also be adaptable. An Operator Overloading AD design is proposed and tested to provide scalability and computational efficiency seemlessly across memory- and compute-bound applications. This is achieved by 1) use of portable and standard programming language constructs (C++17 and OpenMP 4.5 standards), 2) adopting a vectorized programming interface, 3) lazy evaluation via expression templates, and 4) multiple memory alignment and layout policies. Empirical analysis is conducted on various kernels spanning various arithmetic intensity and working set sizes. Cache- aware roofline analysis results show that the performance and scalability attained are reliably ideal. In terms of floapting point operations executed per second, the performance of the AD system matches optimized hand-code. Finally, the implementation is benchmarked using the Automatically Differentiable Expression Templates Library (ADETL).


2006 ◽  
Vol 14 (2) ◽  
pp. 81-110 ◽  
Author(s):  
Christophe Prud'homme

In this article, we present a domain specific embedded language inC++ that can be used in various contexts such as numerical projection onto a functional space, numerical integration, variational formulations and automatic differentiation. Albeit these tools operate in different ways, the language overcomes this difficulty by decoupling expression constructions from evaluation. The language is implemented using expression templates and meta-programming techniques and uses various Boost libraries. The language is exercised on a number of non-trivial examples and a benchmark presents the performance behavior on a few test problems.


Sign in / Sign up

Export Citation Format

Share Document