Checkpointing
template <typename TapeType>
class CheckpointCallback Base class of any checkpoint callbacks associated with the given TapeType.
User-defined checkpoints should derive from this class and implement computeAdjoint to implement the adjoint computation of the checkpoint. An object of this class should then be registered with the tape using Tape<T>::insertCallback. During computing adjoints, XAD then calls this registered callback each time it reaches the corresponding point in the tape.
Implementers are responsible to store all needed information for the checkpoint within this class, and to keep it if adjoints are computed more than once. That is:
- The values of input variables,
- Their slots in the tape,
- The slots of the output variables on the tape,
- Any other information that may be needed to propagate the adjoints of the outputs back to its input variables
computeAdjoint
virtual void computeAdjoint(TapeType* tape) = 0
This function is called by XAD during rolling back the tape, giving a pointer to the tape. Gives weak exception guarantee - if this user-implemented function throws an exception, the tape is in an undefined state and needs to be reset/re-initialized before it can be used again.
Questions or issues: GitHub Discussions · issues. Would you rather we AAD-enabled your code? Get a free speed-up estimate.