VTK-m  2.0
DeviceAdapterAlgorithmKokkos.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 #ifndef vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
11 #define vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
12 
18 #include <vtkm/cont/vtkm_cont_export.h>
19 
22 
24 
25 #include <vtkmstd/void_t.h>
26 
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
32 
33 #include <type_traits>
34 
35 #if KOKKOS_VERSION_MAJOR > 3 || (KOKKOS_VERSION_MAJOR == 3 && KOKKOS_VERSION_MINOR >= 7)
36 #define VTKM_VOLATILE
37 #else
38 #define VTKM_VOLATILE volatile
39 #endif
40 
41 
42 namespace vtkm
43 {
44 namespace internal
45 {
46 
47 template <typename, typename = void>
48 struct is_type_complete : public std::false_type
49 {
50 };
51 
52 template <typename T>
53 struct is_type_complete<T, vtkmstd::void_t<decltype(sizeof(T))>> : public std::true_type
54 {
55 };
56 } // internal
57 
58 namespace cont
59 {
60 
61 namespace kokkos
62 {
63 namespace internal
64 {
65 
66 //----------------------------------------------------------------------------
67 template <typename BitsPortal>
68 struct BitFieldToBoolField : public vtkm::exec::FunctorBase
69 {
70  VTKM_EXEC_CONT BitFieldToBoolField() {}
71 
72  VTKM_CONT
73  explicit BitFieldToBoolField(const BitsPortal& bp)
74  : Bits(bp)
75  {
76  }
77 
78  VTKM_EXEC bool operator()(vtkm::Id bitIdx) const { return this->Bits.GetBit(bitIdx); }
79 
80 private:
81  BitsPortal Bits;
82 };
83 
84 template <typename BitsPortal>
85 struct BitFieldCountSetBitsWord : public vtkm::exec::FunctorBase
86 {
87  VTKM_EXEC_CONT BitFieldCountSetBitsWord() {}
88 
89  VTKM_CONT
90  explicit BitFieldCountSetBitsWord(const BitsPortal& bp)
91  : Bits(bp)
92  {
93  }
94 
95  VTKM_EXEC vtkm::Id operator()(vtkm::Id wordIdx) const
96  {
97  auto word = this->Bits.GetWord(wordIdx);
98  if (wordIdx == (this->Bits.GetNumberOfWords() - 1))
99  {
100  word &= this->Bits.GetFinalWordMask();
101  }
102 
103  return vtkm::CountSetBits(word);
104  }
105 
106 private:
107  BitsPortal Bits;
108 };
109 
110 //----------------------------------------------------------------------------
111 template <typename Operator, typename ResultType>
112 struct ReductionIdentity;
113 
114 template <typename ResultType>
115 struct ReductionIdentity<vtkm::Sum, ResultType>
116 {
117  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::sum();
118 };
119 
120 template <typename ResultType>
121 struct ReductionIdentity<vtkm::Add, ResultType>
122 {
123  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::sum();
124 };
125 
126 template <typename ResultType>
127 struct ReductionIdentity<vtkm::Product, ResultType>
128 {
129  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::prod();
130 };
131 
132 template <typename ResultType>
133 struct ReductionIdentity<vtkm::Multiply, ResultType>
134 {
135  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::prod();
136 };
137 
138 template <typename ResultType>
139 struct ReductionIdentity<vtkm::Minimum, ResultType>
140 {
141  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::min();
142 };
143 
144 template <typename ResultType>
145 struct ReductionIdentity<vtkm::Maximum, ResultType>
146 {
147  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::max();
148 };
149 
150 template <typename ResultType>
151 struct ReductionIdentity<vtkm::MinAndMax<ResultType>, vtkm::Vec<ResultType, 2>>
152 {
153  static constexpr vtkm::Vec<ResultType, 2> value =
154  vtkm::Vec<ResultType, 2>(Kokkos::reduction_identity<ResultType>::min(),
155  Kokkos::reduction_identity<ResultType>::max());
156 };
157 
158 template <typename ResultType>
159 struct ReductionIdentity<vtkm::BitwiseAnd, ResultType>
160 {
161  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::band();
162 };
163 
164 template <typename ResultType>
165 struct ReductionIdentity<vtkm::BitwiseOr, ResultType>
166 {
167  static constexpr ResultType value = Kokkos::reduction_identity<ResultType>::bor();
168 };
169 }
170 } // kokkos::internal
171 
172 //=============================================================================
173 template <>
174 struct DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagKokkos>
175  : vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
176  DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagKokkos>,
177  vtkm::cont::DeviceAdapterTagKokkos>
178 {
179 private:
180  using Superclass = vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
182  vtkm::cont::DeviceAdapterTagKokkos>;
183 
184  VTKM_CONT_EXPORT static vtkm::exec::internal::ErrorMessageBuffer GetErrorMessageBufferInstance();
185  VTKM_CONT_EXPORT static void CheckForErrors();
186 
187 public:
188  template <typename IndicesStorage>
190  const vtkm::cont::BitField& bits,
192  {
193  vtkm::cont::Token token;
194  auto bitsPortal = bits.PrepareForInput(DeviceAdapterTagKokkos{}, token);
195  auto bits2bools = kokkos::internal::BitFieldToBoolField<decltype(bitsPortal)>(bitsPortal);
196 
200  indices);
201 
202  return indices.GetNumberOfValues();
203  }
204 
206  {
207  vtkm::cont::Token token;
208  auto bitsPortal = bits.PrepareForInput(DeviceAdapterTagKokkos{}, token);
209  auto countPerWord =
210  kokkos::internal::BitFieldCountSetBitsWord<decltype(bitsPortal)>(bitsPortal);
211 
213  vtkm::cont::make_ArrayHandleImplicit(countPerWord, bitsPortal.GetNumberOfWords()),
214  vtkm::Id{ 0 });
215  }
216 
217  //----------------------------------------------------------------------------
218  using Superclass::Copy;
219 
220  template <typename T>
221  VTKM_CONT static void Copy(const vtkm::cont::ArrayHandle<T>& input,
223  {
224  const vtkm::Id inSize = input.GetNumberOfValues();
225 
226  vtkm::cont::Token token;
227 
228  auto portalIn = input.PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
229  auto portalOut = output.PrepareForOutput(inSize, vtkm::cont::DeviceAdapterTagKokkos{}, token);
230 
231 
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);
235  }
236 
237  //----------------------------------------------------------------------------
238 private:
239  template <typename ArrayHandle, typename BinaryOperator, typename ResultType>
240  VTKM_CONT static ResultType ReduceImpl(const ArrayHandle& input,
241  BinaryOperator binaryOperator,
242  ResultType initialValue,
243  std::false_type)
244  {
245  return Superclass::Reduce(input, initialValue, binaryOperator);
246  }
247 
248  template <typename BinaryOperator, typename FunctorOperator, typename ResultType>
249  class KokkosReduceFunctor
250  {
251  public:
253  using value_type = ResultType;
254 
255  KOKKOS_INLINE_FUNCTION
257 
258  template <typename... Args>
259  KOKKOS_INLINE_FUNCTION explicit KokkosReduceFunctor(const BinaryOperator& op, Args... args)
260  : Operator(op)
261  , Functor(std::forward<Args>(args)...)
262  {
263  }
264 
265  KOKKOS_INLINE_FUNCTION
266  void join(VTKM_VOLATILE value_type& dst, const VTKM_VOLATILE value_type& src) const
267  {
268  dst = this->Operator(dst, src);
269  }
270 
271  KOKKOS_INLINE_FUNCTION
272  void init(value_type& dst) const
273  {
274  dst = kokkos::internal::ReductionIdentity<BinaryOperator, value_type>::value;
275  }
276 
277  // Reduce operator
278  KOKKOS_INLINE_FUNCTION
279  void operator()(vtkm::Id i, ResultType& update) const
280  {
281  this->Functor(this->Operator, i, update);
282  }
283 
284  // Scan operator
285  KOKKOS_INLINE_FUNCTION
286  void operator()(vtkm::Id i, ResultType& update, const bool final) const
287  {
288  this->Functor(this->Operator, i, update, final);
289  }
290 
291  private:
292  BinaryOperator Operator;
293  FunctorOperator Functor;
294  };
295 
296  template <typename ArrayPortal, typename BinaryOperator, typename ResultType>
297  class ReduceOperator
298  {
299  public:
300  KOKKOS_INLINE_FUNCTION
302 
303  KOKKOS_INLINE_FUNCTION
304  explicit ReduceOperator(const ArrayPortal& portal)
305  : Portal(portal)
306  {
307  }
308 
309  KOKKOS_INLINE_FUNCTION
310  void operator()(const BinaryOperator& op, vtkm::Id i, ResultType& update) const
311  {
312  update = op(update, this->Portal.Get(i));
313  }
314 
315  private:
317  };
318 
319  template <typename BinaryOperator, typename ArrayPortal, typename ResultType>
320  using ReduceFunctor = KokkosReduceFunctor<BinaryOperator,
321  ReduceOperator<ArrayPortal, BinaryOperator, ResultType>,
322  ResultType>;
323 
324  template <typename ArrayHandle, typename BinaryOperator, typename ResultType>
325  VTKM_CONT static ResultType ReduceImpl(const ArrayHandle& input,
326  BinaryOperator binaryOperator,
327  ResultType initialValue,
328  std::true_type)
329  {
330  vtkm::cont::Token token;
331  auto inputPortal = input.PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
332 
333  ReduceFunctor<BinaryOperator, decltype(inputPortal), ResultType> functor(binaryOperator,
334  inputPortal);
335 
336  ResultType result;
337 
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);
341 
342  return binaryOperator(initialValue, result);
343  }
344 
345  template <bool P1, typename BinaryOperator, typename ResultType>
346  struct UseKokkosReduceP1 : std::false_type
347  {
348  };
349 
350  template <typename BinaryOperator, typename ResultType>
351  struct UseKokkosReduceP1<true, BinaryOperator, ResultType>
352  : vtkm::internal::is_type_complete<
353  kokkos::internal::ReductionIdentity<BinaryOperator, ResultType>>
354  {
355  };
356 
357  template <typename BinaryOperator, typename ResultType>
358  struct UseKokkosReduce
359  : UseKokkosReduceP1<
360  vtkm::internal::is_type_complete<Kokkos::reduction_identity<ResultType>>::value,
361  BinaryOperator,
362  ResultType>
363  {
364  };
365 
366 public:
367  template <typename T, typename U, class CIn, class BinaryOperator>
369  U initialValue,
370  BinaryOperator binaryOperator)
371  {
373 
374  if (input.GetNumberOfValues() == 0)
375  {
376  return initialValue;
377  }
378  if (input.GetNumberOfValues() == 1)
379  {
380  return binaryOperator(initialValue, input.ReadPortal().Get(0));
381  }
382 
383 #if defined(VTKM_KOKKOS_CUDA)
384  // Kokkos reduce is having some issues with the cuda backend. Please refer to issue #586.
385  // Following is a work around where we use the Superclass reduce implementation when using
386  // Cuda execution space.
387  std::integral_constant<
388  bool,
389  !std::is_same<vtkm::cont::kokkos::internal::ExecutionSpace, Kokkos::Cuda>::value &&
390  UseKokkosReduce<BinaryOperator, U>::value>
391  use_kokkos_reduce;
392 #else
393  typename UseKokkosReduce<BinaryOperator, U>::type use_kokkos_reduce;
394 #endif
395  return ReduceImpl(input, binaryOperator, initialValue, use_kokkos_reduce);
396  }
397 
398  template <typename T, typename U, class CIn>
399  VTKM_CONT static U Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input, U initialValue)
400  {
402 
403  return Reduce(input, initialValue, vtkm::Add());
404  }
405 
406  //----------------------------------------------------------------------------
407 private:
408  // Scan and Reduce have the same conditions
409  template <typename BinaryOperator, typename ResultType>
410  using UseKokkosScan = UseKokkosReduce<BinaryOperator, ResultType>;
411 
412  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
415  BinaryOperator binaryOperator,
416  const T& initialValue,
417  std::false_type)
418  {
419  return Superclass::ScanExclusive(input, output, binaryOperator, initialValue);
420  }
421 
422  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
423  class ScanExclusiveOperator
424  {
425  private:
428 
429  public:
430  KOKKOS_INLINE_FUNCTION
432 
433  KOKKOS_INLINE_FUNCTION
434  explicit ScanExclusiveOperator(const ArrayPortalIn& portalIn,
435  const ArrayPortalOut& portalOut,
436  const T& initialValue)
437  : PortalIn(portalIn)
438  , PortalOut(portalOut)
439  , InitialValue(initialValue)
440  {
441  }
442 
443  KOKKOS_INLINE_FUNCTION
444  void operator()(const BinaryOperator& op, const vtkm::Id i, T& update, const bool final) const
445  {
446  auto val = this->PortalIn.Get(i);
447  if (i == 0)
448  {
449  update = InitialValue;
450  }
451  if (final)
452  {
453  this->PortalOut.Set(i, update);
454  }
455  update = op(update, val);
456  }
457 
458  private:
462  };
463 
464  template <typename BinaryOperator, typename T, typename StorageIn, typename StorageOut>
465  using ScanExclusiveFunctor =
466  KokkosReduceFunctor<BinaryOperator,
467  ScanExclusiveOperator<T, StorageIn, StorageOut, BinaryOperator>,
468  T>;
469 
470  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
473  BinaryOperator binaryOperator,
474  const T& initialValue,
475  std::true_type)
476  {
477  vtkm::Id length = input.GetNumberOfValues();
478 
479  vtkm::cont::Token token;
480  auto inputPortal = input.PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
481  auto outputPortal =
482  output.PrepareForOutput(length, vtkm::cont::DeviceAdapterTagKokkos{}, token);
483 
485  binaryOperator, inputPortal, outputPortal, initialValue);
486 
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);
491 
492  return result;
493  }
494 
495 public:
496  template <typename T, class CIn, class COut, class BinaryOperator>
499  BinaryOperator binaryOperator,
500  const T& initialValue)
501  {
503 
504  vtkm::Id length = input.GetNumberOfValues();
505  if (length == 0)
506  {
507  output.ReleaseResources();
508  return initialValue;
509  }
510  if (length == 1)
511  {
512  auto v0 = input.ReadPortal().Get(0);
513  Fill(output, initialValue, 1);
514  return binaryOperator(initialValue, v0);
515  }
516 
517 #if defined(VTKM_KOKKOS_CUDA)
518  // Kokkos scan for the cuda backend is not working correctly for int/uint types of 8 and 16 bits.
519  std::integral_constant<bool,
520  !(std::is_integral<T>::value && sizeof(T) < 4) &&
522  use_kokkos_scan;
523 #else
524  typename UseKokkosScan<BinaryOperator, T>::type use_kokkos_scan;
525 #endif
526  return ScanExclusiveImpl(input, output, binaryOperator, initialValue, use_kokkos_scan);
527  }
528 
529  template <typename T, class CIn, class COut>
532  {
534 
536  }
537 
538  //----------------------------------------------------------------------------
539 private:
540  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
543  BinaryOperator binaryOperator,
544  std::false_type)
545  {
546  return Superclass::ScanInclusive(input, output, binaryOperator);
547  }
548 
549  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
550  class ScanInclusiveOperator
551  {
552  private:
555 
556  public:
557  KOKKOS_INLINE_FUNCTION
559 
560  KOKKOS_INLINE_FUNCTION
561  explicit ScanInclusiveOperator(const ArrayPortalIn& portalIn, const ArrayPortalOut& portalOut)
562  : PortalIn(portalIn)
563  , PortalOut(portalOut)
564  {
565  }
566 
567  KOKKOS_INLINE_FUNCTION
568  void operator()(const BinaryOperator& op, const vtkm::Id i, T& update, const bool final) const
569  {
570  update = op(update, this->PortalIn.Get(i));
571  if (final)
572  {
573  this->PortalOut.Set(i, update);
574  }
575  }
576 
577  private:
580  };
581 
582  template <typename BinaryOperator, typename T, typename StorageIn, typename StorageOut>
583  using ScanInclusiveFunctor =
584  KokkosReduceFunctor<BinaryOperator,
585  ScanInclusiveOperator<T, StorageIn, StorageOut, BinaryOperator>,
586  T>;
587 
588  template <typename T, typename StorageIn, typename StorageOut, typename BinaryOperator>
591  BinaryOperator binaryOperator,
592  std::true_type)
593  {
594  vtkm::Id length = input.GetNumberOfValues();
595 
596  vtkm::cont::Token token;
597  auto inputPortal = input.PrepareForInput(vtkm::cont::DeviceAdapterTagKokkos{}, token);
598  auto outputPortal =
599  output.PrepareForOutput(length, vtkm::cont::DeviceAdapterTagKokkos{}, token);
600 
602  binaryOperator, inputPortal, outputPortal);
603 
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);
608 
609  return result;
610  }
611 
612 public:
613  template <typename T, class CIn, class COut, class BinaryOperator>
616  BinaryOperator binaryOperator)
617  {
619 
620  vtkm::Id length = input.GetNumberOfValues();
621  if (length == 0)
622  {
624  }
625  if (length == 1)
626  {
627  auto result = input.ReadPortal().Get(0);
628  Fill(output, result, 1);
629  return result;
630  }
631 
632 #if defined(VTKM_KOKKOS_CUDA)
633  // Kokkos scan for the cuda backend is not working correctly for int/uint types of 8 and 16 bits.
634  std::integral_constant<bool,
635  !(std::is_integral<T>::value && sizeof(T) < 4) &&
637  use_kokkos_scan;
638 #else
639  typename UseKokkosScan<BinaryOperator, T>::type use_kokkos_scan;
640 #endif
641  return ScanInclusiveImpl(input, output, binaryOperator, use_kokkos_scan);
642  }
643 
644  template <typename T, class CIn, class COut>
647  {
649 
650  return ScanInclusive(input, output, vtkm::Add());
651  }
652 
653  //----------------------------------------------------------------------------
654  template <typename WType, typename IType>
655  VTKM_CONT static void ScheduleTask(
656  vtkm::exec::kokkos::internal::TaskBasic1D<WType, IType>& functor,
657  vtkm::Id numInstances)
658  {
660 
661  if (numInstances < 1)
662  {
663  // No instances means nothing to run. Just return.
664  return;
665  }
666 
667  functor.SetErrorMessageBuffer(GetErrorMessageBufferInstance());
668 
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);
672  CheckForErrors(); // synchronizes
673  }
674 
675  template <typename WType, typename IType>
676  VTKM_CONT static void ScheduleTask(
677  vtkm::exec::kokkos::internal::TaskBasic3D<WType, IType>& functor,
678  vtkm::Id3 rangeMax)
679  {
681 
682  if ((rangeMax[0] < 1) || (rangeMax[1] < 1) || (rangeMax[2] < 1))
683  {
684  // No instances means nothing to run. Just return.
685  return;
686  }
687 
688  functor.SetErrorMessageBuffer(GetErrorMessageBufferInstance());
689 
690  Kokkos::MDRangePolicy<vtkm::cont::kokkos::internal::ExecutionSpace,
691  Kokkos::Rank<3>,
692  Kokkos::IndexType<vtkm::Id>>
693  policy(vtkm::cont::kokkos::internal::GetExecutionSpaceInstance(),
694  { 0, 0, 0 },
695  { rangeMax[0], rangeMax[1], rangeMax[2] });
696 
697  // Calling rangeMax[X] inside KOKKOS_LAMBDA confuses some compilers since
698  // at first it tries to use the non-const inline vec_base::operator[0]
699  // method, however, KOKKOS_LAMBDA DOES converts rangeMax to a const
700  // vec_base. This convertion is somehow catched by the compiler making it
701  // complain that we are using a non-const method for a const object.
702  const auto rMax_0 = rangeMax[0];
703  const auto rMax_1 = rangeMax[1];
704 
705  Kokkos::parallel_for(
706  policy, KOKKOS_LAMBDA(vtkm::Id i, vtkm::Id j, vtkm::Id k) {
707  auto flatIdx = i + (j * rMax_0) + (k * rMax_0 * rMax_1);
708  functor(vtkm::Id3(i, j, k), flatIdx);
709  });
710  CheckForErrors(); // synchronizes
711  }
712 
713  template <class Functor>
714  VTKM_CONT static void Schedule(Functor functor, vtkm::Id numInstances)
715  {
717 
718  vtkm::exec::kokkos::internal::TaskBasic1D<Functor, vtkm::internal::NullType> kernel(functor);
719  ScheduleTask(kernel, numInstances);
720  }
721 
722  template <class Functor>
723  VTKM_CONT static void Schedule(Functor functor, const vtkm::Id3& rangeMax)
724  {
726 
727  vtkm::exec::kokkos::internal::TaskBasic3D<Functor, vtkm::internal::NullType> kernel(functor);
728  ScheduleTask(kernel, rangeMax);
729  }
730 
731  //----------------------------------------------------------------------------
732 private:
733  template <typename T>
734  VTKM_CONT static void SortImpl(vtkm::cont::ArrayHandle<T>& values, vtkm::SortLess, std::true_type)
735  {
736  vtkm::cont::Token token;
737  auto portal = values.PrepareForInPlace(vtkm::cont::DeviceAdapterTagKokkos{}, token);
738  kokkos::internal::KokkosViewExec<T> view(portal.GetArray(), portal.GetNumberOfValues());
739 
740  // We use per-thread execution spaces so that the threads can execute independently without
741  // requiring global synchronizations.
742  // Currently, there is no way to specify the execution space for sort and therefore it
743  // executes in the default execution space.
744  // Therefore, we need explicit syncs here.
745  vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
746  Kokkos::sort(view);
747  vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
748  }
749 
750  template <typename T>
752  vtkm::SortLess comp,
753  std::false_type)
754  {
755  Superclass::Sort(values, comp);
756  }
757 
758 public:
759  using Superclass::Sort;
760 
761  template <typename T>
763  {
764  SortImpl(values, comp, typename std::is_scalar<T>::type{});
765  }
766 
767  VTKM_CONT static void Synchronize()
768  {
769  vtkm::cont::kokkos::internal::GetExecutionSpaceInstance().fence();
770  }
771 };
772 
773 //=============================================================================
774 template <>
775 class DeviceTaskTypes<vtkm::cont::DeviceAdapterTagKokkos>
776 {
777 public:
778  template <typename WorkletType, typename InvocationType>
779  VTKM_CONT static vtkm::exec::kokkos::internal::TaskBasic1D<WorkletType, InvocationType>
780  MakeTask(WorkletType& worklet, InvocationType& invocation, vtkm::Id)
781  {
782  return vtkm::exec::kokkos::internal::TaskBasic1D<WorkletType, InvocationType>(worklet,
783  invocation);
784  }
785 
786  template <typename WorkletType, typename InvocationType>
787  VTKM_CONT static vtkm::exec::kokkos::internal::TaskBasic3D<WorkletType, InvocationType>
788  MakeTask(WorkletType& worklet, InvocationType& invocation, vtkm::Id3)
789  {
790  return vtkm::exec::kokkos::internal::TaskBasic3D<WorkletType, InvocationType>(worklet,
791  invocation);
792  }
793 };
794 }
795 } // namespace vtkm::cont
796 
797 #undef VTKM_VOLATILE
798 
799 #endif //vtk_m_cont_kokkos_internal_DeviceAdapterAlgorithmKokkos_h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::ArrayPortalOut
typename ArrayHandle< T, StorageOut >::WritePortalType ArrayPortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:554
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(vtkm::Id i, ResultType &update) const
Definition: DeviceAdapterAlgorithmKokkos.h:279
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceOperator::ReduceOperator
KOKKOS_INLINE_FUNCTION ReduceOperator(const ArrayPortal &portal)
Definition: DeviceAdapterAlgorithmKokkos.h:304
VTKM_EXEC
#define VTKM_EXEC
Definition: ExportMacros.h:51
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::ScanExclusiveOperator
KOKKOS_INLINE_FUNCTION ScanExclusiveOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:431
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::operator()
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, const vtkm::Id i, T &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:444
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::operator()
KOKKOS_INLINE_FUNCTION void operator()(vtkm::Id i, ResultType &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:286
vtkm::Product
Binary Predicate that takes two arguments argument x, and y and returns product (multiplication) of t...
Definition: BinaryOperators.h:56
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::UseKokkosScan
UseKokkosReduce< BinaryOperator, ResultType > UseKokkosScan
Definition: DeviceAdapterAlgorithmKokkos.h:410
vtkm::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
vtkm::cont::BitField::PrepareForInput
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.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::operator()
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, const vtkm::Id i, T &update, const bool final) const
Definition: DeviceAdapterAlgorithmKokkos.h:568
vtkm::BitwiseOr
Binary Predicate that takes two arguments argument x, and y and returns the bitwise operation x|y
Definition: BinaryOperators.h:168
vtkm::MinAndMax
Binary Predicate that takes two arguments argument x, and y and returns a vtkm::Vec<T,...
Definition: BinaryOperators.h:112
VTKM_EXEC_CONT
#define VTKM_EXEC_CONT
Definition: ExportMacros.h:52
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Reduce
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: DeviceAdapterAlgorithmKokkos.h:399
vtkm::cont::ArrayHandle::PrepareForInput
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
vtkm::cont::DeviceAdapterAlgorithm::Fill
static VTKM_CONT void Fill(vtkm::cont::BitField &bits, bool value, vtkm::Id numBits)
Fill the BitField with a specific pattern of bits.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::init
KOKKOS_INLINE_FUNCTION void init(value_type &dst) const
Definition: DeviceAdapterAlgorithmKokkos.h:272
vtkm::cont::DeviceAdapterAlgorithm::Reduce
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
DeviceAdapterAlgorithmGeneral.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::size_type
vtkm::Id size_type
Definition: DeviceAdapterAlgorithmKokkos.h:252
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveImpl
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
VTKM_VOLATILE
#define VTKM_VOLATILE
Definition: DeviceAdapterAlgorithmKokkos.h:38
vtkm::cont::make_ArrayHandleImplicit
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
vtkm::Maximum
Binary Predicate that takes two arguments argument x, and y and returns the x if x > y otherwise retu...
Definition: BinaryOperators.h:85
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::PortalOut
ArrayPortalOut PortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:460
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::SortImpl
static VTKM_CONT void SortImpl(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess comp, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:751
DeviceAdapterTagKokkos.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::BitFieldToUnorderedSet
static VTKM_CONT vtkm::Id BitFieldToUnorderedSet(const vtkm::cont::BitField &bits, vtkm::cont::ArrayHandle< Id, IndicesStorage > &indices)
Definition: DeviceAdapterAlgorithmKokkos.h:189
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::CountSetBits
static VTKM_CONT vtkm::Id CountSetBits(const vtkm::cont::BitField &bits)
Definition: DeviceAdapterAlgorithmKokkos.h:205
vtkm::cont::ArrayHandle::PrepareForInPlace
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
DeviceAdapterAlgorithm.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveFunctor
KokkosReduceFunctor< BinaryOperator, ScanInclusiveOperator< T, StorageIn, StorageOut, BinaryOperator >, T > ScanInclusiveFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:586
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::KokkosReduceFunctor
KOKKOS_INLINE_FUNCTION KokkosReduceFunctor(const BinaryOperator &op, Args... args)
Definition: DeviceAdapterAlgorithmKokkos.h:259
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::join
KOKKOS_INLINE_FUNCTION void join(VTKM_VOLATILE value_type &dst, const VTKM_VOLATILE value_type &src) const
Definition: DeviceAdapterAlgorithmKokkos.h:266
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::ScanExclusiveOperator
KOKKOS_INLINE_FUNCTION ScanExclusiveOperator(const ArrayPortalIn &portalIn, const ArrayPortalOut &portalOut, const T &initialValue)
Definition: DeviceAdapterAlgorithmKokkos.h:434
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScheduleTask
static VTKM_CONT void ScheduleTask(vtkm::exec::kokkos::internal::TaskBasic1D< WType, IType > &functor, vtkm::Id numInstances)
Definition: DeviceAdapterAlgorithmKokkos.h:655
vtkm::cont::DeviceAdapterAlgorithm::ScanExclusive
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.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Copy
static VTKM_CONT void Copy(const vtkm::cont::ArrayHandle< T > &input, vtkm::cont::ArrayHandle< T > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:221
vtkm::Add
Definition: Types.h:222
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveImpl
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
vtkm::Sum
Binary Predicate that takes two arguments argument x, and y and returns sum (addition) of the two val...
Definition: BinaryOperators.h:33
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceOperator::operator()
KOKKOS_INLINE_FUNCTION void operator()(const BinaryOperator &op, vtkm::Id i, ResultType &update) const
Definition: DeviceAdapterAlgorithmKokkos.h:310
vtkm::SortLess
Binary Predicate that takes two arguments argument x, and y and returns True if and only if x is less...
Definition: BinaryPredicates.h:45
vtkm::cont::DeviceTaskTypes< vtkm::cont::DeviceAdapterTagKokkos >::MakeTask
static VTKM_CONT vtkm::exec::kokkos::internal::TaskBasic3D< WorkletType, InvocationType > MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id3)
Definition: DeviceAdapterAlgorithmKokkos.h:788
ArrayHandleIndex.h
vtkm::Multiply
Definition: Types.h:262
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusive
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:530
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::SortImpl
static VTKM_CONT void SortImpl(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:734
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::InitialValue
T InitialValue
Definition: DeviceAdapterAlgorithmKokkos.h:461
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceOperator::ReduceOperator
KOKKOS_INLINE_FUNCTION ReduceOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:301
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusive
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
vtkm::cont::DeviceAdapterAlgorithm::ScanInclusive
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.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::Operator
BinaryOperator Operator
Definition: DeviceAdapterAlgorithmKokkos.h:292
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Schedule
static VTKM_CONT void Schedule(Functor functor, vtkm::Id numInstances)
Definition: DeviceAdapterAlgorithmKokkos.h:714
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveImpl
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
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::ArrayPortalOut
typename ArrayHandle< T, StorageOut >::WritePortalType ArrayPortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:427
vtkm::cont::DeviceTaskTypes
Class providing a device-specific support for selecting the optimal Task type for a given worklet.
Definition: DeviceAdapterAlgorithm.h:744
VTKM_CONT
#define VTKM_CONT
Definition: ExportMacros.h:57
VTKM_LOG_SCOPE_FUNCTION
#define VTKM_LOG_SCOPE_FUNCTION(level)
Definition: Logging.h:266
vtkm::cont::DeviceAdapterAlgorithm
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:41
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceImpl
static VTKM_CONT ResultType ReduceImpl(const ArrayHandle &input, BinaryOperator binaryOperator, ResultType initialValue, std::false_type)
Definition: DeviceAdapterAlgorithmKokkos.h:240
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::PortalIn
ArrayPortalIn PortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:459
ErrorExecution.h
vtkm::cont::DeviceAdapterAlgorithm::U
static VTKM_CONT T U
Definition: DeviceAdapterAlgorithm.h:347
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::Functor
FunctorOperator Functor
Definition: DeviceAdapterAlgorithmKokkos.h:293
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Sort
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T > &values, vtkm::SortLess comp)
Definition: DeviceAdapterAlgorithmKokkos.h:762
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::ScanInclusiveOperator
KOKKOS_INLINE_FUNCTION ScanInclusiveOperator(const ArrayPortalIn &portalIn, const ArrayPortalOut &portalOut)
Definition: DeviceAdapterAlgorithmKokkos.h:561
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::PortalIn
ArrayPortalIn PortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:578
vtkm::cont::DeviceTaskTypes< vtkm::cont::DeviceAdapterTagKokkos >::MakeTask
static VTKM_CONT vtkm::exec::kokkos::internal::TaskBasic1D< WorkletType, InvocationType > MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id)
Definition: DeviceAdapterAlgorithmKokkos.h:780
KokkosTypes.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::value_type
ResultType value_type
Definition: DeviceAdapterAlgorithmKokkos.h:253
vtkm::exec::FunctorBase
Base class for all user worklets invoked in the execution environment from a call to vtkm::cont::Devi...
Definition: FunctorBase.h:30
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceFunctor
KokkosReduceFunctor< BinaryOperator, ReduceOperator< ArrayPortal, BinaryOperator, ResultType >, ResultType > ReduceFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:322
vtkm::Vec
A short fixed-length array.
Definition: Types.h:767
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveImpl
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
vtkm::BitwiseAnd
Binary Predicate that takes two arguments argument x, and y and returns the bitwise operation x&y
Definition: BinaryOperators.h:145
vtkm::cont::BitField
Definition: BitField.h:497
vtkm::cont::ArrayHandle::ReadPortal
VTKM_CONT ReadPortalType ReadPortal() const
Get an array portal that can be used in the control environment.
Definition: ArrayHandle.h:414
vtkm::cont::ArrayHandle::PrepareForOutput
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::BitField::GetNumberOfBits
VTKM_CONT vtkm::Id GetNumberOfBits() const
Return the number of bits stored by this BitField.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Synchronize
static VTKM_CONT void Synchronize()
Definition: DeviceAdapterAlgorithmKokkos.h:767
vtkm::cont::DeviceAdapterAlgorithm::CopyIf
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.
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScheduleTask
static VTKM_CONT void ScheduleTask(vtkm::exec::kokkos::internal::TaskBasic3D< WType, IType > &functor, vtkm::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmKokkos.h:676
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::KokkosReduceFunctor::KokkosReduceFunctor
KOKKOS_INLINE_FUNCTION KokkosReduceFunctor()
Definition: DeviceAdapterAlgorithmKokkos.h:256
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::PortalOut
ArrayPortalOut PortalOut
Definition: DeviceAdapterAlgorithmKokkos.h:579
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusive
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmKokkos.h:645
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >
Definition: DeviceAdapterAlgorithmKokkos.h:174
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceImpl
static VTKM_CONT ResultType ReduceImpl(const ArrayHandle &input, BinaryOperator binaryOperator, ResultType initialValue, std::true_type)
Definition: DeviceAdapterAlgorithmKokkos.h:325
ArrayHandleImplicit.h
vtkm::CountSetBits
VTKM_EXEC_CONT vtkm::Int32 CountSetBits(vtkm::UInt32 word)
Count the total number of bits set in word.
Definition: Math.h:2887
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveFunctor
KokkosReduceFunctor< BinaryOperator, ScanExclusiveOperator< T, StorageIn, StorageOut, BinaryOperator >, T > ScanExclusiveFunctor
Definition: DeviceAdapterAlgorithmKokkos.h:468
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusive
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::ArrayHandle::ReleaseResources
VTKM_CONT void ReleaseResources() const
Releases all resources in both the control and execution environments.
Definition: ArrayHandle.h:559
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Reduce
static VTKM_CONT U Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryOperator binaryOperator)
Definition: DeviceAdapterAlgorithmKokkos.h:368
vtkm::TypeTraits::ZeroInitialization
static VTKM_EXEC_CONT T ZeroInitialization()
Definition: TypeTraits.h:75
vtkm::cont::ArrayPortal
A class that points to and access and array of data.
Definition: ArrayPortal.h:62
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanExclusiveOperator::ArrayPortalIn
typename ArrayHandle< T, StorageIn >::ReadPortalType ArrayPortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:426
vtkm::cont::LogLevel::Perf
@ Perf
General timing data and algorithm flow information, such as filter execution, worklet dispatches,...
TaskBasic.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Superclass
vtkm::cont::internal::DeviceAdapterAlgorithmGeneral< DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >, vtkm::cont::DeviceAdapterTagKokkos > Superclass
Definition: DeviceAdapterAlgorithmKokkos.h:182
vtkm::cont::ArrayHandleIndex
An implicit array handle containing the its own indices.
Definition: ArrayHandleIndex.h:54
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::ArrayPortalIn
typename ArrayHandle< T, StorageIn >::ReadPortalType ArrayPortalIn
Definition: DeviceAdapterAlgorithmKokkos.h:553
vtkm::Minimum
Binary Predicate that takes two arguments argument x, and y and returns the x if x < y otherwise retu...
Definition: BinaryOperators.h:99
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ReduceOperator::Portal
ArrayPortal Portal
Definition: DeviceAdapterAlgorithmKokkos.h:316
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::ScanInclusiveOperator::ScanInclusiveOperator
KOKKOS_INLINE_FUNCTION ScanInclusiveOperator()
Definition: DeviceAdapterAlgorithmKokkos.h:558
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagKokkos >::Schedule
static VTKM_CONT void Schedule(Functor functor, const vtkm::Id3 &rangeMax)
Definition: DeviceAdapterAlgorithmKokkos.h:723