CoDiPack  2.2.0
A Code Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
codi::EditingTapeInterface< T_Position > Struct Template Reference

Edit tapes after they have been recorded. More...

#include <editingTapeInterface.hpp>

Inheritance diagram for codi::EditingTapeInterface< T_Position >:

Public Types

using Position = T_Position
 See EditingTapeInterface.
 

Public Member Functions

Interface definition
void erase (Position const &start, Position const &end)
 Erase a part of the tape. It has to hold start <= end.
 
void erase (Position const &start, Position const &end, EditingTapeInterface &emptyTape)
 Erase a part of the tape. It has to hold start <= end. This variant of erase takes a reference to an empty helper tape. It is used as a buffer to implement erase via reset and append while avoiding the overhead of allocating a temporary tape for each erase call. Upon returning, emptyTape is guaranteed to be empty again, in the sense of a tape reset.
 
void append (EditingTapeInterface &source, Position const &start, Position const &end)
 

Detailed Description

template<typename T_Position>
struct codi::EditingTapeInterface< T_Position >

Edit tapes after they have been recorded.

These interface functions can be used to modify the tape after it has been recorded. Specifically, they allow to erase parts of a tape, and to append a specific range of a source tape to a destination tape.

This interface was introduced for additional flexibility when managing multiple tapes in a shared-memory parallel context. The erase function, for example, can be used to remove a preliminary recording from the tape once additional information is available. The append function can be used to move recordings ending up in the wrong tape to the correct one. This is only required in edge cases and most AD workflows will never make use of this interface, especially if they use only a single tape. Other cases might be covered by (positional) tape resets.

Note that tapes with a linear index management strategy (see LinearIndexManager) can't implement this interface because a statement's left hand side index is implicitly encoded in the statement's position on the tape. Erasing parts of a tape would produce wrong subsequent left hand side indices, and appending statements from one tape to another is not meaningful because the sequences of left hand side indices are tape-specific.

Template Parameters
T_PositionGlobal tape position, usually chosen as Tape::Position.

Member Function Documentation

◆ append()

template<typename T_Position >
void codi::EditingTapeInterface< T_Position >::append ( EditingTapeInterface< T_Position > &  source,
Position const &  start,
Position const &  end 
)

Copy the specified range of the source tape and append it to the end of this tape. It has to hold start <= end.


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