Template Numerical Library version\ main:63efd81
Loading...
Searching...
No Matches
TNL::Atomic< T, Devices::Cuda > Class Template Reference

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__exchange (T desired) noexcept
 Atomically exchanges the stored value with desired.
__cuda_callable__fetch_add (T arg)
 Atomically adds arg to the stored value and returns the old value.
__cuda_callable__fetch_and (T arg)
 Atomically performs bitwise AND with arg and returns the old value.
__cuda_callable__fetch_max (T arg) noexcept
 Atomically updates the stored value to the maximum of the current value and arg.
__cuda_callable__fetch_min (T arg) noexcept
 Atomically updates the stored value to the minimum of the current value and arg.
__cuda_callable__fetch_or (T arg)
 Atomically performs bitwise OR with arg and returns the old value.
__cuda_callable__fetch_sub (T arg)
 Atomically subtracts arg from the stored value and returns the old value.
__cuda_callable__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__load () const noexcept
 Atomically loads the stored value.
__cuda_callable__ operator T () const noexcept
 Conversion operator returning the stored value.
__cuda_callable__operator&= (T arg) noexcept
 Atomically performs bitwise AND with arg and returns the new value.
__cuda_callable__operator++ () noexcept
 Pre-increment operator.
__cuda_callable__operator++ (int) noexcept
 Post-increment operator.
__cuda_callable__operator+= (T arg) noexcept
 Atomically adds arg to the stored value and returns the new value.
__cuda_callable__operator-- () noexcept
 Pre-decrement operator.
__cuda_callable__operator-- (int) noexcept
 Post-decrement operator.
__cuda_callable__operator-= (T arg) noexcept
 Atomically subtracts arg from the stored value and returns the new value.
__cuda_callable__ Atomicoperator= (const Atomic &desired) noexcept
 Copy assignment operator.
__cuda_callable__operator= (T desired) noexcept
 Assigns desired to the atomic value.
__cuda_callable__operator^= (T arg) noexcept
 Atomically performs bitwise XOR with arg and returns the new value.
__cuda_callable__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

value
 The stored atomic value.

Detailed Description

template<typename T>
class TNL::Atomic< T, Devices::Cuda >

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.


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