Go to the documentation of this file.
18 #ifndef viskores_exec_AtomicArrayExecutionObject_h
19 #define viskores_exec_AtomicArrayExecutionObject_h
26 #include <type_traits>
74 using type =
typename MakeUnsigned<T>::type;
100 template <
typename PortalType,
101 typename PointerType = decltype(std::declval<PortalType>().GetIteratorBegin())>
117 using PortalType = decltype(handle.PrepareForInPlace(device, token));
119 "Source portal must return a pointer from "
120 "GetIteratorBegin().");
142 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
144 return static_cast<T
>(
168 using APIType =
typename detail::ArithType<ValueType>::type;
171 reinterpret_cast<APIType*
>(this->
Data + index),
static_cast<APIType
>(value), order));
198 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
201 reinterpret_cast<APIType*
>(this->
Data + index),
static_cast<APIType
>(value), order);
261 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
264 reinterpret_cast<APIType*
>(oldValue),
265 static_cast<APIType
>(newValue),
276 #endif //viskores_exec_AtomicArrayExecutionObject_h
bool CompareExchange(viskores::Id index, ValueType *oldValue, const ValueType &newValue, viskores::MemoryOrder order=viskores::MemoryOrder::SequentiallyConsistent) const
Perform an atomic compare and exchange operation with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:250
ValueType * Data
Definition: AtomicArrayExecutionObject.h:270
AtomicArrayExecutionObject()=default
@ SequentiallyConsistent
An atomic with SequentiallyConsistent memory order will enforce any appropriate semantics as Acquire,...
T ValueType
Definition: AtomicArrayExecutionObject.h:107
#define VISKORES_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:61
Manages an array-worth of data.
Definition: ArrayHandle.h:313
void AtomicStore(T *pointer, T value, viskores::MemoryOrder order=viskores::MemoryOrder::Release)
Atomic function to save a value to a shared memory location.
Definition: Atomic.h:827
signed long long Int64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:212
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
#define VISKORES_CONT
Definition: ExportMacros.h:65
Groups connected points that have the same field value.
Definition: Atomic.h:27
WritePortalType PrepareForInPlace(viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
Prepares this array to be used in an in-place operation (both as input and output) in the execution e...
Definition: ArrayHandle.h:634
float Float32
Base type to use for 32-bit floating-point numbers.
Definition: Types.h:165
bool AtomicCompareExchange(T *shared, T *expected, T desired, viskores::MemoryOrder order=viskores::MemoryOrder::SequentiallyConsistent)
Atomic function that replaces a value given a condition.
Definition: Atomic.h:1004
@ Acquire
A load operation with Acquire memory order will enforce that any local read or write operations liste...
MemoryOrder
Specifies memory order semantics for atomic operations.
Definition: Atomic.h:64
viskores::Id NumberOfValues
Definition: AtomicArrayExecutionObject.h:271
ValueType Add(viskores::Id index, const ValueType &value, viskores::MemoryOrder order=viskores::MemoryOrder::SequentiallyConsistent) const
Peform an atomic addition with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:158
#define VISKORES_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:26
unsigned long long UInt64
Base type to use for 64-bit signed integer numbers.
Definition: Types.h:215
An object used to specify a device.
Definition: DeviceAdapterTag.h:66
int32_t Int32
Base type to use for 32-bit signed integer numbers.
Definition: Types.h:189
AtomicArrayExecutionObject(viskores::cont::ArrayHandle< T > handle, viskores::cont::DeviceAdapterId device, viskores::cont::Token &token)
Definition: AtomicArrayExecutionObject.h:111
viskores::Id GetNumberOfValues() const
Retrieve the number of values in the atomic array.
Definition: AtomicArrayExecutionObject.h:126
An object passed to a worklet when accessing an atomic array.
Definition: AtomicArrayExecutionObject.h:96
ValueType Get(viskores::Id index, viskores::MemoryOrder order=viskores::MemoryOrder::Acquire) const
Perform an atomic load of the indexed element with acquire memory ordering.
Definition: AtomicArrayExecutionObject.h:136
T AtomicLoad(T *const pointer, viskores::MemoryOrder order=viskores::MemoryOrder::Acquire)
Atomic function to load a value from a shared memory location.
Definition: Atomic.h:812
T AtomicAdd(T *pointer, T operand, viskores::MemoryOrder order=viskores::MemoryOrder::SequentiallyConsistent)
Atomic function to add a value to a shared memory location.
Definition: Atomic.h:855
void Set(viskores::Id index, const ValueType &value, viskores::MemoryOrder order=viskores::MemoryOrder::Release) const
Peform an atomic store to memory while enforcing, at minimum, "release" memory ordering.
Definition: AtomicArrayExecutionObject.h:188
Definition: AtomicArrayExecutionObject.h:102
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
uint32_t UInt32
Base type to use for 32-bit unsigned integer numbers.
Definition: Types.h:193
#define VISKORES_EXEC
Definition: ExportMacros.h:59
@ Release
A store operation with Release memory order will enforce that any local read or write operations list...