Go to the documentation of this file.
10 #ifndef vtk_m_exec_AtomicArrayExecutionObject_h
11 #define vtk_m_exec_AtomicArrayExecutionObject_h
18 #include <type_traits>
43 struct MakeUnsigned<
vtkm::UInt64>
45 using type = vtkm::UInt64;
48 struct MakeUnsigned<
vtkm::Int64>
50 using type = vtkm::UInt64;
60 using type = vtkm::UInt64;
66 using type =
typename MakeUnsigned<T>::type;
85 template <
typename PortalType,
86 typename PointerType = decltype(std::declval<PortalType>().GetIteratorBegin())>
102 using PortalType = decltype(handle.PrepareForInPlace(device, token));
104 "Source portal must return a pointer from "
105 "GetIteratorBegin().");
124 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
146 using APIType =
typename detail::ArithType<ValueType>::type;
148 return static_cast<T
>(
149 vtkm::AtomicAdd(
reinterpret_cast<APIType*
>(this->
Data + index),
static_cast<APIType
>(value)));
173 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
230 using APIType =
typename detail::MakeUnsigned<ValueType>::type;
233 reinterpret_cast<APIType*
>(oldValue),
234 static_cast<APIType
>(newValue));
244 #endif //vtk_m_exec_AtomicArrayExecutionObject_h
VTKM_EXEC_CONT T AtomicAdd(T *pointer, T operand, vtkm::MemoryOrder order=vtkm::MemoryOrder::SequentiallyConsistent)
Atomic function to add a value to a shared memory location.
Definition: Atomic.h:824
Manages an array-worth of data.
Definition: ArrayHandle.h:283
#define VTKM_EXEC
Definition: ExportMacros.h:51
Groups connected points that have the same field value.
Definition: Atomic.h:19
VTKM_EXEC_CONT void AtomicStore(T *pointer, T value, vtkm::MemoryOrder order=vtkm::MemoryOrder::Release)
Atomic function to save a value to a shared memory location.
Definition: Atomic.h:795
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC bool CompareExchange(vtkm::Id index, ValueType *oldValue, const ValueType &newValue) const
Perform an atomic compare and exchange operation with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:223
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC vtkm::Id GetNumberOfValues() const
Definition: AtomicArrayExecutionObject.h:110
vtkm::Id NumberOfValues
Definition: AtomicArrayExecutionObject.h:239
ValueType * Data
Definition: AtomicArrayExecutionObject.h:238
VTKM_CONT WritePortalType PrepareForInPlace(vtkm::cont::DeviceAdapterId device, vtkm::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:593
VTKM_EXEC_CONT T AtomicLoad(T *const pointer, vtkm::MemoryOrder order=vtkm::MemoryOrder::Acquire)
Atomic function to load a value from a shared memory location.
Definition: Atomic.h:781
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
VTKM_EXEC_CONT bool AtomicCompareExchange(T *shared, T *expected, T desired, vtkm::MemoryOrder order=vtkm::MemoryOrder::SequentiallyConsistent)
Atomic function that replaces a value given a condition.
Definition: Atomic.h:971
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
#define VTKM_STATIC_ASSERT_MSG(condition, message)
Definition: StaticAssert.h:18
#define VTKM_CONT
Definition: ExportMacros.h:57
T ValueType
Definition: AtomicArrayExecutionObject.h:92
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC ValueType Get(vtkm::Id index) const
Perform an atomic load of the indexed element with acquire memory ordering.
Definition: AtomicArrayExecutionObject.h:119
AtomicArrayExecutionObject()=default
Definition: DeviceAdapterTag.h:52
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC ValueType Add(vtkm::Id index, const ValueType &value) const
Peform an atomic addition with sequentially consistent memory ordering.
Definition: AtomicArrayExecutionObject.h:138
uint32_t UInt32
Definition: Types.h:161
Definition: AtomicArrayExecutionObject.h:87
float Float32
Definition: Types.h:154
int32_t Int32
Definition: Types.h:160
double Float64
Definition: Types.h:155
VTKM_CONT AtomicArrayExecutionObject(vtkm::cont::ArrayHandle< T > handle, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token)
Definition: AtomicArrayExecutionObject.h:96
Definition: AtomicArrayExecutionObject.h:81
#define VTKM_SUPPRESS_EXEC_WARNINGS
Definition: ExportMacros.h:53
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_EXEC void Set(vtkm::Id index, const ValueType &value) const
Peform an atomic store to memory while enforcing, at minimum, "release" memory ordering.
Definition: AtomicArrayExecutionObject.h:165