|
vecmem 1.22.0
|
Custom implementation for atomic operations in CUDA device code. More...
#include <vecmem/memory/details/cuda_device_atomic_ref.hpp>
Public Types | |
Type definitions | |
| typedef T | value_type |
| Type managed by the object. | |
| typedef value_type | difference_type |
| Difference between two objects. | |
| typedef value_type * | pointer |
| Pointer to the value in global memory. | |
| typedef value_type & | reference |
| Reference to a value given by the user. | |
Public Member Functions | |
| VECMEM_HOST_AND_DEVICE | device_atomic_ref (reference ref) |
| Constructor, with a pointer to the managed variable. | |
| VECMEM_HOST_AND_DEVICE | device_atomic_ref (const device_atomic_ref &parent) |
| Copy constructor. | |
| device_atomic_ref & | operator= (const device_atomic_ref &)=delete |
| Disable the assignment operator. | |
Value setter/getter functions | |
| VECMEM_HOST_AND_DEVICE value_type | operator= (value_type data) const |
| Assigns a value desired to the referenced object. | |
| VECMEM_HOST_AND_DEVICE void | store (value_type data, memory_order order=memory_order::seq_cst) const |
| Set the variable to the desired value. | |
| VECMEM_HOST_AND_DEVICE value_type | load (memory_order order=memory_order::seq_cst) const |
| Get the value of the variable. | |
| VECMEM_HOST_AND_DEVICE value_type | exchange (value_type data, memory_order order=memory_order::seq_cst) const |
| Exchange the current value of the variable with a different one. | |
| VECMEM_HOST_AND_DEVICE bool | compare_exchange_strong (reference expected, value_type desired, memory_order success, memory_order failure) const |
| Compare against the current value, and exchange only if different. | |
| VECMEM_HOST_AND_DEVICE bool | compare_exchange_strong (reference expected, value_type desired, memory_order order=memory_order::seq_cst) const |
| Compare against the current value, and exchange only if different. | |
Value modifier functions | |
| VECMEM_HOST_AND_DEVICE value_type | fetch_add (value_type data, memory_order order=memory_order::seq_cst) const |
| Add a chosen value to the stored variable. | |
| VECMEM_HOST_AND_DEVICE value_type | fetch_sub (value_type data, memory_order order=memory_order::seq_cst) const |
| Substitute a chosen value from the stored variable. | |
| VECMEM_HOST_AND_DEVICE value_type | fetch_and (value_type data, memory_order order=memory_order::seq_cst) const |
| Replace the current value with the specified value AND-ed to it. | |
| VECMEM_HOST_AND_DEVICE value_type | fetch_or (value_type data, memory_order order=memory_order::seq_cst) const |
| Replace the current value with the specified value OR-d to it. | |
| VECMEM_HOST_AND_DEVICE value_type | fetch_xor (value_type data, memory_order order=memory_order::seq_cst) const |
| Replace the current value with the specified value XOR-d to it. | |
Custom implementation for atomic operations in CUDA device code.
VECMEM_HOST_DEVICE, because this class may be used from functions that also carry that setup. (Like functions in vecmem::device_vector.) Even though this class cannot be used in host code, CUDA and HIP are sensitive to these sort of declarations being consistent.| T | Type to perform atomic operations on |
| address | The device address space to use |
| VECMEM_HOST_AND_DEVICE auto vecmem::cuda::device_atomic_ref< T, address >::operator= | ( | value_type | data | ) | const |
Assigns a value desired to the referenced object.