VTK-m  2.0
DeviceAdapterAlgorithmTBB.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_tbb_internal_DeviceAdapterAlgorithmTBB_h
11 #define vtk_m_cont_tbb_internal_DeviceAdapterAlgorithmTBB_h
12 
13 #include <vtkm/cont/ArrayHandle.h>
18 #include <vtkm/cont/Logging.h>
24 
26 
27 namespace vtkm
28 {
29 namespace cont
30 {
31 
32 template <>
33 struct DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagTBB>
34  : vtkm::cont::internal::DeviceAdapterAlgorithmGeneral<
35  DeviceAdapterAlgorithm<vtkm::cont::DeviceAdapterTagTBB>,
36  vtkm::cont::DeviceAdapterTagTBB>
37 {
38 public:
39  template <typename T, typename U, class CIn, class COut>
42  {
44 
45  vtkm::cont::Token token;
46 
47  const vtkm::Id inSize = input.GetNumberOfValues();
48  auto inputPortal = input.PrepareForInput(DeviceAdapterTagTBB(), token);
49  auto outputPortal = output.PrepareForOutput(inSize, DeviceAdapterTagTBB(), token);
50 
51  tbb::CopyPortals(inputPortal, outputPortal, 0, 0, inSize);
52  }
53 
54  template <typename T, typename U, class CIn, class CStencil, class COut>
58  {
60 
61  ::vtkm::NotZeroInitialized unary_predicate;
62  CopyIf(input, stencil, output, unary_predicate);
63  }
64 
65  template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
69  UnaryPredicate unary_predicate)
70  {
72 
73  vtkm::cont::Token token;
74 
75  vtkm::Id inputSize = input.GetNumberOfValues();
76  VTKM_ASSERT(inputSize == stencil.GetNumberOfValues());
77  vtkm::Id outputSize =
78  tbb::CopyIfPortals(input.PrepareForInput(DeviceAdapterTagTBB(), token),
79  stencil.PrepareForInput(DeviceAdapterTagTBB(), token),
80  output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
81  unary_predicate);
82  token.DetachFromAll();
83  output.Allocate(outputSize, vtkm::CopyFlag::On);
84  }
85 
86  template <typename T, typename U, class CIn, class COut>
88  vtkm::Id inputStartIndex,
89  vtkm::Id numberOfElementsToCopy,
91  vtkm::Id outputIndex = 0)
92  {
94 
95  const vtkm::Id inSize = input.GetNumberOfValues();
96 
97  // Check if the ranges overlap and fail if they do.
98  if (input == output &&
99  ((outputIndex >= inputStartIndex &&
100  outputIndex < inputStartIndex + numberOfElementsToCopy) ||
101  (inputStartIndex >= outputIndex &&
102  inputStartIndex < outputIndex + numberOfElementsToCopy)))
103  {
104  return false;
105  }
106 
107  if (inputStartIndex < 0 || numberOfElementsToCopy < 0 || outputIndex < 0 ||
108  inputStartIndex >= inSize)
109  { //invalid parameters
110  return false;
111  }
112 
113  //determine if the numberOfElementsToCopy needs to be reduced
114  if (inSize < (inputStartIndex + numberOfElementsToCopy))
115  { //adjust the size
116  numberOfElementsToCopy = (inSize - inputStartIndex);
117  }
118 
119  const vtkm::Id outSize = output.GetNumberOfValues();
120  const vtkm::Id copyOutEnd = outputIndex + numberOfElementsToCopy;
121  if (outSize < copyOutEnd)
122  { //output is not large enough
123  if (outSize == 0)
124  { //since output has nothing, just need to allocate to correct length
125  output.Allocate(copyOutEnd);
126  }
127  else
128  { //we currently have data in this array, so preserve it in the new
129  //resized array
131  temp.Allocate(copyOutEnd);
132  CopySubRange(output, 0, outSize, temp);
133  output = temp;
134  }
135  }
136 
137  vtkm::cont::Token token;
138  auto inputPortal = input.PrepareForInput(DeviceAdapterTagTBB(), token);
139  auto outputPortal = output.PrepareForInPlace(DeviceAdapterTagTBB(), token);
140 
142  inputPortal, outputPortal, inputStartIndex, outputIndex, numberOfElementsToCopy);
143 
144  return true;
145  }
146 
147  template <typename T, typename U, class CIn>
148  VTKM_CONT static auto Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input, U initialValue)
149  -> decltype(Reduce(input, initialValue, vtkm::Add{}))
150  {
152 
153  return Reduce(input, initialValue, vtkm::Add());
154  }
155 
156  template <typename T, typename U, class CIn, class BinaryFunctor>
158  U initialValue,
159  BinaryFunctor binary_functor)
160  -> decltype(tbb::ReducePortals(input.ReadPortal(), initialValue, binary_functor))
161  {
163 
164  vtkm::cont::Token token;
165  return tbb::ReducePortals(input.PrepareForInput(vtkm::cont::DeviceAdapterTagTBB(), token),
166  initialValue,
167  binary_functor);
168  }
169 
170  template <typename T,
171  typename U,
172  class CKeyIn,
173  class CValIn,
174  class CKeyOut,
175  class CValOut,
176  class BinaryFunctor>
181  BinaryFunctor binary_functor)
182  {
184 
185  vtkm::cont::Token token;
186 
187  vtkm::Id inputSize = keys.GetNumberOfValues();
188  VTKM_ASSERT(inputSize == values.GetNumberOfValues());
189  vtkm::Id outputSize = tbb::ReduceByKeyPortals(
190  keys.PrepareForInput(DeviceAdapterTagTBB(), token),
191  values.PrepareForInput(DeviceAdapterTagTBB(), token),
192  keys_output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
193  values_output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
194  binary_functor);
195  token.DetachFromAll();
196  keys_output.Allocate(outputSize, vtkm::CopyFlag::On);
197  values_output.Allocate(outputSize, vtkm::CopyFlag::On);
198  }
199 
200  template <typename T, class CIn, class COut>
203  {
205 
206  vtkm::cont::Token token;
207  return tbb::ScanInclusivePortals(
208  input.PrepareForInput(vtkm::cont::DeviceAdapterTagTBB(), token),
209  output.PrepareForOutput(input.GetNumberOfValues(), vtkm::cont::DeviceAdapterTagTBB(), token),
210  vtkm::Add());
211  }
212 
213  template <typename T, class CIn, class COut, class BinaryFunctor>
216  BinaryFunctor binary_functor)
217  {
219 
220  vtkm::cont::Token token;
221  return tbb::ScanInclusivePortals(
222  input.PrepareForInput(vtkm::cont::DeviceAdapterTagTBB(), token),
223  output.PrepareForOutput(input.GetNumberOfValues(), vtkm::cont::DeviceAdapterTagTBB(), token),
224  binary_functor);
225  }
226 
227  template <typename T, class CIn, class COut>
230  {
232 
233  vtkm::cont::Token token;
234  return tbb::ScanExclusivePortals(
235  input.PrepareForInput(vtkm::cont::DeviceAdapterTagTBB(), token),
236  output.PrepareForOutput(input.GetNumberOfValues(), vtkm::cont::DeviceAdapterTagTBB(), token),
237  vtkm::Add(),
239  }
240 
241  template <typename T, class CIn, class COut, class BinaryFunctor>
244  BinaryFunctor binary_functor,
245  const T& initialValue)
246  {
248 
249  vtkm::cont::Token token;
250  return tbb::ScanExclusivePortals(
251  input.PrepareForInput(vtkm::cont::DeviceAdapterTagTBB(), token),
252  output.PrepareForOutput(input.GetNumberOfValues(), vtkm::cont::DeviceAdapterTagTBB(), token),
253  binary_functor,
254  initialValue);
255  }
256 
257  VTKM_CONT_EXPORT static void ScheduleTask(vtkm::exec::tbb::internal::TaskTiling1D& functor,
258  vtkm::Id size);
259  VTKM_CONT_EXPORT static void ScheduleTask(vtkm::exec::tbb::internal::TaskTiling3D& functor,
260  vtkm::Id3 size);
261 
262  template <class FunctorType>
263  VTKM_CONT static inline void Schedule(FunctorType functor, vtkm::Id numInstances)
264  {
266  "Schedule TBB 1D: '%s'",
267  vtkm::cont::TypeToString(functor).c_str());
268 
269  vtkm::exec::tbb::internal::TaskTiling1D kernel(functor);
270  ScheduleTask(kernel, numInstances);
271  }
272 
273  template <class FunctorType>
274  VTKM_CONT static inline void Schedule(FunctorType functor, vtkm::Id3 rangeMax)
275  {
277  "Schedule TBB 3D: '%s'",
278  vtkm::cont::TypeToString(functor).c_str());
279 
280  vtkm::exec::tbb::internal::TaskTiling3D kernel(functor);
281  ScheduleTask(kernel, rangeMax);
282  }
283 
284  //1. We need functions for each of the following
285 
286 
287  template <typename T, class Container>
289  {
291 
292  //this is required to get sort to work with zip handles
293  std::less<T> lessOp;
294  vtkm::cont::tbb::sort::parallel_sort(values, lessOp);
295  }
296 
297  template <typename T, class Container, class BinaryCompare>
299  BinaryCompare binary_compare)
300  {
302 
303  vtkm::cont::tbb::sort::parallel_sort(values, binary_compare);
304  }
305 
306  template <typename T, typename U, class StorageT, class StorageU>
309  {
311 
312  vtkm::cont::tbb::sort::parallel_sort_bykey(keys, values, std::less<T>());
313  }
314 
315  template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
318  BinaryCompare binary_compare)
319  {
321 
322  vtkm::cont::tbb::sort::parallel_sort_bykey(keys, values, binary_compare);
323  }
324 
325  template <typename T, class Storage>
327  {
328  Unique(values, std::equal_to<T>());
329  }
330 
331  template <typename T, class Storage, class BinaryCompare>
333  BinaryCompare binary_compare)
334  {
336 
337  vtkm::Id outputSize;
338  {
339  vtkm::cont::Token token;
340  outputSize =
341  tbb::UniquePortals(values.PrepareForInPlace(DeviceAdapterTagTBB(), token), binary_compare);
342  }
343  values.Allocate(outputSize, vtkm::CopyFlag::On);
344  }
345 
346  VTKM_CONT static void Synchronize()
347  {
348  // Nothing to do. This device schedules all of its operations using a
349  // split/join paradigm. This means that the if the control threaad is
350  // calling this method, then nothing should be running in the execution
351  // environment.
352  }
353 };
354 
357 template <>
358 class DeviceAdapterTimerImplementation<vtkm::cont::DeviceAdapterTagTBB>
359 {
360 public:
362 
364  {
365  this->StartReady = false;
366  this->StopReady = false;
367  }
368 
370  {
371  this->Reset();
372  this->StartTime = this->GetCurrentTime();
373  this->StartReady = true;
374  }
375 
377  {
378  this->StopTime = this->GetCurrentTime();
379  this->StopReady = true;
380  }
381 
382  VTKM_CONT bool Started() const { return this->StartReady; }
383 
384  VTKM_CONT bool Stopped() const { return this->StopReady; }
385 
386  VTKM_CONT bool Ready() const { return true; }
387 
389  {
390  assert(this->StartReady);
391  if (!this->StartReady)
392  {
394  "Start() function should be called first then trying to call Stop() and"
395  " GetElapsedTime().");
396  return 0;
397  }
398 
399  ::tbb::tick_count startTime = this->StartTime;
400  ::tbb::tick_count stopTime = this->StopReady ? this->StopTime : this->GetCurrentTime();
401 
402  ::tbb::tick_count::interval_t elapsedTime = stopTime - startTime;
403 
404  return static_cast<vtkm::Float64>(elapsedTime.seconds());
405  }
406 
407  VTKM_CONT::tbb::tick_count GetCurrentTime() const
408  {
410  return ::tbb::tick_count::now();
411  }
412 
413 private:
415  bool StopReady;
416  ::tbb::tick_count StartTime;
417  ::tbb::tick_count StopTime;
418 };
419 
420 template <>
421 class DeviceTaskTypes<vtkm::cont::DeviceAdapterTagTBB>
422 {
423 public:
424  template <typename WorkletType, typename InvocationType>
425  static vtkm::exec::tbb::internal::TaskTiling1D MakeTask(WorkletType& worklet,
426  InvocationType& invocation,
427  vtkm::Id)
428  {
429  return vtkm::exec::tbb::internal::TaskTiling1D(worklet, invocation);
430  }
431 
432  template <typename WorkletType, typename InvocationType>
433  static vtkm::exec::tbb::internal::TaskTiling3D MakeTask(WorkletType& worklet,
434  InvocationType& invocation,
435  vtkm::Id3)
436  {
437  return vtkm::exec::tbb::internal::TaskTiling3D(worklet, invocation);
438  }
439 };
440 }
441 } // namespace vtkm::cont
442 
443 #endif //vtk_m_cont_tbb_internal_DeviceAdapterAlgorithmTBB_h
vtkm::cont::tbb::CopyIfPortals
VTKM_CONT vtkm::Id CopyIfPortals(InputPortalType inputPortal, StencilPortalType stencilPortal, OutputPortalType outputPortal, UnaryPredicateType unaryPredicate)
Definition: FunctorsTBB.h:347
VTKM_LOG_SCOPE
#define VTKM_LOG_SCOPE(level,...)
Definition: Logging.h:265
vtkm::cont::ArrayHandle::GetNumberOfValues
VTKM_CONT vtkm::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:448
vtkm::cont::DeviceAdapterTimerImplementation::StopTime
TimeStamp StopTime
Definition: DeviceAdapterAlgorithm.h:704
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Schedule
static VTKM_CONT void Schedule(FunctorType functor, vtkm::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmTBB.h:274
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:283
ArrayHandle.h
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::GetCurrentTime
VTKM_CONT::tbb::tick_count GetCurrentTime() const
Definition: DeviceAdapterAlgorithmTBB.h:407
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::DeviceAdapterTimerImplementation
VTKM_CONT DeviceAdapterTimerImplementation()
Definition: DeviceAdapterAlgorithmTBB.h:361
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::GetElapsedTime
VTKM_CONT vtkm::Float64 GetElapsedTime() const
Definition: DeviceAdapterAlgorithmTBB.h:388
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Stop
VTKM_CONT void Stop()
Definition: DeviceAdapterAlgorithmTBB.h:376
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Sort
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T, Container > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:298
vtkm::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in VTKm (an...
Definition: TypeTraits.h:61
VTKM_ASSERT
#define VTKM_ASSERT(condition)
Definition: Assert.h:43
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Start
VTKM_CONT void Start()
Definition: DeviceAdapterAlgorithmTBB.h:369
vtkm::cont::ArrayHandle::Allocate
VTKM_CONT void Allocate(vtkm::Id numberOfValues, vtkm::CopyFlag preserve, vtkm::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:465
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< vtkm::cont::DeviceAdapterTagTBB >::ScanInclusive
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:201
vtkm::cont::Token::DetachFromAll
VTKM_CONT void DetachFromAll()
Detaches this Token from all resources to allow them to be used elsewhere or deleted.
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.
DeviceAdapterTagTBB.h
DeviceAdapterAlgorithmGeneral.h
IteratorFromArrayPortal.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::ScanInclusive
static VTKM_CONT T ScanInclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: DeviceAdapterAlgorithmTBB.h:214
vtkm::cont::tbb::UniquePortals
VTKM_CONT vtkm::Id UniquePortals(PortalType portal, BinaryOperationType binaryOperation)
Definition: FunctorsTBB.h:1364
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::CopySubRange
static VTKM_CONT bool CopySubRange(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Definition: DeviceAdapterAlgorithmTBB.h:87
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
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::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, UnaryPredicate unary_predicate)
Definition: DeviceAdapterAlgorithmTBB.h:66
DeviceAdapterAlgorithm.h
vtkm::cont::DeviceTaskTypes< vtkm::cont::DeviceAdapterTagTBB >::MakeTask
static vtkm::exec::tbb::internal::TaskTiling3D MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id3)
Definition: DeviceAdapterAlgorithmTBB.h:433
vtkm::Id
vtkm::Int32 Id
Represents an ID (index into arrays).
Definition: Types.h:191
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Ready
VTKM_CONT bool Ready() const
Definition: DeviceAdapterAlgorithmTBB.h:386
ArrayHandleZip.h
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::DeviceAdapterTagTBB >::ReduceByKey
static VTKM_CONT void ReduceByKey(const vtkm::cont::ArrayHandle< T, CKeyIn > &keys, const vtkm::cont::ArrayHandle< U, CValIn > &values, vtkm::cont::ArrayHandle< T, CKeyOut > &keys_output, vtkm::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: DeviceAdapterAlgorithmTBB.h:177
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Sort
static VTKM_CONT void Sort(vtkm::cont::ArrayHandle< T, Container > &values)
Definition: DeviceAdapterAlgorithmTBB.h:288
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Unique
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Definition: DeviceAdapterAlgorithmTBB.h:326
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Unique
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:332
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::StopTime
::tbb::tick_count StopTime
Definition: DeviceAdapterAlgorithmTBB.h:417
vtkm::cont::tbb::sort::parallel_sort_bykey
void parallel_sort_bykey(vtkm::cont::ArrayHandle< T, StorageT > &, vtkm::cont::ArrayHandle< U, StorageU > &, BinaryCompare)
Definition: ParallelSortTBB.h:225
ArrayHandleIndex.h
vtkm::cont::DeviceTaskTypes< vtkm::cont::DeviceAdapterTagTBB >::MakeTask
static vtkm::exec::tbb::internal::TaskTiling1D MakeTask(WorkletType &worklet, InvocationType &invocation, vtkm::Id)
Definition: DeviceAdapterAlgorithmTBB.h:425
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Reduce
static VTKM_CONT auto Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue) -> decltype(Reduce(input, initialValue, vtkm::Add
Definition: DeviceAdapterAlgorithmTBB.h:148
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Synchronize
static VTKM_CONT void Synchronize()
Definition: DeviceAdapterAlgorithmTBB.h:346
FunctorsTBB.h
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Copy
static VTKM_CONT void Copy(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< U, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:40
vtkm::cont::DeviceAdapterTimerImplementation::StartReady
bool StartReady
Definition: DeviceAdapterAlgorithm.h:701
vtkm::cont::DeviceAdapterTimerImplementation::StopReady
bool StopReady
Definition: DeviceAdapterAlgorithm.h:702
vtkm::cont::DeviceAdapterTimerImplementation::Reset
VTKM_CONT void Reset()
Resets the timer.
Definition: DeviceAdapterAlgorithm.h:630
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Reduce
static VTKM_CONT auto Reduce(const vtkm::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor) -> decltype(tbb::ReducePortals(input.ReadPortal(), initialValue, binary_functor))
Definition: DeviceAdapterAlgorithmTBB.h:157
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
TaskTiling.h
vtkm::cont::DeviceAdapterAlgorithm
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:41
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::SortByKey
static VTKM_CONT void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:316
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::Schedule
static VTKM_CONT void Schedule(FunctorType functor, vtkm::Id numInstances)
Definition: DeviceAdapterAlgorithmTBB.h:263
vtkm::CopyFlag::On
@ On
ErrorExecution.h
vtkm::cont::DeviceAdapterAlgorithm::U
static VTKM_CONT T U
Definition: DeviceAdapterAlgorithm.h:347
vtkm::cont::DeviceAdapterAlgorithm::Unique
static VTKM_CONT void Unique(vtkm::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
vtkm::cont::DeviceAdapterTimerImplementation::GetCurrentTime
VTKM_CONT TimeStamp GetCurrentTime() const
Definition: DeviceAdapterAlgorithm.h:682
vtkm::cont::LogLevel::Error
@ Error
Important but non-fatal errors, such as device fail-over.
VTKM_LOG_S
#define VTKM_LOG_S(level,...)
Writes a message using stream syntax to the indicated log level.
Definition: Logging.h:261
vtkm::cont::DeviceAdapterTimerImplementation
Class providing a device-specific timer.
Definition: DeviceAdapterAlgorithm.h:613
vtkm::Vec< vtkm::Id, 3 >
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::ScanExclusive
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:228
vtkm::cont::DeviceAdapterAlgorithm::CopySubRange
static VTKM_CONT bool CopySubRange(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::Id inputStartIndex, vtkm::Id numberOfElementsToCopy, vtkm::cont::ArrayHandle< U, COut > &output, vtkm::Id outputIndex=0)
Copy the contents of a section of one ArrayHandle to another.
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Stopped
VTKM_CONT bool Stopped() const
Definition: DeviceAdapterAlgorithmTBB.h:384
vtkm::NotZeroInitialized
Predicate that takes a single argument x, and returns True if it isn't the identity of the Type T.
Definition: UnaryPredicates.h:32
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::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::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::StopReady
bool StopReady
Definition: DeviceAdapterAlgorithmTBB.h:415
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::StartTime
::tbb::tick_count StartTime
Definition: DeviceAdapterAlgorithmTBB.h:416
vtkm::Float64
double Float64
Definition: Types.h:155
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::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)
Definition: DeviceAdapterAlgorithmTBB.h:55
vtkm::cont::tbb::ReduceByKeyPortals
VTKM_CONT vtkm::Id ReduceByKeyPortals(KeysInPortalType keysInPortal, ValuesInPortalType valuesInPortal, KeysOutPortalType keysOutPortal, ValuesOutPortalType valuesOutPortal, BinaryOperationType binaryOperation)
Definition: FunctorsTBB.h:787
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::ScanExclusive
static VTKM_CONT T ScanExclusive(const vtkm::cont::ArrayHandle< T, CIn > &input, vtkm::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor, const T &initialValue)
Definition: DeviceAdapterAlgorithmTBB.h:242
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Started
VTKM_CONT bool Started() const
Definition: DeviceAdapterAlgorithmTBB.h:382
Logging.h
Logging utilities.
ParallelSortTBB.h
vtkm::cont::DeviceAdapterTimerImplementation::StartTime
TimeStamp StartTime
Definition: DeviceAdapterAlgorithm.h:703
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::StartReady
bool StartReady
Definition: DeviceAdapterAlgorithmTBB.h:414
vtkm::cont::DeviceAdapterAlgorithm< vtkm::cont::DeviceAdapterTagTBB >::SortByKey
static VTKM_CONT void SortByKey(vtkm::cont::ArrayHandle< T, StorageT > &keys, vtkm::cont::ArrayHandle< U, StorageU > &values)
Definition: DeviceAdapterAlgorithmTBB.h:307
vtkm::cont::tbb::sort::parallel_sort
void parallel_sort(vtkm::cont::ArrayHandle< T, Container > &, BinaryCompare)
Definition: ParallelSortTBB.h:79
vtkm::cont::TypeToString
VTKM_CONT_EXPORT VTKM_CONT std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
vtkm::cont::tbb::CopyPortals
void CopyPortals(const InputPortalType &inPortal, const OutputPortalType &outPortal, vtkm::Id inOffset, vtkm::Id outOffset, vtkm::Id numValues)
Definition: FunctorsTBB.h:146
vtkm::cont::LogLevel::Perf
@ Perf
General timing data and algorithm flow information, such as filter execution, worklet dispatches,...
vtkm::cont::DeviceAdapterTimerImplementation< vtkm::cont::DeviceAdapterTagTBB >::Reset
VTKM_CONT void Reset()
Definition: DeviceAdapterAlgorithmTBB.h:363