ADOL-C: Automatic Differentiation in C/C++ 2.7.3
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ADOLC::CP::Context Class Reference

Public checkpointing setup and execution context. More...

#include <checkpointing.h>

Public Member Functions

 Context ()=delete
 
 Context (short tapeId, short tapeIdCheck, TimeStepFunction timeStepFunction)
 Create a checkpointing context for one time-stepping routine.
 
 ~Context ()=default
 
void setDoubleFct (TimeStepFunctionDouble timeStepFunction)
 Register the passive one-step function used for untaped replay.
 
void setSaveFct (SaveFunction saveState)
 Register an optional callback that saves extra non-adouble state at each checkpoint.
 
void setRestoreFct (RestoreFunction restoreState)
 Register an optional callback that restores extra non-adouble state from a checkpoint.
 
void setNumberOfSteps (int number)
 Set the total number of time steps in the checkpointed loop.
 
void setNumberOfCheckpoints (int number)
 Set the number of checkpoints available to revolve.
 
void setDimensionXY (int dim)
 Set the dimension of the in-place state vector.
 
void setInput (adouble *x)
 Set the active input state of the checkpointed loop.
 
void setOutput (adouble *y)
 Set the active output state of the checkpointed loop.
 
void setAlwaysRetaping (bool state)
 Control whether the one-step tape is rebuilt before every step.
 
int checkpointing (short tapeId)
 Replace the explicit time loop by a checkpointed external function call during taping.
 

Detailed Description

Public checkpointing setup and execution context.

A Context ties one active time-step function to an outer tape and to a second tape that stores the one-step checkpoint tape used during replay.

Constructor & Destructor Documentation

◆ Context() [1/2]

ADOLC::CP::Context::Context ( )
delete

◆ Context() [2/2]

ADOLC::CP::Context::Context ( short  tapeId,
short  tapeIdCheck,
TimeStepFunction  timeStepFunction 
)
inline

Create a checkpointing context for one time-stepping routine.

Parameters
tapeIdOuter tape that records the full computation.
tapeIdCheckTape used for the one-step checkpoint tape.
timeStepFunctionActive one-step function.

◆ ~Context()

ADOLC::CP::Context::~Context ( )
default

Member Function Documentation

◆ checkpointing()

int ADOLC::CP::Context::checkpointing ( short  tapeId)

Replace the explicit time loop by a checkpointed external function call during taping.

This runs the primal time stepping once and records the information needed for checkpoint-aware forward and reverse drivers on the outer tape.

Parameters
tapeIdOuter tape id used for the surrounding trace.
Returns
Zero on success.

◆ setAlwaysRetaping()

void ADOLC::CP::Context::setAlwaysRetaping ( bool  state)
inline

Control whether the one-step tape is rebuilt before every step.

Parameters
stateIf true, always retape. If false, reuse the step tape until a branch change forces retaping.

◆ setDimensionXY()

void ADOLC::CP::Context::setDimensionXY ( int  dim)
inline

Set the dimension of the in-place state vector.

Parameters
dimNumber of input and output variables per time step.

◆ setDoubleFct()

void ADOLC::CP::Context::setDoubleFct ( TimeStepFunctionDouble  timeStepFunction)
inline

Register the passive one-step function used for untaped replay.

Parameters
timeStepFunctionPassive one-step function.

◆ setInput()

void ADOLC::CP::Context::setInput ( adouble *  x)
inline

Set the active input state of the checkpointed loop.

Parameters
xPointer to the first active state entry before the loop.

◆ setNumberOfCheckpoints()

void ADOLC::CP::Context::setNumberOfCheckpoints ( int  number)
inline

Set the number of checkpoints available to revolve.

Parameters
numberNumber of stored checkpoints.

◆ setNumberOfSteps()

void ADOLC::CP::Context::setNumberOfSteps ( int  number)
inline

Set the total number of time steps in the checkpointed loop.

Parameters
numberNumber of time steps.

◆ setOutput()

void ADOLC::CP::Context::setOutput ( adouble *  y)
inline

Set the active output state of the checkpointed loop.

Parameters
yPointer to the first active state entry after the loop.

◆ setRestoreFct()

void ADOLC::CP::Context::setRestoreFct ( RestoreFunction  restoreState)
inline

Register an optional callback that restores extra non-adouble state from a checkpoint.

Parameters
restoreStateRestore callback.

◆ setSaveFct()

void ADOLC::CP::Context::setSaveFct ( SaveFunction  saveState)
inline

Register an optional callback that saves extra non-adouble state at each checkpoint.

Parameters
saveStateSave callback.

The documentation for this class was generated from the following file: