Viskores  1.0
DeviceAdapterAlgorithmTBB.h
Go to the documentation of this file.
1 //============================================================================
2 // The contents of this file are covered by the Viskores license. See
3 // LICENSE.txt for details.
4 //
5 // By contributing to this file, all contributors agree to the Developer
6 // Certificate of Origin Version 1.1 (DCO 1.1) as stated in DCO.txt.
7 //============================================================================
8 
9 //============================================================================
10 // Copyright (c) Kitware, Inc.
11 // All rights reserved.
12 // See LICENSE.txt for details.
13 //
14 // This software is distributed WITHOUT ANY WARRANTY; without even
15 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 // PURPOSE. See the above copyright notice for more information.
17 //============================================================================
18 #ifndef viskores_cont_tbb_internal_DeviceAdapterAlgorithmTBB_h
19 #define viskores_cont_tbb_internal_DeviceAdapterAlgorithmTBB_h
20 
26 #include <viskores/cont/Logging.h>
32 
34 
35 namespace viskores
36 {
37 namespace cont
38 {
39 
40 template <>
42  : viskores::cont::internal::DeviceAdapterAlgorithmGeneral<
43  DeviceAdapterAlgorithm<viskores::cont::DeviceAdapterTagTBB>,
44  viskores::cont::DeviceAdapterTagTBB>
45 {
46 public:
47  template <typename T, typename U, class CIn, class COut>
50  {
52 
54 
55  const viskores::Id inSize = input.GetNumberOfValues();
56  auto inputPortal = input.PrepareForInput(DeviceAdapterTagTBB(), token);
57  auto outputPortal = output.PrepareForOutput(inSize, DeviceAdapterTagTBB(), token);
58 
59  tbb::CopyPortals(inputPortal, outputPortal, 0, 0, inSize);
60  }
61 
62  template <typename T, typename U, class CIn, class CStencil, class COut>
66  {
68 
69  ::viskores::NotZeroInitialized unary_predicate;
70  CopyIf(input, stencil, output, unary_predicate);
71  }
72 
73  template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
77  UnaryPredicate unary_predicate)
78  {
80 
82 
83  viskores::Id inputSize = input.GetNumberOfValues();
84  VISKORES_ASSERT(inputSize == stencil.GetNumberOfValues());
85  viskores::Id outputSize =
87  stencil.PrepareForInput(DeviceAdapterTagTBB(), token),
88  output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
89  unary_predicate);
90  token.DetachFromAll();
91  output.Allocate(outputSize, viskores::CopyFlag::On);
92  }
93 
94  template <typename T, typename U, class CIn, class COut>
96  viskores::Id inputStartIndex,
97  viskores::Id numberOfElementsToCopy,
99  viskores::Id outputIndex = 0)
100  {
102 
103  const viskores::Id inSize = input.GetNumberOfValues();
104 
105  // Check if the ranges overlap and fail if they do.
106  if (input == output &&
107  ((outputIndex >= inputStartIndex &&
108  outputIndex < inputStartIndex + numberOfElementsToCopy) ||
109  (inputStartIndex >= outputIndex &&
110  inputStartIndex < outputIndex + numberOfElementsToCopy)))
111  {
112  return false;
113  }
114 
115  if (inputStartIndex < 0 || numberOfElementsToCopy < 0 || outputIndex < 0 ||
116  inputStartIndex >= inSize)
117  { //invalid parameters
118  return false;
119  }
120 
121  //determine if the numberOfElementsToCopy needs to be reduced
122  if (inSize < (inputStartIndex + numberOfElementsToCopy))
123  { //adjust the size
124  numberOfElementsToCopy = (inSize - inputStartIndex);
125  }
126 
127  const viskores::Id outSize = output.GetNumberOfValues();
128  const viskores::Id copyOutEnd = outputIndex + numberOfElementsToCopy;
129  if (outSize < copyOutEnd)
130  { //output is not large enough
131  if (outSize == 0)
132  { //since output has nothing, just need to allocate to correct length
133  output.Allocate(copyOutEnd);
134  }
135  else
136  { //we currently have data in this array, so preserve it in the new
137  //resized array
139  temp.Allocate(copyOutEnd);
140  CopySubRange(output, 0, outSize, temp);
141  output = temp;
142  }
143  }
144 
145  viskores::cont::Token token;
146  auto inputPortal = input.PrepareForInput(DeviceAdapterTagTBB(), token);
147  auto outputPortal = output.PrepareForInPlace(DeviceAdapterTagTBB(), token);
148 
150  inputPortal, outputPortal, inputStartIndex, outputIndex, numberOfElementsToCopy);
151 
152  return true;
153  }
154 
155  template <typename T, typename U, class CIn>
156  VISKORES_CONT static auto Reduce(const viskores::cont::ArrayHandle<T, CIn>& input, U initialValue)
157  -> decltype(Reduce(input, initialValue, viskores::Add{}))
158  {
160 
161  return Reduce(input, initialValue, viskores::Add());
162  }
163 
164  template <typename T, typename U, class CIn, class BinaryFunctor>
166  U initialValue,
167  BinaryFunctor binary_functor)
168  -> decltype(tbb::ReducePortals(input.ReadPortal(), initialValue, binary_functor))
169  {
171 
172  viskores::cont::Token token;
173  return tbb::ReducePortals(input.PrepareForInput(viskores::cont::DeviceAdapterTagTBB(), token),
174  initialValue,
175  binary_functor);
176  }
177 
178  template <typename T,
179  typename U,
180  class CKeyIn,
181  class CValIn,
182  class CKeyOut,
183  class CValOut,
184  class BinaryFunctor>
189  BinaryFunctor binary_functor)
190  {
192 
193  viskores::cont::Token token;
194 
195  viskores::Id inputSize = keys.GetNumberOfValues();
196  VISKORES_ASSERT(inputSize == values.GetNumberOfValues());
198  keys.PrepareForInput(DeviceAdapterTagTBB(), token),
199  values.PrepareForInput(DeviceAdapterTagTBB(), token),
200  keys_output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
201  values_output.PrepareForOutput(inputSize, DeviceAdapterTagTBB(), token),
202  binary_functor);
203  token.DetachFromAll();
204  keys_output.Allocate(outputSize, viskores::CopyFlag::On);
205  values_output.Allocate(outputSize, viskores::CopyFlag::On);
206  }
207 
208  template <typename T, class CIn, class COut>
211  {
213 
214  viskores::cont::Token token;
215  return tbb::ScanInclusivePortals(
217  output.PrepareForOutput(
219  viskores::Add());
220  }
221 
222  template <typename T, class CIn, class COut, class BinaryFunctor>
225  BinaryFunctor binary_functor)
226  {
228 
229  viskores::cont::Token token;
230  return tbb::ScanInclusivePortals(
232  output.PrepareForOutput(
234  binary_functor);
235  }
236 
237  template <typename T, class CIn, class COut>
240  {
242 
243  viskores::cont::Token token;
244  return tbb::ScanExclusivePortals(
246  output.PrepareForOutput(
248  viskores::Add(),
250  }
251 
252  template <typename T, class CIn, class COut, class BinaryFunctor>
255  BinaryFunctor binary_functor,
256  const T& initialValue)
257  {
259 
260  viskores::cont::Token token;
261  return tbb::ScanExclusivePortals(
263  output.PrepareForOutput(
265  binary_functor,
266  initialValue);
267  }
268 
269  VISKORES_CONT_EXPORT static void ScheduleTask(
270  viskores::exec::tbb::internal::TaskTiling1D& functor,
271  viskores::Id size);
272  VISKORES_CONT_EXPORT static void ScheduleTask(
273  viskores::exec::tbb::internal::TaskTiling3D& functor,
274  viskores::Id3 size);
275 
276  template <typename Hints, typename FunctorType>
277  VISKORES_CONT static inline void Schedule(Hints, FunctorType functor, viskores::Id numInstances)
278  {
280  "Schedule TBB 1D: '%s'",
281  viskores::cont::TypeToString(functor).c_str());
282 
283  viskores::exec::tbb::internal::TaskTiling1D kernel(functor);
284  ScheduleTask(kernel, numInstances);
285  }
286 
287  template <typename FunctorType>
288  VISKORES_CONT static inline void Schedule(FunctorType&& functor, viskores::Id numInstances)
289  {
290  Schedule(viskores::cont::internal::HintList<>{}, functor, numInstances);
291  }
292 
293  template <typename Hints, typename FunctorType>
294  VISKORES_CONT static inline void Schedule(Hints, FunctorType functor, viskores::Id3 rangeMax)
295  {
297  "Schedule TBB 3D: '%s'",
298  viskores::cont::TypeToString(functor).c_str());
299 
300  viskores::exec::tbb::internal::TaskTiling3D kernel(functor);
301  ScheduleTask(kernel, rangeMax);
302  }
303 
304  template <typename FunctorType>
305  VISKORES_CONT static inline void Schedule(FunctorType&& functor, viskores::Id3 rangeMax)
306  {
307  Schedule(viskores::cont::internal::HintList<>{}, functor, rangeMax);
308  }
309 
310  //1. We need functions for each of the following
311 
312 
313  template <typename T, class Container>
315  {
317 
318  //this is required to get sort to work with zip handles
319  std::less<T> lessOp;
321  }
322 
323  template <typename T, class Container, class BinaryCompare>
325  BinaryCompare binary_compare)
326  {
328 
329  viskores::cont::tbb::sort::parallel_sort(values, binary_compare);
330  }
331 
332  template <typename T, typename U, class StorageT, class StorageU>
335  {
337 
338  viskores::cont::tbb::sort::parallel_sort_bykey(keys, values, std::less<T>());
339  }
340 
341  template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
344  BinaryCompare binary_compare)
345  {
347 
348  viskores::cont::tbb::sort::parallel_sort_bykey(keys, values, binary_compare);
349  }
350 
351  template <typename T, class Storage>
353  {
354  Unique(values, std::equal_to<T>());
355  }
356 
357  template <typename T, class Storage, class BinaryCompare>
359  BinaryCompare binary_compare)
360  {
362 
363  viskores::Id outputSize;
364  {
365  viskores::cont::Token token;
366  outputSize =
367  tbb::UniquePortals(values.PrepareForInPlace(DeviceAdapterTagTBB(), token), binary_compare);
368  }
369  values.Allocate(outputSize, viskores::CopyFlag::On);
370  }
371 
373  {
374  // Nothing to do. This device schedules all of its operations using a
375  // split/join paradigm. This means that the if the control threaad is
376  // calling this method, then nothing should be running in the execution
377  // environment.
378  }
379 };
380 
383 template <>
385 {
386 public:
388 
390  {
391  this->StartReady = false;
392  this->StopReady = false;
393  }
394 
396  {
397  this->Reset();
398  this->StartTime = this->GetCurrentTime();
399  this->StartReady = true;
400  }
401 
403  {
404  this->StopTime = this->GetCurrentTime();
405  this->StopReady = true;
406  }
407 
408  VISKORES_CONT bool Started() const { return this->StartReady; }
409 
410  VISKORES_CONT bool Stopped() const { return this->StopReady; }
411 
412  VISKORES_CONT bool Ready() const { return true; }
413 
415  {
416  assert(this->StartReady);
417  if (!this->StartReady)
418  {
420  "Start() function should be called first then trying to call Stop() and"
421  " GetElapsedTime().");
422  return 0;
423  }
424 
425  ::tbb::tick_count startTime = this->StartTime;
426  ::tbb::tick_count stopTime = this->StopReady ? this->StopTime : this->GetCurrentTime();
427 
428  ::tbb::tick_count::interval_t elapsedTime = stopTime - startTime;
429 
430  return static_cast<viskores::Float64>(elapsedTime.seconds());
431  }
432 
433  VISKORES_CONT::tbb::tick_count GetCurrentTime() const
434  {
436  return ::tbb::tick_count::now();
437  }
438 
439 private:
441  bool StopReady;
442  ::tbb::tick_count StartTime;
443  ::tbb::tick_count StopTime;
444 };
445 
446 template <>
448 {
449 public:
450  template <typename Hints, typename WorkletType, typename InvocationType>
451  static viskores::exec::tbb::internal::TaskTiling1D MakeTask(WorkletType& worklet,
452  InvocationType& invocation,
453  viskores::Id,
454  Hints = Hints{})
455  {
456  // Currently ignoring hints.
457  return viskores::exec::tbb::internal::TaskTiling1D(worklet, invocation);
458  }
459 
460  template <typename Hints, typename WorkletType, typename InvocationType>
461  static viskores::exec::tbb::internal::TaskTiling3D MakeTask(WorkletType& worklet,
462  InvocationType& invocation,
464  Hints = Hints{})
465  {
466  // Currently ignoring hints.
467  return viskores::exec::tbb::internal::TaskTiling3D(worklet, invocation);
468  }
469 
470  template <typename WorkletType, typename InvocationType, typename RangeType>
471  VISKORES_CONT static auto MakeTask(WorkletType& worklet,
472  InvocationType& invocation,
473  const RangeType& range)
474  {
475  return MakeTask<viskores::cont::internal::HintList<>>(worklet, invocation, range);
476  }
477 };
478 }
479 } // namespace viskores::cont
480 
481 #endif //viskores_cont_tbb_internal_DeviceAdapterAlgorithmTBB_h
viskores::cont::DeviceAdapterAlgorithm::CopyIf
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output)
Conditionally copy elements in the input array to the output array.
viskores::cont::DeviceAdapterAlgorithm
Struct containing device adapter algorithms.
Definition: DeviceAdapterAlgorithm.h:49
viskores::cont::LogLevel::Error
@ Error
Important but non-fatal errors, such as device fail-over.
viskores::cont::tbb::CopyIfPortals
viskores::Id CopyIfPortals(InputPortalType inputPortal, StencilPortalType stencilPortal, OutputPortalType outputPortal, UnaryPredicateType unaryPredicate)
Definition: FunctorsTBB.h:358
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Started
bool Started() const
Definition: DeviceAdapterAlgorithmTBB.h:408
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Ready
bool Ready() const
Definition: DeviceAdapterAlgorithmTBB.h:412
ArrayHandle.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:209
VISKORES_LOG_SCOPE
#define VISKORES_LOG_SCOPE(level,...)
Definition: Logging.h:219
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::StartReady
bool StartReady
Definition: DeviceAdapterAlgorithmTBB.h:440
viskores::cont::DeviceAdapterTimerImplementation::GetCurrentTime
TimeStamp GetCurrentTime() const
Definition: DeviceAdapterAlgorithm.h:695
viskores::cont::ArrayHandle::PrepareForInput
ReadPortalType PrepareForInput(viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
Prepares this array to be used as an input to an operation in the execution environment.
Definition: ArrayHandle.h:615
DeviceAdapterTagTBB.h
DeviceAdapterAlgorithmGeneral.h
viskores::cont::DeviceAdapterTimerImplementation::StartReady
bool StartReady
Definition: DeviceAdapterAlgorithm.h:714
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Stopped
bool Stopped() const
Definition: DeviceAdapterAlgorithmTBB.h:410
IteratorFromArrayPortal.h
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Schedule
static void Schedule(FunctorType &&functor, viskores::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmTBB.h:305
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::CopySubRange
static bool CopySubRange(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfElementsToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Definition: DeviceAdapterAlgorithmTBB.h:95
viskores::cont::tbb::sort::parallel_sort
void parallel_sort(viskores::cont::ArrayHandle< T, Container > &, BinaryCompare)
Definition: ParallelSortTBB.h:87
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:358
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Stop
void Stop()
Definition: DeviceAdapterAlgorithmTBB.h:402
viskores::cont::DeviceAdapterAlgorithm::U
static T U
Definition: DeviceAdapterAlgorithm.h:358
viskores::cont::DeviceAdapterTimerImplementation::Reset
void Reset()
Resets the timer.
Definition: DeviceAdapterAlgorithm.h:642
DeviceAdapterAlgorithm.h
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::GetCurrentTime
::tbb::tick_count GetCurrentTime() const
Definition: DeviceAdapterAlgorithmTBB.h:433
viskores::cont::DeviceAdapterAlgorithm::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Compute a accumulated sum operation on the input ArrayHandle.
viskores::Add
Definition: Types.h:268
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::CopyIf
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output, UnaryPredicate unary_predicate)
Definition: DeviceAdapterAlgorithmTBB.h:74
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Schedule
static void Schedule(Hints, FunctorType functor, viskores::Id numInstances)
Definition: DeviceAdapterAlgorithmTBB.h:277
ArrayHandleZip.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:342
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Sort
static void Sort(viskores::cont::ArrayHandle< T, Container > &values)
Definition: DeviceAdapterAlgorithmTBB.h:314
viskores::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in Viskores...
Definition: TypeTraits.h:69
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagTBB >::MakeTask
static viskores::exec::tbb::internal::TaskTiling3D MakeTask(WorkletType &worklet, InvocationType &invocation, viskores::Id3, Hints=Hints{})
Definition: DeviceAdapterAlgorithmTBB.h:461
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Copy
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:48
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::cont::DeviceAdapterAlgorithm::CopySubRange
static bool CopySubRange(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfElementsToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Copy the contents of a section of one ArrayHandle to another.
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::ReduceByKey
static void ReduceByKey(const viskores::cont::ArrayHandle< T, CKeyIn > &keys, const viskores::cont::ArrayHandle< U, CValIn > &values, viskores::cont::ArrayHandle< T, CKeyOut > &keys_output, viskores::cont::ArrayHandle< U, CValOut > &values_output, BinaryFunctor binary_functor)
Definition: DeviceAdapterAlgorithmTBB.h:185
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor)
Definition: DeviceAdapterAlgorithmTBB.h:223
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::NotZeroInitialized
Predicate that takes a single argument x, and returns True if it isn't the identity of the Type T.
Definition: UnaryPredicates.h:40
viskores::cont::tbb::CopyPortals
void CopyPortals(const InputPortalType &inPortal, const OutputPortalType &outPortal, viskores::Id inOffset, viskores::Id outOffset, viskores::Id numValues)
Definition: FunctorsTBB.h:154
viskores::cont::Token::DetachFromAll
void DetachFromAll()
Detaches this Token from all resources to allow them to be used elsewhere or deleted.
viskores::cont::ArrayHandle::PrepareForInPlace
WritePortalType PrepareForInPlace(viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
Prepares this array to be used in an in-place operation (both as input and output) in the execution e...
Definition: ArrayHandle.h:634
viskores::CopyFlag::On
@ On
ArrayHandleIndex.h
viskores::cont::DeviceAdapterTimerImplementation::StopTime
TimeStamp StopTime
Definition: DeviceAdapterAlgorithm.h:717
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::StartTime
::tbb::tick_count StartTime
Definition: DeviceAdapterAlgorithmTBB.h:442
viskores::cont::DeviceAdapterAlgorithm::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
FunctorsTBB.h
viskores::cont::ArrayHandle::Allocate
void Allocate(viskores::Id numberOfValues, viskores::CopyFlag preserve, viskores::cont::Token &token) const
Allocates an array large enough to hold the given number of values.
Definition: ArrayHandle.h:504
viskores::cont::tbb::sort::parallel_sort_bykey
void parallel_sort_bykey(viskores::cont::ArrayHandle< T, StorageT > &, viskores::cont::ArrayHandle< U, StorageU > &, BinaryCompare)
Definition: ParallelSortTBB.h:236
viskores::cont::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Start
void Start()
Definition: DeviceAdapterAlgorithmTBB.h:395
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Schedule
static void Schedule(Hints, FunctorType functor, viskores::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmTBB.h:294
viskores::cont::ArrayHandle::PrepareForOutput
WritePortalType PrepareForOutput(viskores::Id numberOfValues, viskores::cont::DeviceAdapterId device, viskores::cont::Token &token) const
Prepares (allocates) this array to be used as an output from an operation in the execution environmen...
Definition: ArrayHandle.h:654
VISKORES_ASSERT
#define VISKORES_ASSERT(condition)
Definition: Assert.h:51
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:238
TaskTiling.h
viskores::cont::DeviceAdapterTimerImplementation
Class providing a device-specific timer.
Definition: DeviceAdapterAlgorithm.h:625
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::Reset
void Reset()
Definition: DeviceAdapterAlgorithmTBB.h:389
viskores::cont::tbb::ReduceByKeyPortals
viskores::Id ReduceByKeyPortals(KeysInPortalType keysInPortal, ValuesInPortalType valuesInPortal, KeysOutPortalType keysOutPortal, ValuesOutPortalType valuesOutPortal, BinaryOperationType binaryOperation)
Definition: FunctorsTBB.h:801
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::CopyIf
static void CopyIf(const viskores::cont::ArrayHandle< T, CIn > &input, const viskores::cont::ArrayHandle< U, CStencil > &stencil, viskores::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmTBB.h:63
ErrorExecution.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Reduce
static auto Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor) -> decltype(tbb::ReducePortals(input.ReadPortal(), initialValue, binary_functor))
Definition: DeviceAdapterAlgorithmTBB.h:165
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagTBB >::MakeTask
static viskores::exec::tbb::internal::TaskTiling1D MakeTask(WorkletType &worklet, InvocationType &invocation, viskores::Id, Hints=Hints{})
Definition: DeviceAdapterAlgorithmTBB.h:451
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::DeviceAdapterTimerImplementation
DeviceAdapterTimerImplementation()
Definition: DeviceAdapterAlgorithmTBB.h:387
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Reduce
static auto Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue) -> decltype(Reduce(input, initialValue, viskores::Add
Definition: DeviceAdapterAlgorithmTBB.h:156
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: DeviceAdapterAlgorithmTBB.h:352
VISKORES_LOG_S
#define VISKORES_LOG_S(level,...)
Writes a message using stream syntax to the indicated log level.
Definition: Logging.h:216
viskores::cont::DeviceAdapterTagTBB
Tag for a device adapter that uses the Intel Threading Building Blocks library to run algorithms on m...
Definition: DeviceAdapterTagTBB.h:37
viskores::cont::DeviceAdapterTimerImplementation::StartTime
TimeStamp StartTime
Definition: DeviceAdapterAlgorithm.h:716
VISKORES_LOG_SCOPE_FUNCTION
#define VISKORES_LOG_SCOPE_FUNCTION(level)
Definition: Logging.h:225
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Sort
static void Sort(viskores::cont::ArrayHandle< T, Container > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmTBB.h:324
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::StopReady
bool StopReady
Definition: DeviceAdapterAlgorithmTBB.h:441
viskores::cont::LogLevel::Perf
@ Perf
General timing data and algorithm flow information, such as filter execution, worklet dispatches,...
viskores::cont::DeviceTaskTypes
Class providing a device-specific support for selecting the optimal Task type for a given worklet.
Definition: DeviceAdapterAlgorithm.h:757
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Synchronize
static void Synchronize()
Definition: DeviceAdapterAlgorithmTBB.h:372
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagTBB >::MakeTask
static auto MakeTask(WorkletType &worklet, InvocationType &invocation, const RangeType &range)
Definition: DeviceAdapterAlgorithmTBB.h:471
Logging.h
Logging utilities.
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binary_functor, const T &initialValue)
Definition: DeviceAdapterAlgorithmTBB.h:253
ParallelSortTBB.h
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::StopTime
::tbb::tick_count StopTime
Definition: DeviceAdapterAlgorithmTBB.h:443
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: DeviceAdapterAlgorithmTBB.h:333
viskores::Float64
double Float64
Base type to use for 64-bit floating-point numbers.
Definition: Types.h:169
viskores::Vec< viskores::Id, 3 >
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagTBB >::Schedule
static void Schedule(FunctorType &&functor, viskores::Id numInstances)
Definition: DeviceAdapterAlgorithmTBB.h:288
viskores::cont::tbb::UniquePortals
viskores::Id UniquePortals(PortalType portal, BinaryOperationType binaryOperation)
Definition: FunctorsTBB.h:1381
viskores::cont::TypeToString
std::string TypeToString(const std::type_info &t)
Use RTTI information to retrieve the name of the type T.
viskores::cont::DeviceAdapterAlgorithm::Schedule
static void Schedule(Functor functor, viskores::Id numInstances)
Schedule many instances of a function to run on concurrent threads.
viskores::cont::DeviceAdapterTimerImplementation< viskores::cont::DeviceAdapterTagTBB >::GetElapsedTime
viskores::Float64 GetElapsedTime() const
Definition: DeviceAdapterAlgorithmTBB.h:414
viskores::cont::DeviceAdapterTimerImplementation::StopReady
bool StopReady
Definition: DeviceAdapterAlgorithm.h:715