|
RAJA
RAJA provides a collection of platform portability abstractions for C++ HPC applications.
|
RAJA header file defining atomic operations. More...
#include "RAJA/config.hpp"#include "RAJA/policy/atomic_auto.hpp"#include "RAJA/policy/atomic_builtin.hpp"#include "RAJA/util/macros.hpp"Go to the source code of this file.
Classes | |
| class | RAJA::AtomicRef< T, Policy > |
| Atomic wrapper object. More... | |
Namespaces | |
| RAJA | |
Functions | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicLoad (T *acc) |
| Atomic load. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE void | RAJA::atomicStore (T *acc, T value) |
| Atomic store. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicAdd (T *acc, T value) |
| Atomic add. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicSub (T *acc, T value) |
| Atomic subtract. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicMin (T *acc, T value) |
| Atomic minimum equivalent to (*acc) = std::min(*acc, value) More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicMax (T *acc, T value) |
| Atomic maximum equivalent to (*acc) = std::max(*acc, value) More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicInc (T *acc) |
| Atomic increment. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicInc (T *acc, T compare) |
| Atomic increment with bound Equivalent to *acc = ((*acc >= compare) ? 0 : ((*acc)+1)) This is for compatability with the CUDA atomicInc. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicDec (T *acc) |
| Atomic decrement. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicDec (T *acc, T compare) |
| Atomic decrement with bound Equivalent to *acc = (((*acc==0)|(*acc>compare))?compare:((*acc)-1)) This is for compatability with the CUDA atomicDec. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicAnd (T *acc, T value) |
| Atomic bitwise AND equivalent to (*acc) = (*acc) & value This only works with integral data types. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicOr (T *acc, T value) |
| Atomic bitwise OR equivalent to (*acc) = (*acc) | value This only works with integral data types. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicXor (T *acc, T value) |
| Atomic bitwise XOR equivalent to (*acc) = (*acc) ^ value This only works with integral data types. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicExchange (T *acc, T value) |
| Atomic value exchange. More... | |
| template<typename Policy , typename T > | |
| RAJA_SUPPRESS_HD_WARN RAJA_INLINE RAJA_HOST_DEVICE T | RAJA::atomicCAS (T *acc, T compare, T value) |
| Atomic compare and swap. More... | |
RAJA header file defining atomic operations.
Atomic operation functions in the namespace RAJA::atomic
The dispatch of all of these is:
T atomicAdd<Policy>(T *acc, T value) – User facing API
calls
T atomicAdd(Policy{}, T *acc, T value) – Policy specific implementation
With the exception of the auto_atomic policy which then calls the "appropriate" policy implementation.
Current supported policies include:
auto_atomic – Attempts to do "the right thing"
cuda_atomic – Only atomic supported in CUDA device functions
omp_atomic – Available (and default) when OpenMP is enabled these are safe inside and outside of OMP parallel regions
builtin_atomic – Use the (nonstandard) __sync_fetch_and_XXX functions
seq_atomic – Non-atomic, does an unprotected (raw) operation
Current supported data types include:
32-bit and 64-bit integral types: -Native atomic support for "unsigned", "long", "unsigned long long" and "long long"
-General support, via CAS algorithm, for any 32-bit or 64-bit datatype
32-bit and 64-bit floating point types: float and double
The implementation code lives in: RAJA/policy/atomic_auto.hpp – for auto_atomic RAJA/policy/atomic_builtin.hpp – for builtin_atomic RAJA/policy/XXX/atomic.hpp – for omp_atomic, cuda_atomic, etc.