CoDiPack defines several different tapes and options for these tapes, which results in a large range of possible tape configurations. Each tape is bound to an active type which has to be used in the application for the differentiation. The most used types are:
These two types are configured such that they work mostly out of the box and the user does not need to worry that much about modifying his application for the type.
The other codi::RealReverse* type definitions have some common postfixes. Each of these postfixes changes some aspects of the tape implementation. If they are not used, the default is used instead.
The most common reverse AD types are:
The current postfixes are:
Index managers handle the distribution of the identifiers used by CoDiPack. Each identifier is coupled to a variable and depending on the manager, different strategies are used for the creation, deletion and reuse of identifiers. There are currently three index managers available in CoDiPack.
codi::LinearIndexManager distributes the identifiers in an increasing fashion. Each identifier is used only once during the tape recording. A reset on the tape will also reset the identifiers and all values need to be registered again. This index manager is compatible with C-like memory operations (e.g. memcpy). Tapes which use this index manager do not need to store statements which perform a copy operation. It is the default index manager in CoDiPack.
codi::ReuseIndexManager allows identifiers to be reused. The lifetime of an identifier is determined by the lifetime of the associated variable (value). If the value is overwritten or the variable is freed, then the lifetime of the identifier ends and it can be reused. In case of an overwrite a new identifier is generated. This index manager is currently not used directly in CoDiPack. The application cannot use C-like memory operations. Copy operations need to be stored by the tape.
codi::MultiUseIndexManager is an extension of the codi::ReuseIndexManager. It allows that copy operations do not need to be stored by the tape. The application still cannot use C-like memory operations. It is the default index manager for types that use the 'Index' postfix.
The statement evaluators define how the expressions are stored in primal value tapes. Depending on the implementation the support for different forward and reverse evaluations might vary. The number of jumps the CPU has to do might also be affected by the implementation.
codi::ReverseStatementEvaluator stores the function pointer for the reverse evaluation of the expression in the tape. Therefore it supports only reverse tape evaluations.
codi::DirectStatementEvaluator creates static handles in the binaries and stores the pointers to theses handles in the tape. This requires one additional address lookup by the CPU. It supports all evaluation modes of the tape.
codi::InnerStatementEvaluator uses the same strategy as the codi::DirectStatementEvaluator for the handle creation, but it shifts the boundary between the tape evaluation and the statement evaluation towards the statement evaluation. This allows the compiler to optimize also for the general setup of the statement evaluation (e.g. copying passive values).