Exporting ADOL-C API for scripting languages using SWIG

K. Kulshreshtha
S.H.K. Narayanan
J. Bessac
K. MacIntyre
Seminar

Scripting languages are gaining acceptance in the scientific community for purposes of prototyping and due to ease of use. In the context of algorithmic differentiation, however, the development effort continues to be concentrated on traditional compiled languages like Fortran and C/C++, be it source transformation or operator overloading. Although scripting languages may not be quite suited for high performance computing, providing ways to compute derivatives efficiently in these languages is a worthwhile goal. ADOL-C is an operator overloading based C++ library that provides accurate first and higher order derivatives for applications in C++. In recent years an automatic interface generator called SWIG has been developed that uses the C/C++ header files to wrap the API of a library into various scripting languages like Python, R, C-sharp, Perl, Javascript, Go, Octave etc. Although every language has its caveats, the overall process of making the C/C++ API available via SWIG is the same for all scripting languages. After the initial effort required per language, the effort required to maintain the scripting interface in sync with upstream developments in the C/C++ library is minimal. Initial studies using Python and R have shown great promise encouraging us to work further to support the more challenging features of ADOL-C like externally differentiated functions. This talk will give an overview of the interface generation process, the caveats we encountered for various scripting languages, and some numerical results.