Go to the documentation of this file.
10 #ifndef vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
11 #define vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
18 #include <vtkm/cont/vtkm_cont_export.h>
25 #include <vtkmstd/void_t.h>
27 VTKM_THIRDPARTY_PRE_INCLUDE
28 #include <Kokkos_Core.hpp>
29 #include <Kokkos_DualView.hpp>
30 #include <Kokkos_Sort.hpp>
31 VTKM_THIRDPARTY_POST_INCLUDE
33 #include <type_traits>
35 #if KOKKOS_VERSION_MAJOR > 3 || (KOKKOS_VERSION_MAJOR == 3 && KOKKOS_VERSION_MINOR >= 7)
38 #define VTKM_VOLATILE volatile
47 template <
typename,
typename =
void>
48 struct is_type_complete :
public std::false_type
53 struct is_type_complete<T, vtkmstd::void_t<decltype(sizeof(T))>> :
public std::true_type
67 template <
typename BitsPortal>
73 explicit BitFieldToBoolField(
const BitsPortal& bp)
78 VTKM_EXEC bool operator()(
vtkm::Id bitIdx)
const {
return this->Bits.GetBit(bitIdx); }
84 template <
typename BitsPortal>
90 explicit BitFieldCountSetBitsWord(
const BitsPortal& bp)
97 auto word = this->Bits.GetWord(wordIdx);
98 if (wordIdx == (this->Bits.GetNumberOfWords() - 1))
100 word &= this->Bits.GetFinalWordMask();
111 template <
typename Operator,
typename ResultType>
112 struct ReductionIdentity;
114 template <
typename ResultType>
115 struct ReductionIdentity<
vtkm::
Sum, ResultType>
117 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::sum();
120 template <
typename ResultType>
121 struct ReductionIdentity<
vtkm::
Add, ResultType>
123 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::sum();
126 template <
typename ResultType>
127 struct ReductionIdentity<
vtkm::
Product, ResultType>
129 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::prod();
132 template <
typename ResultType>
135 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::prod();
138 template <
typename ResultType>
139 struct ReductionIdentity<
vtkm::
Minimum, ResultType>
141 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::min();
144 template <
typename ResultType>
145 struct ReductionIdentity<
vtkm::
Maximum, ResultType>
147 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::max();
150 template <
typename ResultType>
155 Kokkos::reduction_identity<ResultType>::max());
158 template <
typename ResultType>
161 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::band();
164 template <
typename ResultType>
167 static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::bor();
175 : vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
176 DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagKokkos>,
177 vtkm::cont::DeviceAdapterTagKokkos>
180 using Superclass = vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
182 vtkm::cont::DeviceAdapterTagKokkos>;
184 VTKM_CONT_EXPORT
static vtkm::exec::internal::ErrorMessageBuffer GetErrorMessageBufferInstance();
185 VTKM_CONT_EXPORT
static void CheckForErrors();
188 template <
typename IndicesStorage>
194 auto bitsPortal = bits.
PrepareForInput(DeviceAdapterTagKokkos{}, token);
195 auto bits2bools = kokkos::internal::BitFieldToBoolField<decltype(bitsPortal)>(bitsPortal);
208 auto bitsPortal = bits.
PrepareForInput(DeviceAdapterTagKokkos{}, token);
210 kokkos::internal::BitFieldCountSetBitsWord<decltype(bitsPortal)>(bitsPortal);
218 using Superclass::Copy;
220 template <
typename T>
228 auto portalIn = input.
PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
229 auto portalOut = output.
PrepareForOutput(inSize, vtkm::cont::DeviceAdapterTagKokkos{}, token);
232 kokkos::internal::KokkosViewConstExec<T> viewIn(portalIn.GetArray(), inSize);
233 kokkos::internal::KokkosViewExec<T> viewOut(portalOut.GetArray(), inSize);
234 Kokkos::deep_copy(vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), viewOut, viewIn);
239 template <
typename ArrayHandle,
typename BinaryOperator,
typename ResultType>
241 BinaryOperator binaryOperator,
242 ResultType initialValue,
245 return Superclass::Reduce(input, initialValue, binaryOperator);
248 template <
typename BinaryOperator,
typename FunctorOperator,
typename ResultType>
249 class KokkosReduceFunctor
255 KOKKOS_INLINE_FUNCTION
258 template <
typename... Args>
261 , Functor(std::forward<Args>(args)...)
265 KOKKOS_INLINE_FUNCTION
268 dst = this->Operator(dst, src);
271 KOKKOS_INLINE_FUNCTION
274 dst = kokkos::internal::ReductionIdentity<BinaryOperator, value_type>::value;
278 KOKKOS_INLINE_FUNCTION
281 this->Functor(this->Operator, i, update);
285 KOKKOS_INLINE_FUNCTION
288 this->Functor(this->Operator, i, update,
final);
296 template <
typename ArrayPortal,
typename BinaryOperator,
typename ResultType>
300 KOKKOS_INLINE_FUNCTION
303 KOKKOS_INLINE_FUNCTION
309 KOKKOS_INLINE_FUNCTION
312 update = op(update, this->Portal.Get(i));
319 template <
typename BinaryOperator,
typename ArrayPortal,
typename ResultType>
321 ReduceOperator<ArrayPortal, BinaryOperator, ResultType>,
324 template <
typename ArrayHandle,
typename BinaryOperator,
typename ResultType>
326 BinaryOperator binaryOperator,
327 ResultType initialValue,
331 auto inputPortal = input.
PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
333 ReduceFunctor<BinaryOperator, decltype(inputPortal), ResultType> functor(binaryOperator,
338 Kokkos::RangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace, vtkm::Id> policy(
339 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, input.
GetNumberOfValues());
340 Kokkos::parallel_reduce(policy, functor, result);
342 return binaryOperator(initialValue, result);
345 template <
bool P1,
typename BinaryOperator,
typename ResultType>
346 struct UseKokkosReduceP1 : std::false_type
350 template <
typename BinaryOperator,
typename ResultType>
351 struct UseKokkosReduceP1<true, BinaryOperator, ResultType>
352 : vtkm::internal::is_type_complete<
353 kokkos::internal::ReductionIdentity<BinaryOperator, ResultType>>
357 template <
typename BinaryOperator,
typename ResultType>
358 struct UseKokkosReduce
360 vtkm::internal::is_type_complete<Kokkos::reduction_identity<ResultType>>::value,
367 template <
typename T,
typename U,
class CIn,
class BinaryOperator>
370 BinaryOperator binaryOperator)
380 return binaryOperator(initialValue, input.
ReadPortal().Get(0));
383 #if defined(VTKM_KOKKOS_CUDA)
387 std::integral_constant<
389 !std::is_same<vtkm::cont::kokkos::internal::ExecutionSpace, Kokkos::Cuda>::value &&
390 UseKokkosReduce<BinaryOperator, U>::value>
393 typename UseKokkosReduce<BinaryOperator, U>::type use_kokkos_reduce;
395 return ReduceImpl(input, binaryOperator, initialValue, use_kokkos_reduce);
398 template <
typename T,
typename U,
class CIn>
409 template <
typename BinaryOperator,
typename ResultType>
412 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
415 BinaryOperator binaryOperator,
416 const T& initialValue,
419 return Superclass::ScanExclusive(input, output, binaryOperator, initialValue);
422 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
423 class ScanExclusiveOperator
430 KOKKOS_INLINE_FUNCTION
433 KOKKOS_INLINE_FUNCTION
436 const T& initialValue)
438 , PortalOut(portalOut)
439 , InitialValue(initialValue)
443 KOKKOS_INLINE_FUNCTION
446 auto val = this->PortalIn.Get(i);
449 update = InitialValue;
453 this->PortalOut.Set(i, update);
455 update = op(update, val);
464 template <
typename BinaryOperator,
typename T,
typename StorageIn,
typename StorageOut>
466 KokkosReduceFunctor<BinaryOperator,
467 ScanExclusiveOperator<T, StorageIn, StorageOut, BinaryOperator>,
470 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
473 BinaryOperator binaryOperator,
474 const T& initialValue,
480 auto inputPortal = input.
PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
482 output.
PrepareForOutput(length, vtkm::cont::DeviceAdapterTagKokkos{}, token);
485 binaryOperator, inputPortal, outputPortal, initialValue);
488 Kokkos::RangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace, vtkm::Id> policy(
489 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, length);
490 Kokkos::parallel_scan(policy, functor, result);
496 template <
typename T,
class CIn,
class COut,
class BinaryOperator>
499 BinaryOperator binaryOperator,
500 const T& initialValue)
513 Fill(output, initialValue, 1);
514 return binaryOperator(initialValue, v0);
517 #if defined(VTKM_KOKKOS_CUDA)
519 std::integral_constant<bool,
520 !(std::is_integral<T>::value &&
sizeof(T) < 4) &&
526 return ScanExclusiveImpl(input, output, binaryOperator, initialValue, use_kokkos_scan);
529 template <
typename T,
class CIn,
class COut>
540 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
543 BinaryOperator binaryOperator,
546 return Superclass::ScanInclusive(input, output, binaryOperator);
549 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
550 class ScanInclusiveOperator
557 KOKKOS_INLINE_FUNCTION
560 KOKKOS_INLINE_FUNCTION
563 , PortalOut(portalOut)
567 KOKKOS_INLINE_FUNCTION
570 update = op(update, this->PortalIn.Get(i));
573 this->PortalOut.Set(i, update);
582 template <
typename BinaryOperator,
typename T,
typename StorageIn,
typename StorageOut>
584 KokkosReduceFunctor<BinaryOperator,
585 ScanInclusiveOperator<T, StorageIn, StorageOut, BinaryOperator>,
588 template <
typename T,
typename StorageIn,
typename StorageOut,
typename BinaryOperator>
591 BinaryOperator binaryOperator,
597 auto inputPortal = input.
PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
599 output.
PrepareForOutput(length, vtkm::cont::DeviceAdapterTagKokkos{}, token);
602 binaryOperator, inputPortal, outputPortal);
605 Kokkos::RangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace, vtkm::Id> policy(
606 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, length);
607 Kokkos::parallel_scan(policy, functor, result);
613 template <
typename T,
class CIn,
class COut,
class BinaryOperator>
616 BinaryOperator binaryOperator)
628 Fill(output, result, 1);
632 #if defined(VTKM_KOKKOS_CUDA)
634 std::integral_constant<bool,
635 !(std::is_integral<T>::value &&
sizeof(T) < 4) &&
641 return ScanInclusiveImpl(input, output, binaryOperator, use_kokkos_scan);
644 template <
typename T,
class CIn,
class COut>
654 template <
typename WType,
typename IType>
656 vtkm::exec::kokkos::internal::TaskBasic1D<WType, IType>& functor,
661 if (numInstances < 1)
667 functor.SetErrorMessageBuffer(GetErrorMessageBufferInstance());
669 Kokkos::RangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace, vtkm::Id> policy(
670 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(), 0, numInstances);
671 Kokkos::parallel_for(policy, functor);
675 template <
typename WType,
typename IType>
677 vtkm::exec::kokkos::internal::TaskBasic3D<WType, IType>& functor,
682 if ((rangeMax[0] < 1) || (rangeMax[1] < 1) || (rangeMax[2] < 1))
688 functor.SetErrorMessageBuffer(GetErrorMessageBufferInstance());
690 Kokkos::MDRangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace,
692 Kokkos::IndexType<vtkm::Id>>
693 policy(vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(),
695 { rangeMax[0], rangeMax[1], rangeMax[2] });
702 const auto rMax_0 = rangeMax[0];
703 const auto rMax_1 = rangeMax[1];
705 Kokkos::parallel_for(
707 auto flatIdx = i + (j * rMax_0) + (k * rMax_0 * rMax_1);
713 template <
class Functor>
718 vtkm::exec::kokkos::internal::TaskBasic1D<Functor, vtkm::internal::NullType> kernel(functor);
719 ScheduleTask(kernel, numInstances);
722 template <
class Functor>
727 vtkm::exec::kokkos::internal::TaskBasic3D<Functor, vtkm::internal::NullType> kernel(functor);
728 ScheduleTask(kernel, rangeMax);
733 template <
typename T>
737 auto portal = values.
PrepareForInPlace(vtkm::cont::DeviceAdapterTagKokkos{}, token);
738 kokkos::internal::KokkosViewExec<T> view(portal.GetArray(), portal.GetNumberOfValues());
745 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
747 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
750 template <
typename T>
755 Superclass::Sort(values, comp);
759 using Superclass::Sort;
761 template <
typename T>
764 SortImpl(values, comp,
typename std::is_scalar<T>::type{});
769 vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
778 template <
typename WorkletType,
typename InvocationType>
779 VTKM_CONT static vtkm::exec::kokkos::internal::TaskBasic1D<WorkletType, InvocationType>
782 return vtkm::exec::kokkos::internal::TaskBasic1D<WorkletType, InvocationType>(worklet,
786 template <
typename WorkletType,
typename InvocationType>
787 VTKM_CONT static vtkm::exec::kokkos::internal::TaskBasic3D<WorkletType, InvocationType>
790 return vtkm::exec::kokkos::internal::TaskBasic3D<WorkletType, InvocationType>(worklet,
799 #endif //vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
typename ArrayHandle< T, StorageOut >::WritePortalType ArrayPortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:554
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
KOKKOS_INLINE_FUNCTION void operator()(vtkm::Id i, ResultType &update) const
Definition: DeviceAdapterAlgorithmKokkos.h:279
Manages an array-worth of data.
Definition: ArrayHandle.h:283
KOKKOS_INLINE_FUNCTION ReduceOperator(const ArrayPortal &portal)
Definition: DeviceAdapterAlgorithmKokkos.h:304
#define VTKM_EXEC
Definition: ExportMacros.h:51
KOKKOS_INLINE_FUNCTION ScanExclusiveOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:431
Groups connected points that have the same field value.
Definition: Atomic.h:19
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, const vtkm::Id i, T &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:444
KOKKOS_INLINE_FUNCTION void operator()(vtkm::Id i, ResultType &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:286
Binary Predicate that takes two arguments argument x, and y and returns product (multiplication) of t...
Definition: BinaryOperators.h:56
UseKokkosReduce< BinaryOperator, ResultType > UseKokkosScan
Definition: DeviceAdapterAlgorithmKokkos.h:410
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
VTKM_CONT ReadPortalType PrepareForInput(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares this BitField to be used as an input to an operation in the execution environment.
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, const vtkm::Id i, T &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:568
Binary Predicate that takes two arguments argument x, and y and returns the bitwise operation x|y
Definition: BinaryOperators.h:168
Binary Predicate that takes two arguments argument x, and y and returns a vtkm::Vec<T,...
Definition: BinaryOperators.h:112
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: DeviceAdapterAlgorithmKokkos.h:399
VTKM_CONT ReadPortalType PrepareForInput(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares this array to be used as an input to an operation in the execution environment.
Definition: ArrayHandle.h:574
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Fill the BitField with a specific pattern of bits.
KOKKOS_INLINE_FUNCTION void init(value_type &dst) const
Definition: DeviceAdapterAlgorithmKokkos.h:272
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
vtkm::Id size_type
Definition: DeviceAdapterAlgorithmKokkos.h:252
static VTKM_CONT T ScanInclusiveImpl(const vtkm::cont::ArrayHandle< T, StorageIn > &input, vtkm::cont::ArrayHandle< T, StorageOut > &output, BinaryOperator binaryOperator, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:589
#define VTKM_VOLATILE
Definition: DeviceAdapterAlgorithmKokkos.h:38
VTKM_CONT vtkm::cont::ArrayHandleImplicit< FunctorType > make_ArrayHandleImplicit(FunctorType functor, vtkm::Id length)
make_ArrayHandleImplicit is convenience function to generate an ArrayHandleImplicit.
Definition: ArrayHandleImplicit.h:198
Binary Predicate that takes two arguments argument x, and y and returns the x if x > y otherwise retu...
Definition: BinaryOperators.h:85
ArrayPortalOut PortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:460
static VTKM_CONT void SortImpl(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess comp, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:751
static VTKM_CONT vtkm::Id BitFieldToUnorderedSet(const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: DeviceAdapterAlgorithmKokkos.h:189
static VTKM_CONT vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Definition: DeviceAdapterAlgorithmKokkos.h:205
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
KokkosReduceFunctor< BinaryOperator, ScanInclusiveOperator< T, StorageIn, StorageOut, BinaryOperator >, T > ScanInclusiveFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:586
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
KOKKOS_INLINE_FUNCTION KokkosReduceFunctor(const BinaryOperator &op, Args... args)
Definition: DeviceAdapterAlgorithmKokkos.h:259
KOKKOS_INLINE_FUNCTION void join(VTKM_VOLATILE value_type &dst, const VTKM_VOLATILE value_type &src) const
Definition: DeviceAdapterAlgorithmKokkos.h:266
KOKKOS_INLINE_FUNCTION ScanExclusiveOperator(const ArrayPortalIn &portalIn, const ArrayPortalOut &portalOut, const T &initialValue)
Definition: DeviceAdapterAlgorithmKokkos.h:434
static VTKM_CONT void ScheduleTask(vtkm::exec::kokkos::internal::TaskBasic1D< WType, IType > &functor, vtkm::Id numInstances)
Definition: DeviceAdapterAlgorithmKokkos.h:655
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Compute an exclusive prefix sum operation on the input ArrayHandle.
static VTKM_CONT void Copy(const vtkm::cont::ArrayHandle< T > &input, vtkm::cont::ArrayHandle< T > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:221
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
static VTKM_CONT T ScanExclusiveImpl(const vtkm::cont::ArrayHandle< T, StorageIn > &input, vtkm::cont::ArrayHandle< T, StorageOut > &output, BinaryOperator binaryOperator, const T &initialValue, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:471
Binary Predicate that takes two arguments argument x, and y and returns sum (addition) of the two val...
Definition: BinaryOperators.h:33
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, vtkm::Id i, ResultType &update) const
Definition: DeviceAdapterAlgorithmKokkos.h:310
Binary Predicate that takes two arguments argument x, and y and returns True if and only if x is less...
Definition: BinaryPredicates.h:45
static VTKM_CONT vtkm::exec::kokkos::internal::TaskBasic3D< WorkletType, InvocationType > MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id3)
Definition: DeviceAdapterAlgorithmKokkos.h:788
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:530
static VTKM_CONT void SortImpl(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:734
T InitialValue
Definition: DeviceAdapterAlgorithmKokkos.h:461
KOKKOS_INLINE_FUNCTION ReduceOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:301
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryOperator binaryOperator, const T &initialValue)
Definition: DeviceAdapterAlgorithmKokkos.h:497
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Compute an inclusive prefix sum operation on the input ArrayHandle.
BinaryOperator Operator
Definition: DeviceAdapterAlgorithmKokkos.h:292
static VTKM_CONT void Schedule(Functor functor, vtkm::Id numInstances)
Definition: DeviceAdapterAlgorithmKokkos.h:714
static VTKM_CONT T ScanExclusiveImpl(const vtkm::cont::ArrayHandle< T, StorageIn > &input, vtkm::cont::ArrayHandle< T, StorageOut > &output, BinaryOperator binaryOperator, const T &initialValue, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:413
typename ArrayHandle< T, StorageOut >::WritePortalType ArrayPortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:427
Class providing a device-specific support for selecting the optimal Task type for a given worklet.
Definition: DeviceAdapterAlgorithm.h:744
#define VTKM_CONT
Definition: ExportMacros.h:57
#define VTKM_LOG_SCOPE_FUNCTION(level)
Definition: Logging.h:266
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:41
static VTKM_CONT ResultType ReduceImpl(const ArrayHandle &input, BinaryOperator binaryOperator, ResultType initialValue, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:240
ArrayPortalIn PortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:459
static VTKM_CONT T U
Definition: DeviceAdapterAlgorithm.h:347
FunctorOperator Functor
Definition: DeviceAdapterAlgorithmKokkos.h:293
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess comp)
Definition: DeviceAdapterAlgorithmKokkos.h:762
KOKKOS_INLINE_FUNCTION ScanInclusiveOperator(const ArrayPortalIn &portalIn, const ArrayPortalOut &portalOut)
Definition: DeviceAdapterAlgorithmKokkos.h:561
ArrayPortalIn PortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:578
static VTKM_CONT vtkm::exec::kokkos::internal::TaskBasic1D< WorkletType, InvocationType > MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id)
Definition: DeviceAdapterAlgorithmKokkos.h:780
ResultType value_type
Definition: DeviceAdapterAlgorithmKokkos.h:253
Base class for all user worklets invoked in the execution environment from a call to vtkm::cont::Devi...
Definition: FunctorBase.h:30
KokkosReduceFunctor< BinaryOperator, ReduceOperator< ArrayPortal, BinaryOperator, ResultType >, ResultType > ReduceFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:322
A short fixed-length array.
Definition: Types.h:767
static VTKM_CONT T ScanInclusiveImpl(const vtkm::cont::ArrayHandle< T, StorageIn > &input, vtkm::cont::ArrayHandle< T, StorageOut > &output, BinaryOperator binaryOperator, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:541
Binary Predicate that takes two arguments argument x, and y and returns the bitwise operation x&y
Definition: BinaryOperators.h:145
Definition: BitField.h:497
VTKM_CONT ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:414
VTKM_CONT WritePortalType PrepareForOutput(vtkm::Id numberOfValues, vtkm::cont::DeviceAdapterId device, vtkm::cont::Token &token) const
Prepares (allocates) this array to be used as an output from an operation in the execution environmen...
Definition: ArrayHandle.h:613
VTKM_CONT vtkm::Id GetNumberOfBits() const
Return the number of bits stored by this BitField.
static VTKM_CONT void Synchronize()
Definition: DeviceAdapterAlgorithmKokkos.h:767
static VTKM_CONT void CopyIf(const vtkm::cont::ArrayHandle< T, CIn > &input, const vtkm::cont::ArrayHandle< U, CStencil > &stencil, vtkm::cont::ArrayHandle< T, COut > &output)
Conditionally copy elements in the input array to the output array.
static VTKM_CONT void ScheduleTask(vtkm::exec::kokkos::internal::TaskBasic3D< WType, IType > &functor, vtkm::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmKokkos.h:676
KOKKOS_INLINE_FUNCTION KokkosReduceFunctor()
Definition: DeviceAdapterAlgorithmKokkos.h:256
ArrayPortalOut PortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:579
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:645
Definition: DeviceAdapterAlgorithmKokkos.h:174
static VTKM_CONT ResultType ReduceImpl(const ArrayHandle &input, BinaryOperator binaryOperator, ResultType initialValue, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:325
VTKM_EXEC_CONT vtkm::Int32 CountSetBits(vtkm::UInt32 word)
Count the total number of bits set in word.
Definition: Math.h:2887
KokkosReduceFunctor< BinaryOperator, ScanExclusiveOperator< T, StorageIn, StorageOut, BinaryOperator >, T > ScanExclusiveFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:468
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryOperator binaryOperator)
Definition: DeviceAdapterAlgorithmKokkos.h:614
VTKM_CONT void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:559
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryOperator binaryOperator)
Definition: DeviceAdapterAlgorithmKokkos.h:368
static VTKM_EXEC_CONT T ZeroInitialization()
Definition: TypeTraits.h:75
A class that points to and access and array of data.
Definition: ArrayPortal.h:62
typename ArrayHandle< T, StorageIn >::ReadPortalType ArrayPortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:426
@ Perf
General timing data and algorithm flow information, such as filter execution, worklet dispatches,...
vtkm::cont::internal::DeviceAdapterAlgorithmGeneral< DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >, vtkm::cont::DeviceAdapterTagKokkos > Superclass
Definition: DeviceAdapterAlgorithmKokkos.h:182
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:54
typename ArrayHandle< T, StorageIn >::ReadPortalType ArrayPortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:553
Binary Predicate that takes two arguments argument x, and y and returns the x if x < y otherwise retu...
Definition: BinaryOperators.h:99
ArrayPortal Portal
Definition: DeviceAdapterAlgorithmKokkos.h:316
KOKKOS_INLINE_FUNCTION ScanInclusiveOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:558
static VTKM_CONT void Schedule(Functor functor, const vtkm::Id3 &rangeMax)
Definition: DeviceAdapterAlgorithmKokkos.h:723