Provides a data type on which += update operations are performed atomically. More...
#include <reverseAtomicInterface.hpp>
Public Types | |
using | Impl = T_Impl |
See ReverseAtomicInterface. | |
using | Type = T_Type |
See ReverseAtomicInterface. | |
Public Member Functions | |
operator Type () const | |
Implicit cast to underlying type for rhs access. Not atomic. | |
void | operator+= (Impl const &other) |
Atomic incremental update with implementing type as rhs. | |
void | operator+= (Type const &other) |
Atomic incremental update with underlying type as rhs. | |
Impl & | operator= (Impl const &other) |
Assignment operator with implementing type as rhs. Not atomic. | |
Impl & | operator= (Type const &other) |
Assignment operator with underlying type as rhs. Not atomic. | |
ReverseAtomicInterface () | |
Constructor. | |
ReverseAtomicInterface (ReverseAtomicInterface const &) | |
Constructor. | |
ReverseAtomicInterface (Type const &) | |
Constructor. | |
~ReverseAtomicInterface () | |
Destructor. | |
Provides a data type on which += update operations are performed atomically.
In a multithreaded environment, data races on adjoint variables are fixed by performing updates atomically, whereas other read and write operations do not need to be atomic. This template takes an ordinary adjoint variable type, like a floating point type or a CoDiPack forward type, and ensures that the corresponding += update operation is performed atomically.
Implementations likely require template specializations with respect to the underlying type, especially if it is an active CoDiPack type.
An implementation should preserve the memory footprint of the underlying type, e.g., by inheriting from the under- lying type or by having a variable of the underlying type as the only member variable.
T_Type | The underlying data type. |
T_Impl | Implementing class. |