![]() |
Documentation 6b54b78464
|
Contains routines for the reverse mode of AD. In case there is no reverse type configured, they have no effect at all, and so the real versions of the routined are after #else. More...
Classes | |
| struct | DebugControl |
| Struct to store information about errors during a tag debug run. More... | |
Typedefs | |
| using | Identifier = int |
Enumerations | |
| enum class | TAPE_DEBUG_OPTION { ALLOW_PREACC , ACTIVATE_PREACC , ALLOW_ZONE , ALLOW_ALL_ZONES , ACTIVATE_ALL_ZONES , ACTIVATE_ALL_ERRORS , MULTIZONE_TAGS , INIT_RUN , CHECK_RUN } |
Functions | |
| void | StartRecording () |
| Start the recording of the operations and involved variables. If called, the computational graph of all operations occuring after the call will be stored, starting with the variables registered with RegisterInput. | |
| bool | PauseRecording () |
| Pause the recording of the operations and involved variables. If called, all operations occuring after the call will not be stored on the computational graph. | |
| void | ResumeRecording (bool wasActive) |
| Resume the recording of the operations and variables after the recording had been paused. | |
| void | StopRecording () |
| Stops the recording of the operations and variables. | |
| bool | TapeActive () |
| Check if the tape is active. | |
| template<typename Comm > | |
| void | PrintStatistics (Comm communicator, bool printingRank) |
| Prints out tape statistics. | |
| void | RegisterInput (su2double &data) |
| Registers the variable as an input. I.e. as a leaf of the computational graph. | |
| void | RegisterOutput (su2double &data) |
| Registers the variable as an output. I.e. as the root of the computational graph. | |
| void | ResizeAdjoints () |
| Resize the adjoint vector, for subsequent access without bounds checking. | |
| void | BeginUseAdjoints () |
| Declare that the adjoints are being used, to protect against resizing. | |
| void | EndUseAdjoints () |
| Declare that the adjoints are no longer being used. | |
| void | SetDerivative (Identifier index, const double val) |
| Sets the adjoint value at index to val. | |
| double | GetDerivative (Identifier index) |
| Extracts the adjoint value at index. | |
| Identifier | GetPassiveIndex () |
| Returns the identifier that represents an inactive variable. | |
| void | ClearAdjoints () |
| Clears the currently stored adjoints but keeps the computational graph. | |
| void | ComputeAdjoint () |
| Computes the adjoints, i.e. the derivatives of the output with respect to the input variables. | |
| void | ComputeAdjoint (unsigned short enter, unsigned short leave) |
| Computes the adjoints, i.e. the derivatives of the output with respect to the input variables. | |
| void | ComputeAdjointForward () |
| Computes the adjoints, i.e., the derivatives of the output with respect to the input variables, using forward tape evaluation. | |
| void | Reset () |
| Reset the tape structure to be ready for a new recording. | |
| void | ResetInput (su2double &data) |
| Reset the variable (set index to zero). | |
| template<class... Ts> | |
| void | SetPreaccIn (Ts &&... data) |
| Sets the scalar inputs of a preaccumulation section. | |
| template<class T > | |
| void | SetPreaccIn (const T &data, const int size) |
| Sets the input variables of a preaccumulation section using a 1D array. | |
| template<class T > | |
| void | SetPreaccIn (const T &data, const int size_x, const int size_y) |
| Sets the input variables of a preaccumulation section using a 2D array. | |
| void | StartPreacc () |
| Starts a new preaccumulation section and sets the input variables. | |
| template<class... Ts> | |
| void | SetPreaccOut (Ts &&... data) |
| Sets the scalar outputs of a preaccumulation section. | |
| template<class T > | |
| void | SetPreaccOut (T &&data, const int size) |
| Sets the output variables of a preaccumulation section using a 1D array. | |
| template<class T > | |
| void | SetPreaccOut (T &&data, const int size_x, const int size_y) |
| Sets the input variables of a preaccumulation section using a 2D array. | |
| void | EndPreacc () |
| Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the variables set with SetLocalInput(), SetLocalOutput() and pushes a statement for each output variable to the AD tape. | |
| void | SetExtFuncIn (su2double &data) |
| Sets the scalar input of a externally differentiated function. | |
| template<class T > | |
| void | SetExtFuncIn (const T &data, const int size) |
| Sets the input variables of a externally differentiated function using a 1D array. | |
| template<class T > | |
| void | SetExtFuncIn (const T &data, const int size_x, const int size_y) |
| Sets the input variables of a externally differentiated function using a 2D array. | |
| void | SetExtFuncOut (su2double &data) |
| Sets the scalar output of a externally differentiated function. | |
| template<class T > | |
| void | SetExtFuncOut (T &&data, const int size) |
| Sets the output variables of a externally differentiated function using a 1D array. | |
| template<class T > | |
| void | SetExtFuncOut (T &&data, const int size_x, const int size_y) |
| Sets the output variables of a externally differentiated function using a 2D array. | |
| void | SetIndex (Identifier &index, const su2double &data) |
| Evaluates and saves gradient data from a variable. | |
| void | SetTag (int tag) |
| Sets the tag tape to a specific tag. | |
| int | GetTag () |
| Gets the current tag. | |
| int | ComputeTag (unsigned short iZone) |
| Compute the zone-specific tag. | |
| void | ClearTagOnVariable (su2double &v) |
| Sets the tag of a variable to 0. | |
| void | SetTagOnVariable (su2double &v, int zone_tag=0, int run_tag=0) |
| Sets the tag of a variable to a specified value. | |
| void | SetDebugControl (DebugControl *control) |
| Set a pointer to the current DebugControl. | |
| void | SetTapeDebugOption (TAPE_DEBUG_OPTION option, unsigned short izone=0) |
| Set options which kind of tag mismatches are considered errors and written to file. | |
| void | ActivateTagErrorCallback () |
| Activate the error callback by letting the tape call tagErrorCallback whenever a tag mismatch arises. | |
| void | SetDebugReportFile (DebugControl &control, std::ostream *output_file) |
| Set a pointer to the output file of a DebugControl. | |
| void | ResetErrorCounter (DebugControl &control) |
| Reset the error counter in a DebugControl. | |
| unsigned long | GetErrorCount (const DebugControl &control) |
| Get the error count of a DebugControl. | |
| void | Push_TapePosition () |
| Pushes back the current tape position to the tape position's vector. | |
| bool | BeginPassive () |
| Start a passive region, i.e. stop recording. | |
| void | EndPassive (bool wasActive) |
| End a passive region, i.e. start recording if we were recording before. | |
| bool | PausePreaccumulation () |
| Pause the use of preaccumulation. | |
| void | ResumePreaccumulation (bool wasActive) |
| Resume the use of preaccumulation. | |
| void | StartNoSharedReading () |
| Begin a hybrid parallel adjoint evaluation mode that assumes an inherently safe reverse path. | |
| void | EndNoSharedReading () |
| End the "no shared reading" adjoint evaluation mode. | |
| void | Initialize () |
| void | Finalize () |
Contains routines for the reverse mode of AD. In case there is no reverse type configured, they have no effect at all, and so the real versions of the routined are after #else.
| using AD::Identifier = typedef int |
|
strong |
|
inline |
Activate the error callback by letting the tape call tagErrorCallback whenever a tag mismatch arises.
|
inline |
Start a passive region, i.e. stop recording.
|
inline |
Declare that the adjoints are being used, to protect against resizing.
Should be used together with AD::EndUseAdjoints() to protect AD::SetDerivative() and AD::GetDerivative() calls, multiple at once if possible.
|
inline |
Clears the currently stored adjoints but keeps the computational graph.
|
inline |
Sets the tag of a variable to 0.
| [in] | v | - the variable whose tag is cleared. |
|
inline |
Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
|
inline |
Computes the adjoints, i.e. the derivatives of the output with respect to the input variables.
| [in] | enter | - Position where we start evaluating the tape. |
| [in] | leave | - Position where we stop evaluating the tape. |
|
inline |
Computes the adjoints, i.e., the derivatives of the output with respect to the input variables, using forward tape evaluation.
|
inline |
Compute the zone-specific tag.
| [in] | iZone | - Zone index from which the zone-specific tag is formed. |
|
inline |
End the "no shared reading" adjoint evaluation mode.
|
inline |
End a passive region, i.e. start recording if we were recording before.
| [in] | wasActive | - Whether we were recording before entering the passive region. |
|
inline |
Ends a preaccumulation section and computes the local Jacobi matrix of a code section using the variables set with SetLocalInput(), SetLocalOutput() and pushes a statement for each output variable to the AD tape.
|
inline |
Declare that the adjoints are no longer being used.
| void AD::Finalize | ( | ) |
|
inline |
Extracts the adjoint value at index.
| [in] | index | - position in the adjoint vector where the derivative will be extracted. |
|
inline |
Get the error count of a DebugControl.
| [in] | control | - the DebugControl whose error count is reported. |
|
inline |
Returns the identifier that represents an inactive variable.
|
inline |
Gets the current tag.
| [in] | tag | - the number to which the tag is set. |
| void AD::Initialize | ( | ) |
|
inline |
Pause the use of preaccumulation.
|
inline |
Pause the recording of the operations and involved variables. If called, all operations occuring after the call will not be stored on the computational graph.
|
inline |
Prints out tape statistics.
Tape statistics are aggregated across OpenMP threads and MPI processes, if applicable. With MPI, the given communicator is used to reduce data across MPI processes, and the printing behaviour can be set per rank (usually, only the master rank prints).
|
inline |
Pushes back the current tape position to the tape position's vector.
|
inline |
Registers the variable as an input. I.e. as a leaf of the computational graph.
| [in] | data | - The variable to be registered as input. |
|
inline |
Registers the variable as an output. I.e. as the root of the computational graph.
| [in] | data | - The variable to be registered as output. |
|
inline |
Reset the tape structure to be ready for a new recording.
|
inline |
Reset the error counter in a DebugControl.
| [in] | control | - the DebugControl whose error counter is resetted. |
|
inline |
Reset the variable (set index to zero).
| [in] | data | - the variable to be unregistered from the tape. |
|
inline |
Resize the adjoint vector, for subsequent access without bounds checking.
|
inline |
Resume the use of preaccumulation.
| [in] | wasActive | - Whether preaccumulation was active before pausing. |
|
inline |
Resume the recording of the operations and variables after the recording had been paused.
|
inline |
Set a pointer to the current DebugControl.
| [in] | control | - pointer to the current debug control. |
|
inline |
Set a pointer to the output file of a DebugControl.
| [in] | control | - the DebugControl whose output file is set. |
| [in] | output_file | - pointer to the output file. |
|
inline |
Sets the adjoint value at index to val.
| [in] | index | - Position in the adjoint vector. |
| [in] | val | - adjoint value to be set. |
|
inline |
Sets the input variables of a externally differentiated function using a 1D array.
| [in] | data | - the input 1D array. |
| [in] | size | - number of rows. |
|
inline |
Sets the input variables of a externally differentiated function using a 2D array.
| [in] | data | - the input 2D array. |
| [in] | size_x | - number of rows. |
| [in] | size_y | - number of columns. |
|
inline |
Sets the scalar input of a externally differentiated function.
| [in] | data | - the scalar input variable. |
|
inline |
Sets the scalar output of a externally differentiated function.
| [in] | data | - the scalar output variable. |
|
inline |
Sets the output variables of a externally differentiated function using a 1D array.
| [in] | data | - the output 1D array. |
| [in] | size | - number of rows. |
|
inline |
Sets the output variables of a externally differentiated function using a 2D array.
| [in] | data | - the output 2D array. |
| [in] | size_x | - number of rows. |
| [in] | size_y | - number of columns. |
|
inline |
Evaluates and saves gradient data from a variable.
| [in] | data | - variable whose gradient information will be extracted. |
| [in] | index | - where obtained gradient information will be stored. |
|
inline |
Sets the input variables of a preaccumulation section using a 1D array.
| [in] | data | - the input 1D array. |
| [in] | size | - size of the array. |
|
inline |
Sets the input variables of a preaccumulation section using a 2D array.
| [in] | data | - the input 2D array. |
| [in] | size_x | - size of the array in x dimension. |
| [in] | size_y | - size of the array in y dimension. |
|
inline |
Sets the scalar inputs of a preaccumulation section.
| [in] | data | - the scalar input variables. |
|
inline |
Sets the output variables of a preaccumulation section using a 1D array.
| [in] | data | - the output 1D array. |
|
inline |
Sets the input variables of a preaccumulation section using a 2D array.
| [in] | data | - the output 1D array. |
|
inline |
Sets the scalar outputs of a preaccumulation section.
| [in] | data | - the scalar output variables. |
|
inline |
Sets the tag tape to a specific tag.
| [in] | tag | - the number to which the tag is set. |
|
inline |
Sets the tag of a variable to a specified value.
| [in] | v | - the variable whose tag is set manually. |
|
inline |
Set options which kind of tag mismatches are considered errors and written to file.
| [in] | option | - specification which kind of tag mismatches are considered. |
| [in] | izone | - the zone w.r.t. which a tag mismatch is allowed. |
|
inline |
Begin a hybrid parallel adjoint evaluation mode that assumes an inherently safe reverse path.
|
inline |
Starts a new preaccumulation section and sets the input variables.
The idea of preaccumulation is to store only the Jacobi matrix of a code section during the taping process instead of all operations. This decreases the tape size and reduces runtime.
Input/Output of the section are set with several calls to SetPreaccIn()/SetPreaccOut().
Note: the call of this routine must be followed by a call of EndPreacc() and the end of the code section.
|
inline |
Start the recording of the operations and involved variables. If called, the computational graph of all operations occuring after the call will be stored, starting with the variables registered with RegisterInput.
|
inline |
Stops the recording of the operations and variables.
|
inline |
Check if the tape is active.
| [out] | Boolean | which determines whether the tape is active. |