#include <adolc/adolcerror.h>
#include <adolc/adolcexport.h>
#include <adolc/valuetape/valuetape.h>
#include <cassert>
#include <cstddef>
#include <vector>
Go to the source code of this file.
|
| ADOLC_API int | trace_on (short tapeId, int keepTaylors=0) |
| | Initializes taping for the given tapeId.
|
| |
| ADOLC_API int | trace_on (short tapeId, int keepTaylors, size_t obs, size_t lbs, size_t vbs, size_t tbs, int skipFileCleanup) |
| | Initializes taping with fine-grained buffer configuration.
|
| |
| ADOLC_API void | trace_off (int flag=0) |
| | Stops the current tracing session and handles the tape.
|
| |
| ADOLC_API void | cachedTraceTags (std::vector< short > &result) |
| | Writes the tapeIds of the tapes stored in the thread-local tapeBuffer in result
|
| |
| ADOLC_API void | nestedReverseEval (short tapeId, bool flag) |
| | Marks whether reverse evaluation of this tape is nested inside an outer tape evaluation.
|
| |
| ADOLC_API bool | nestedReverseEval (short tapeId) |
| | Returns whether reverse evaluation of this tape is treated as nested.
|
| |
| ADOLC_API std::array< size_t, TapeInfos::STAT_SIZE > | tapestats (short tapeId) |
| | Writes the tapestats of the tape into an array.
|
| |
| ADOLC_API void | printTapeStats (short tapeId) |
| | Prints the stats of the tape.
|
| |
| ADOLC_API size_t | get_num_param (short tapeId) |
| | Returns the number of parameters recorded on tape.
|
| |
| ADOLC_API size_t | get_num_switches (short tapeId) |
| | Returns the number of switching variables recorded on tape.
|
| |
◆ cachedTraceTags()
| ADOLC_API void cachedTraceTags |
( |
std::vector< short > & |
result | ) |
|
Writes the tapeIds of the tapes stored in the thread-local tapeBuffer in result
- Parameters
-
| result | vector to store the IDs |
- Note
- the vector is resized in this function to the size of the tapeBuffer
◆ get_num_param()
| ADOLC_API size_t get_num_param |
( |
short |
tapeId | ) |
|
|
inline |
Returns the number of parameters recorded on tape.
- Parameters
-
| tapeId | ID of the tape to read the number of parameters |
- Returns
- number of parameters
- Exceptions
-
◆ get_num_switches()
| ADOLC_API size_t get_num_switches |
( |
short |
tapeId | ) |
|
|
inline |
Returns the number of switching variables recorded on tape.
- Parameters
-
| tapeId | ID of the tape to read the number of switching variables |
- Returns
- number of switching variables
- Exceptions
-
◆ nestedReverseEval() [1/2]
| ADOLC_API bool nestedReverseEval |
( |
short |
tapeId | ) |
|
|
inline |
Returns whether reverse evaluation of this tape is treated as nested.
- Parameters
-
| tapeId | the ID of the tape to query |
- Returns
true if reverse sweeps accumulate into an outer tape, false otherwise
- Exceptions
-
◆ nestedReverseEval() [2/2]
| ADOLC_API void nestedReverseEval |
( |
short |
tapeId, |
|
|
bool |
flag |
|
) |
| |
|
inline |
Marks whether reverse evaluation of this tape is nested inside an outer tape evaluation.
When enabled, reverse sweeps accumulate adjoints into the outer tape's independent and dependent slots instead of overwriting them.
- Parameters
-
| tapeId | the ID of the tape to update |
| flag | true for nested reverse evaluation, false otherwise |
- Exceptions
-
◆ printTapeStats()
| ADOLC_API void printTapeStats |
( |
short |
tapeId | ) |
|
Prints the stats of the tape.
- Parameters
-
| tapeId | the ID of the tape to print the stats |
- Exceptions
-
◆ tapestats()
Writes the tapestats of the tape into an array.
- Parameters
-
| tapeId | the ID of the tape to read the tapestats |
- Returns
- array of size TapeInfos::STAT_SIZE that stores all tape's metadata
- Exceptions
-
◆ trace_off()
Stops the current tracing session and handles the tape.
Cleans up the tape, copies remaining live variables, and updates its status. Optionally writes tape files to disk depending on the value of flag.
- Parameters
-
| flag | If non-zero, forces the tape to write op/loc/val files. |
- Exceptions
-
- Note
- assert in debug mode if currentTape is nullptr
◆ trace_on() [1/2]
| ADOLC_API int trace_on |
( |
short |
tapeId, |
|
|
int |
keepTaylors, |
|
|
size_t |
obs, |
|
|
size_t |
lbs, |
|
|
size_t |
vbs, |
|
|
size_t |
tbs, |
|
|
int |
skipFileCleanup |
|
) |
| |
Initializes taping with fine-grained buffer configuration.
Prepares a ValueTape with custom buffer sizes for operations, locations, values, and Taylor coefficients. Also allows disabling cleanup of intermediate files.
- Parameters
-
| tapeId | ID of the tape to trace. |
| keepTaylors | Whether to store Taylor coefficients. |
| obs | Operation buffer size. |
| lbs | Location buffer size. |
| vbs | Value buffer size. |
| tbs | Taylor buffer size. |
| skipFileCleanup | Whether to skip cleaning up tape files after tracing. |
- Returns
- 1 on success, -1 on failure.
- Exceptions
-
◆ trace_on() [2/2]
| ADOLC_API int trace_on |
( |
short |
tapeId, |
|
|
int |
keepTaylors = 0 |
|
) |
| |
Initializes taping for the given tapeId.
Prepares a ValueTape for recording operations, storing the current tapeId for later restoration. Initializes the tape’s memory and metadata.
- Parameters
-
| tapeId | ID of the tape to activate for tracing. |
| keepTaylors | Flag indicating whether to keep Taylor coefficients (non-zero to keep). |
- Returns
- 1 on success, 0 on failure.
- Exceptions
-