15#ifndef ADOLC_CHECKPOINTING_H
16#define ADOLC_CHECKPOINTING_H
142 registerTimeStepFunction(tapeId, tapeIdCheck, timeStepFunction);
153 cpInfos->function_double = timeStepFunction;
163 cpInfos->saveNonAdoubles = saveState;
173 cpInfos->restoreNonAdoubles = restoreState;
234 void registerTimeStepFunction(
short tapeId,
short tapeIdCheck,
#define ADOLC_API
Definition adolcexport.h:16
ADOLC::CP::TimeStepFunctionDouble ADOLC_TimeStepFuncion_double
Definition checkpointing.h:242
ADOLC::CP::TimeStepFunction ADOLC_TimeStepFuncion
Definition checkpointing.h:241
ADOLC::CP::SaveFunction ADOLC_saveFct
Definition checkpointing.h:243
ADOLC::CP::RestoreFunction ADOLC_restoreFct
Definition checkpointing.h:244
Public checkpointing setup and execution context.
Definition checkpointing.h:130
void setInput(adouble *x)
Set the active input state of the checkpointed loop.
Definition checkpointing.h:202
void setSaveFct(SaveFunction saveState)
Register an optional callback that saves extra non-adouble state at each checkpoint.
Definition checkpointing.h:162
int checkpointing(short tapeId)
Replace the explicit time loop by a checkpointed external function call during taping.
void setNumberOfSteps(int number)
Set the total number of time steps in the checkpointed loop.
Definition checkpointing.h:181
void setOutput(adouble *y)
Set the active output state of the checkpointed loop.
Definition checkpointing.h:209
Context(short tapeId, short tapeIdCheck, TimeStepFunction timeStepFunction)
Create a checkpointing context for one time-stepping routine.
Definition checkpointing.h:141
void setDoubleFct(TimeStepFunctionDouble timeStepFunction)
Register the passive one-step function used for untaped replay.
Definition checkpointing.h:152
void setAlwaysRetaping(bool state)
Control whether the one-step tape is rebuilt before every step.
Definition checkpointing.h:217
void setRestoreFct(RestoreFunction restoreState)
Register an optional callback that restores extra non-adouble state from a checkpoint.
Definition checkpointing.h:172
void setNumberOfCheckpoints(int number)
Set the number of checkpoints available to revolve.
Definition checkpointing.h:188
void setDimensionXY(int dim)
Set the dimension of the in-place state vector.
Definition checkpointing.h:195
Taped active scalar for reusable forward and reverse differentiation.
Definition adtb_types.h:211
std::array< double *, 2 > StackElement
Snapshot entry stored on the checkpoint stack.
Definition checkpointing.h:60
Definition checkpointing.h:25
int(size_t dimX, double *state) TimeStepFunctionDouble
Signature of the passive one-step function.
Definition checkpointing.h:39
void(void *) RestoreFunction
Signature of an optional callback that restores saved non-adouble state.
Definition checkpointing.h:50
void *(void) SaveFunction
Signature of an optional callback that saves extra non-adouble state.
Definition checkpointing.h:44
int(size_t dimX, adouble *state) TimeStepFunction
Signature of the active one-step function.
Definition checkpointing.h:32
Internal checkpointing state shared between the public context and the recorded external function.
Definition checkpointing.h:69
void revolveForward(int keep)
Run the forward checkpoint schedule for the current state.
RestoreFunction * restoreNonAdoubles
Definition checkpointing.h:77
int check
Definition checkpointing.h:91
int checkpoints
Definition checkpointing.h:79
TimeStepFunctionDouble * function_double
Definition checkpointing.h:75
void clearStack()
Free all stored checkpoint snapshots.
void revolveError()
Raise an ADOL-C error for the current revolve status code.
void restore()
Restore the current checkpoint state from the top of the stack.
adouble * adp_x
Definition checkpointing.h:88
int steps
Definition checkpointing.h:78
TimeStepFunction * function
Definition checkpointing.h:74
void tapeStep(int keep) const
Tape one time step at the current internal state.
void takeSnapshot()
Save the current checkpoint state on the internal stack.
int info
Definition checkpointing.h:94
int currentCP
Definition checkpointing.h:95
adouble * adp_y
Definition checkpointing.h:89
char * allmem
Definition checkpointing.h:99
int capo
Definition checkpointing.h:92
int fine
Definition checkpointing.h:93
short tapeId
Definition checkpointing.h:73
short cpTapeId
Definition checkpointing.h:84
void release()
Drop the most recent checkpoint snapshot.
SaveFunction * saveNonAdoubles
Definition checkpointing.h:76
size_t index
Definition checkpointing.h:97
bool retaping
Definition checkpointing.h:85
std::stack< StackElement > cpStack
Definition checkpointing.h:100
~Infos()
Definition checkpointing.h:70
double * dp_internal_for
Definition checkpointing.h:96
int dim
Definition checkpointing.h:87