Derivgrind
Derivgrind is an automatic differentiation tool applicable to compiled “client” programs. It has been implemented in the Valgrind framework for building dynamic analysis tools. Derivgrind’s entire instrumentation of the client program with forward- or reverse-mode AD logic only relies on the client program’s machine code. Partial access to the client program’s source code might be required for the sole purpose of identifying input and output variables.
Source Code
We released Derivgrind as open source software under the GPLv2 license.
The source code is available on GitHub.
Contact: derivgrind@projects.rptu.de
Lead Developer: Max Aehle
Responsibility: Prof. Dr. Nicolas R. Gauger
Publications
If you use Derivgrind in one of your publications, please cite us!
2022
M. Aehle, J. Blühdorn, M. Sagebaum, N.R. Gauger
Reverse-Mode Automatic Differentiation of Compiled Programs Miscellaneous
arXiv:2212.13760, 2022.
@misc{nokey,
title = {Reverse-Mode Automatic Differentiation of Compiled Programs},
author = {M. Aehle, J. Blühdorn, M. Sagebaum, N.R. Gauger},
url = {https://arxiv.org/pdf/2212.13760.pdf},
year = {2022},
date = {2022-12-28},
urldate = {2022-12-28},
howpublished = {arXiv:2212.13760},
keywords = {},
pubstate = {published},
tppubtype = {misc}
}
M. Aehle, J. Blühdorn, M. Sagebaum, N. R. Gauger
Forward-Mode Automatic Differentiation of Compiled Programs Miscellaneous
arXiv:2209.01895, 2022.
@misc{nokey,
title = {Forward-Mode Automatic Differentiation of Compiled Programs},
author = {M. Aehle, J. Blühdorn, M. Sagebaum, N. R. Gauger},
url = {https://arxiv.org/pdf/2209.01895},
year = {2022},
date = {2022-09-05},
urldate = {2022-09-05},
abstract = {Algorithmic differentiation (AD) is a set of techniques to obtain accurate derivatives of a computer-implemented function in an automatic fashion. State-of-the-art AD tools rely on the source code of the implementation or internal representations of compilers building it.
We present the new AD tool Derivgrind, which augments the machine code of compiled programs with forward AD logic. Derivgrind leverages the Valgrind instrumentation framework for a structured access to the machine code, and a shadow memory tool to store dot values. Depending on the application scenario, no access to the source code is required at all, or the access is restricted to the parts defining input and output variables.
Derivgrind's versatility comes at the price of scaling the running time by a factor between 60 and 140, measured on a benchmark based on a PDE solver. Results of our extensive test suite indicate that Derivgrind produces correct results on GCC- and Clang-compiled programs, including a Python interpreter, with a small number of exceptions. While we provide a list of scenarios that Derivgrind does not handle correctly, most of them are academic examples or originate from highly optimized math libraries. We will therefore further study the potential of our tool in more complex software projects. },
howpublished = {arXiv:2209.01895},
keywords = {},
pubstate = {published},
tppubtype = {misc}
}
Algorithmic differentiation (AD) is a set of techniques to obtain accurate derivatives of a computer-implemented function in an automatic fashion. State-of-the-art AD tools rely on the source code of the implementation or internal representations of compilers building it.
We present the new AD tool Derivgrind, which augments the machine code of compiled programs with forward AD logic. Derivgrind leverages the Valgrind instrumentation framework for a structured access to the machine code, and a shadow memory tool to store dot values. Depending on the application scenario, no access to the source code is required at all, or the access is restricted to the parts defining input and output variables.
Derivgrind’s versatility comes at the price of scaling the running time by a factor between 60 and 140, measured on a benchmark based on a PDE solver. Results of our extensive test suite indicate that Derivgrind produces correct results on GCC- and Clang-compiled programs, including a Python interpreter, with a small number of exceptions. While we provide a list of scenarios that Derivgrind does not handle correctly, most of them are academic examples or originate from highly optimized math libraries. We will therefore further study the potential of our tool in more complex software projects.