|
Template Numerical Library version\ main:63efd81
|
Atomic wrapper for the CUDA/HIP device. More...
#include <TNL/Atomic.h>
Public Types | |
| using | value_type = T |
| Type of the atomic value. | |
Public Member Functions | |
| __cuda_callable__ | Atomic () noexcept=default |
| Default constructor. | |
| __cuda_callable__ | Atomic (const Atomic &desired) noexcept |
| Copy constructor. | |
| __cuda_callable__ constexpr | Atomic (T desired) noexcept |
| Constructor initializing the atomic value to desired. | |
| __cuda_callable__ bool | compare_exchange_strong (T &expected, T desired) noexcept |
| Strong compare-and-exchange operation. | |
| __cuda_callable__ bool | compare_exchange_weak (T &expected, T desired) noexcept |
| Weak compare-and-exchange operation. | |
| __cuda_callable__ T | exchange (T desired) noexcept |
| Atomically exchanges the stored value with desired. | |
| __cuda_callable__ T | fetch_add (T arg) |
| Atomically adds arg to the stored value and returns the old value. | |
| __cuda_callable__ T | fetch_and (T arg) |
| Atomically performs bitwise AND with arg and returns the old value. | |
| __cuda_callable__ T | fetch_max (T arg) noexcept |
| Atomically updates the stored value to the maximum of the current value and arg. | |
| __cuda_callable__ T | fetch_min (T arg) noexcept |
| Atomically updates the stored value to the minimum of the current value and arg. | |
| __cuda_callable__ T | fetch_or (T arg) |
| Atomically performs bitwise OR with arg and returns the old value. | |
| __cuda_callable__ T | fetch_sub (T arg) |
| Atomically subtracts arg from the stored value and returns the old value. | |
| __cuda_callable__ T | fetch_xor (T arg) |
| Atomically performs bitwise XOR with arg and returns the old value. | |
| constexpr bool | is_always_lock_free () const noexcept |
| Returns true if the atomic operations are always lock-free. | |
| bool | is_lock_free () const noexcept |
| Returns true if the atomic operations are lock-free. | |
| __cuda_callable__ T | load () const noexcept |
| Atomically loads the stored value. | |
| __cuda_callable__ | operator T () const noexcept |
| Conversion operator returning the stored value. | |
| __cuda_callable__ T | operator&= (T arg) noexcept |
| Atomically performs bitwise AND with arg and returns the new value. | |
| __cuda_callable__ T | operator++ () noexcept |
| Pre-increment operator. | |
| __cuda_callable__ T | operator++ (int) noexcept |
| Post-increment operator. | |
| __cuda_callable__ T | operator+= (T arg) noexcept |
| Atomically adds arg to the stored value and returns the new value. | |
| __cuda_callable__ T | operator-- () noexcept |
| Pre-decrement operator. | |
| __cuda_callable__ T | operator-- (int) noexcept |
| Post-decrement operator. | |
| __cuda_callable__ T | operator-= (T arg) noexcept |
| Atomically subtracts arg from the stored value and returns the new value. | |
| __cuda_callable__ Atomic & | operator= (const Atomic &desired) noexcept |
| Copy assignment operator. | |
| __cuda_callable__ T | operator= (T desired) noexcept |
| Assigns desired to the atomic value. | |
| __cuda_callable__ T | operator^= (T arg) noexcept |
| Atomically performs bitwise XOR with arg and returns the new value. | |
| __cuda_callable__ T | operator|= (T arg) noexcept |
| Atomically performs bitwise OR with arg and returns the new value. | |
| __cuda_callable__ void | store (T desired) noexcept |
| Atomically replaces the stored value with desired. | |
Protected Attributes | |
| T | value |
| The stored atomic value. | |
Atomic wrapper for the CUDA/HIP device.
Implements the same interface as std::atomic<T> using CUDA/HIP built-in atomic operations. The copy operations are not atomic.