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

被引:111
作者
Hogan, Robin J. [1 ]
机构
[1] Univ Reading, Dept Meteorol, Reading RG6 6BB, Berks, England
来源
ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE | 2014年 / 40卷 / 04期
关键词
Algorithms; Performance; Adjoint code; quasi-Newton; template metaprogramming; Jacobian matrix; FAST LIDAR;
D O I
10.1145/2560359
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Gradient-based optimization problems are encountered in many fields, but the associated task of differentiating large computer algorithms can be formidable. The operator-overloading approach to performing reverse-mode automatic differentiation is the most convenient for the user but current implementations are typically 10-35 times slower than the original algorithm. In this paper a fast new operator-overloading method is presented that uses the expression template programming technique in C++ to provide a compile-time representation of each mathematical expression as a computational graph that can be efficiently traversed in either direction. Benchmarking with four different numerical algorithms shows this approach to be 2.6-9 times faster than current operator-overloading libraries, and 1.3-7.7 times more efficient in memory usage. It is typically less than 4 times the computational cost of the original algorithm, although poorer performance is found for all libraries in the case of simple loops containing no mathematical functions. An implementation is freely available in the Adept C++ software library.
引用
收藏
页数:16
相关论文
共 20 条
[1]   Automatic differentiation in C++ using expression templates and application to a flow control problem [J].
Aubert, Pierre ;
Di Césaré, Nicolas ;
Pironneau, Olivier .
Computing and Visualization in Science, 2001, 3 (04) :197-208
[2]  
Bartlett RA, 2006, LECT NOTES COMPUT SC, V3994, P525
[3]  
Bell B., 2007, CPPAD PACKAGE C ALGO
[4]  
Bendtsen C., 1996, Technical Report IMM-REP-1996-17
[5]  
Gay D.M., 2006, Lecture Notes in Computational Science and Engineering, P147, DOI [10.1007/3-540-28438-9_13, DOI 10.1007/3-540-28438-9_13]
[6]   What color is your Jacobian? Graph coloring for computing derivatives [J].
Gebremedhin, AH ;
Manne, F ;
Pothen, A .
SIAM REVIEW, 2005, 47 (04) :629-705
[7]   Recipes for adjoint code construction [J].
Giering, R ;
Kaminski, T .
ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE, 1998, 24 (04) :437-474
[8]   Algorithm 755: ADOL-C: A package for the automatic differentiation of algorithms written in C/C++ [J].
Griewank, A ;
Juedes, D ;
Utke, J .
ACM TRANSACTIONS ON MATHEMATICAL SOFTWARE, 1996, 22 (02) :131-167
[9]  
Griewank A., 2008, EVALUATING DERIVATIV, V2nd
[10]   Fast Lidar and Radar Multiple-Scattering Models. Part II: Wide-Angle Scattering Using the Time-Dependent Two-Stream Approximation [J].
Hogan, Robin J. ;
Battaglia, Alessandro .
JOURNAL OF THE ATMOSPHERIC SCIENCES, 2008, 65 (12) :3636-3651