EN FR
EN FR


Section: New Results

AD-adjoints and C dynamic memory management

Participants : Laurent Hascoët, Sri Hari Krishna Narayanan [Argonne National Lab. (Illinois, USA)] , Mathieu Morlighem [University of California at Irvine (USA)] .

One of the current frontiers of AD research is the definition of an adjoint AD model that can cope with dynamic memory management. This research is central in our ongoing effort towards adjoint AD of C, and more remotely towards AD of C++. This research is conducted in collaboration with the MCS department of Argonne National Lab. Our partnership is formalized by joint participation in the Inria joint lab JLESC, and partly funded by the Partner University Fund (PUF) of the French embassy in the USA.

Adjoint AD must reproduce in reverse order the control decisions of the original code. In languages such as C, allocation of dynamic memory and pointer management form a significant part of these control decisions. Reproducing memory allocation in reverse means reallocating memory, possibly receiving a different memory chunk. Reproducing pointer addresses in reverse thus require to convert addresses in the former memory chunks into equivalent addresses in the new reallocated chunks. Together with Krishna Narayanan from Argonne, we experiment on real applications to find the most efficient solution to this address conversion problem. We jointly develop a library (called ADMM, ADjoint Memory Management) whose primitives are used in AD adjoint code to handle this address conversion. Both our AD tool Tapenade and Argonne's tool OpenAD use ADMM in the adjoint code they produce.

This year, ADMM was instrumental in the successful generation of the adjoint code of “ALIF” (formerly called “SEISM”) by Tapenade. The “ALIF” code is developed by Mathieu Morlighem from UC Irvine, jointly with Eric Larour from JPL. This glaciology code is a C clone of the C++ “ISSM” code from JPL. One objective of this work is to clarify the C programming style that allows AD to perform better. Another objective is to make progress in the direction of generating adjoints of C++ code. Although ADMM has already been used with success for the adjoint of several small- to medium-size applications, and now on the large-size code “ALIF”, we are still considering alternative implementation strategies. This work was presented at the AD2016 conference in Oxford [16], and an article is submitted to journal “Optimization Methods and Software”.