Viskores  1.0
DeviceAdapterAlgorithmOpenMP.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_openmp_internal_DeviceAdapterAlgorithmOpenMP_h
19 #define viskores_cont_openmp_internal_DeviceAdapterAlgorithmOpenMP_h
20 
22 #include <viskores/cont/Error.h>
23 #include <viskores/cont/Logging.h>
25 
31 
32 #include <omp.h>
33 
34 #include <algorithm>
35 #include <type_traits>
36 
37 namespace viskores
38 {
39 namespace cont
40 {
41 
42 template <>
44  : viskores::cont::internal::DeviceAdapterAlgorithmGeneral<
45  DeviceAdapterAlgorithm<viskores::cont::DeviceAdapterTagOpenMP>,
46  viskores::cont::DeviceAdapterTagOpenMP>
47 {
49 
50 public:
51  template <typename T, typename U, class CIn, class COut>
54  {
56 
57  using namespace viskores::cont::openmp;
58 
59  const viskores::Id inSize = input.GetNumberOfValues();
60  if (inSize == 0)
61  {
62  output.Allocate(0);
63  return;
64  }
66  auto inputPortal = input.PrepareForInput(DevTag(), token);
67  auto outputPortal = output.PrepareForOutput(inSize, DevTag(), token);
68  CopyHelper(inputPortal, outputPortal, 0, 0, inSize);
69  }
70 
71  template <typename T, typename U, class CIn, class CStencil, class COut>
75  {
77 
78  ::viskores::NotZeroInitialized unary_predicate;
79  CopyIf(input, stencil, output, unary_predicate);
80  }
81 
82  template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
86  UnaryPredicate unary_predicate)
87  {
89 
90  using namespace viskores::cont::openmp;
91 
92  viskores::Id inSize = input.GetNumberOfValues();
93  if (inSize == 0)
94  {
95  output.Allocate(0);
96  return;
97  }
99  auto inputPortal = input.PrepareForInput(DevTag(), token);
100  auto stencilPortal = stencil.PrepareForInput(DevTag(), token);
101  auto outputPortal = output.PrepareForOutput(inSize, DevTag(), token);
102 
103  auto inIter = viskores::cont::ArrayPortalToIteratorBegin(inputPortal);
104  auto stencilIter = viskores::cont::ArrayPortalToIteratorBegin(stencilPortal);
105  auto outIter = viskores::cont::ArrayPortalToIteratorBegin(outputPortal);
106 
107  CopyIfHelper helper;
108  helper.Initialize(inSize, sizeof(T));
109 
110  VISKORES_OPENMP_DIRECTIVE(parallel default(shared))
111  {
112  VISKORES_OPENMP_DIRECTIVE(for schedule(static))
113  for (viskores::Id i = 0; i < helper.NumChunks; ++i)
114  {
115  helper.CopyIf(inIter, stencilIter, outIter, unary_predicate, i);
116  }
117  }
118 
119  viskores::Id numValues = helper.Reduce(outIter);
120  token.DetachFromAll();
121  output.Allocate(numValues, viskores::CopyFlag::On);
122  }
123 
124 
125  template <typename T, typename U, class CIn, class COut>
127  viskores::Id inputStartIndex,
128  viskores::Id numberOfValuesToCopy,
130  viskores::Id outputIndex = 0)
131  {
133 
134  using namespace viskores::cont::openmp;
135 
136  const viskores::Id inSize = input.GetNumberOfValues();
137 
138  // Check if the ranges overlap and fail if they do.
139  if (input == output &&
140  ((outputIndex >= inputStartIndex && outputIndex < inputStartIndex + numberOfValuesToCopy) ||
141  (inputStartIndex >= outputIndex && inputStartIndex < outputIndex + numberOfValuesToCopy)))
142  {
143  return false;
144  }
145 
146  if (inputStartIndex < 0 || numberOfValuesToCopy < 0 || outputIndex < 0 ||
147  inputStartIndex >= inSize)
148  { //invalid parameters
149  return false;
150  }
151 
152  //determine if the numberOfElementsToCopy needs to be reduced
153  if (inSize < (inputStartIndex + numberOfValuesToCopy))
154  { //adjust the size
155  numberOfValuesToCopy = (inSize - inputStartIndex);
156  }
157 
158  const viskores::Id outSize = output.GetNumberOfValues();
159  const viskores::Id copyOutEnd = outputIndex + numberOfValuesToCopy;
160  if (outSize < copyOutEnd)
161  { //output is not large enough
162  if (outSize == 0)
163  { //since output has nothing, just need to allocate to correct length
164  output.Allocate(copyOutEnd);
165  }
166  else
167  { //we currently have data in this array, so preserve it in the new
168  //resized array
170  temp.Allocate(copyOutEnd);
171  CopySubRange(output, 0, outSize, temp);
172  output = temp;
173  }
174  }
175 
176  viskores::cont::Token token;
177  auto inputPortal = input.PrepareForInput(DevTag(), token);
178  auto outputPortal = output.PrepareForInPlace(DevTag(), token);
179 
180  CopyHelper(inputPortal, outputPortal, inputStartIndex, outputIndex, numberOfValuesToCopy);
181 
182  return true;
183  }
184 
185  template <typename T, typename U, class CIn>
186  VISKORES_CONT static U Reduce(const viskores::cont::ArrayHandle<T, CIn>& input, U initialValue)
187  {
189 
190  return Reduce(input, initialValue, viskores::Add());
191  }
192 
193  template <typename T, typename U, class CIn, class BinaryFunctor>
195  U initialValue,
196  BinaryFunctor binary_functor)
197  {
199 
200  using namespace viskores::cont::openmp;
201 
202  viskores::cont::Token token;
203  auto portal = input.PrepareForInput(DevTag(), token);
205 
206  return ReduceHelper::Execute(portal, initialValue, binary_functor, fastPath);
207  }
208 
209  template <typename T,
210  typename U,
211  class CKeyIn,
212  class CValIn,
213  class CKeyOut,
214  class CValOut,
215  class BinaryFunctor>
220  BinaryFunctor func)
221  {
223 
224  openmp::ReduceByKeyHelper(keys, values, keys_output, values_output, func);
225  }
226 
227  template <typename T, class CIn, class COut>
230  {
232 
233  return ScanInclusive(input, output, viskores::Add());
234  }
235 
236  template <typename T, class CIn, class COut, class BinaryFunctor>
239  BinaryFunctor binaryFunctor)
240  {
242 
243  if (input.GetNumberOfValues() <= 0)
244  {
246  }
247 
248  viskores::cont::Token token;
249  using InPortalT = decltype(input.PrepareForInput(DevTag(), token));
250  using OutPortalT = decltype(output.PrepareForOutput(0, DevTag(), token));
252 
253  viskores::Id numVals = input.GetNumberOfValues();
254  Impl impl(input.PrepareForInput(DevTag(), token),
255  output.PrepareForOutput(numVals, DevTag(), token),
256  binaryFunctor);
257 
258  return impl.Execute(viskores::Id2(0, numVals));
259  }
260 
261  template <typename T, class CIn, class COut>
264  {
266 
267  return ScanExclusive(
269  }
270 
271  template <typename T, class CIn, class COut, class BinaryFunctor>
274  BinaryFunctor binaryFunctor,
275  const T& initialValue)
276  {
278 
279  if (input.GetNumberOfValues() <= 0)
280  {
281  return initialValue;
282  }
283 
284  viskores::cont::Token token;
285  using InPortalT = decltype(input.PrepareForInput(DevTag(), token));
286  using OutPortalT = decltype(output.PrepareForOutput(0, DevTag(), token));
288 
289  viskores::Id numVals = input.GetNumberOfValues();
290  Impl impl(input.PrepareForInput(DevTag(), token),
291  output.PrepareForOutput(numVals, DevTag(), token),
292  binaryFunctor,
293  initialValue);
294 
295  return impl.Execute(viskores::Id2(0, numVals));
296  }
297 
303  template <typename T, class Storage>
305  {
307 
308  Sort(values, viskores::SortLess());
309  }
310 
311  template <typename T, class Storage, class BinaryCompare>
313  BinaryCompare binary_compare)
314  {
316 
317  openmp::sort::parallel_sort(values, binary_compare);
318  }
319 
320  template <typename T, typename U, class StorageT, class StorageU>
323  {
325 
326  SortByKey(keys, values, std::less<T>());
327  }
328 
329  template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
332  BinaryCompare binary_compare)
333  {
335 
336  openmp::sort::parallel_sort_bykey(keys, values, binary_compare);
337  }
338 
339  template <typename T, class Storage>
341  {
343 
344  Unique(values, std::equal_to<T>());
345  }
346 
347  template <typename T, class Storage, class BinaryCompare>
349  BinaryCompare binary_compare)
350  {
352 
353  viskores::cont::Token token;
354  auto portal = values.PrepareForInPlace(DevTag(), token);
355  auto iter = viskores::cont::ArrayPortalToIteratorBegin(portal);
356 
357  using IterT = typename std::decay<decltype(iter)>::type;
359 
360  Uniqifier uniquifier(iter, portal.GetNumberOfValues(), binary_compare);
361  viskores::Id outSize = uniquifier.Execute();
362  token.DetachFromAll();
363  values.Allocate(outSize, viskores::CopyFlag::On);
364  }
365 
366  VISKORES_CONT_EXPORT static void ScheduleTask(
367  viskores::exec::openmp::internal::TaskTiling1D& functor,
368  viskores::Id size);
369  VISKORES_CONT_EXPORT static void ScheduleTask(
370  viskores::exec::openmp::internal::TaskTiling3D& functor,
371  viskores::Id3 size);
372 
373  template <typename Hints, typename FunctorType>
374  VISKORES_CONT static inline void Schedule(Hints, FunctorType functor, viskores::Id numInstances)
375  {
377 
378  viskores::exec::openmp::internal::TaskTiling1D kernel(functor);
379  ScheduleTask(kernel, numInstances);
380  }
381 
382  template <typename FunctorType>
383  VISKORES_CONT static inline void Schedule(FunctorType&& functor, viskores::Id numInstances)
384  {
385  Schedule(viskores::cont::internal::HintList<>{}, functor, numInstances);
386  }
387 
388  template <typename Hints, typename FunctorType>
389  VISKORES_CONT static inline void Schedule(Hints, FunctorType functor, viskores::Id3 rangeMax)
390  {
392 
393  viskores::exec::openmp::internal::TaskTiling3D kernel(functor);
394  ScheduleTask(kernel, rangeMax);
395  }
396 
397  template <typename FunctorType>
398  VISKORES_CONT static inline void Schedule(FunctorType&& functor, viskores::Id3 rangeMax)
399  {
400  Schedule(viskores::cont::internal::HintList<>{}, functor, rangeMax);
401  }
402 
404  {
405  // Nothing to do. This device schedules all of its operations using a
406  // split/join paradigm. This means that the if the control thread is
407  // calling this method, then nothing should be running in the execution
408  // environment.
409  }
410 };
411 
412 template <>
414 {
415 public:
416  template <typename Hints, typename WorkletType, typename InvocationType>
417  static viskores::exec::openmp::internal::TaskTiling1D MakeTask(const WorkletType& worklet,
418  const InvocationType& invocation,
419  viskores::Id,
420  Hints = Hints{})
421  {
422  // Currently ignoring hints.
423  return viskores::exec::openmp::internal::TaskTiling1D(worklet, invocation);
424  }
425 
426  template <typename Hints, typename WorkletType, typename InvocationType>
427  static viskores::exec::openmp::internal::TaskTiling3D MakeTask(const WorkletType& worklet,
428  const InvocationType& invocation,
430  Hints = Hints{})
431  {
432  // Currently ignoring hints.
433  return viskores::exec::openmp::internal::TaskTiling3D(worklet, invocation);
434  }
435 
436  template <typename WorkletType, typename InvocationType, typename RangeType>
437  VISKORES_CONT static auto MakeTask(WorkletType& worklet,
438  InvocationType& invocation,
439  const RangeType& range)
440  {
441  return MakeTask<viskores::cont::internal::HintList<>>(worklet, invocation, range);
442  }
443 };
444 }
445 } // namespace viskores::cont
446 
447 #endif //viskores_cont_openmp_internal_DeviceAdapterAlgorithmOpenMP_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::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor, const T &initialValue)
Definition: DeviceAdapterAlgorithmOpenMP.h:272
viskores::cont::openmp::sort::parallel_sort_bykey
void parallel_sort_bykey(viskores::cont::ArrayHandle< T, StorageT > &, viskores::cont::ArrayHandle< U, StorageU > &, BinaryCompare)
Definition: ParallelSortOpenMP.h:255
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Schedule
static void Schedule(Hints, FunctorType functor, viskores::Id numInstances)
Definition: DeviceAdapterAlgorithmOpenMP.h:374
viskores::SortLess
Binary Predicate that takes two arguments argument x, and y and returns True if and only if x is less...
Definition: BinaryPredicates.h:53
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Synchronize
static void Synchronize()
Definition: DeviceAdapterAlgorithmOpenMP.h:403
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmOpenMP.h:330
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
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagOpenMP >::MakeTask
static viskores::exec::openmp::internal::TaskTiling3D MakeTask(const WorkletType &worklet, const InvocationType &invocation, viskores::Id3, Hints=Hints{})
Definition: DeviceAdapterAlgorithmOpenMP.h:427
viskores::TypeTraits::ZeroInitialization
static T ZeroInitialization()
A static function that returns 0 (or the closest equivalent to it) for the given type.
Definition: TypeTraits.h:85
DeviceAdapterAlgorithmGeneral.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue, BinaryFunctor binary_functor)
Definition: DeviceAdapterAlgorithmOpenMP.h:194
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Definition: DeviceAdapterAlgorithmOpenMP.h:340
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagOpenMP >::MakeTask
static viskores::exec::openmp::internal::TaskTiling1D MakeTask(const WorkletType &worklet, const InvocationType &invocation, viskores::Id, Hints=Hints{})
Definition: DeviceAdapterAlgorithmOpenMP.h:417
viskores::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:313
FunctorsOpenMP.h
viskores::cont::openmp::CopyIfHelper::Reduce
viskores::Id Reduce(OutIterT data)
Definition: FunctorsOpenMP.h:244
viskores::cont::DeviceAdapterAlgorithm::U
static T U
Definition: DeviceAdapterAlgorithm.h:358
VISKORES_OPENMP_DIRECTIVE
#define VISKORES_OPENMP_DIRECTIVE(directive)
Definition: FunctorsOpenMP.h:45
viskores::cont::openmp
OPenMP implementation for Control Environment.
Definition: FunctorsOpenMP.h:71
DeviceAdapterAlgorithm.h
viskores::cont::DeviceAdapterAlgorithm::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an exclusive prefix sum operation on the input ArrayHandle.
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::cont::DeviceAdapterAlgorithm::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values)
Unstable ascending sort of input array.
Definition: DeviceAdapterAlgorithmOpenMP.h:304
viskores::Add
Definition: Types.h:268
viskores::cont::DeviceTaskTypes< viskores::cont::DeviceAdapterTagOpenMP >::MakeTask
static auto MakeTask(WorkletType &worklet, InvocationType &invocation, const RangeType &range)
Definition: DeviceAdapterAlgorithmOpenMP.h:437
viskores::cont::DeviceAdapterTagOpenMP
Tag for a device adapter that uses OpenMP compiler extensions to run algorithms on multiple threads.
Definition: DeviceAdapterTagOpenMP.h:35
viskores::cont::openmp::CopyIfHelper::CopyIf
void CopyIf(InIterT inIter, StencilIterT stencilIter, OutIterT outIter, PredicateT pred, viskores::Id chunk)
Definition: FunctorsOpenMP.h:222
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Copy
static void Copy(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< U, COut > &output)
Definition: DeviceAdapterAlgorithmOpenMP.h:52
DeviceAdapterTagOpenMP.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmOpenMP.h:348
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::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: DeviceAdapterAlgorithmOpenMP.h:83
viskores::TypeTraits
The TypeTraits class provides helpful compile-time information about the basic types used in Viskores...
Definition: TypeTraits.h:69
viskores::Id
viskores::Int64 Id
Base type to use to index arrays.
Definition: Types.h:235
viskores::cont::openmp::sort::parallel_sort
void parallel_sort(viskores::cont::ArrayHandle< T, Container > &, BinaryCompare)
Definition: ParallelSortOpenMP.h:83
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::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output, BinaryFunctor binaryFunctor)
Definition: DeviceAdapterAlgorithmOpenMP.h:237
viskores::cont::DeviceAdapterAlgorithm::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Unstable ascending sort of keys and values.
VISKORES_CONT
#define VISKORES_CONT
Definition: ExportMacros.h:65
viskores
Groups connected points that have the same field value.
Definition: Atomic.h:27
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::CopySubRange
static bool CopySubRange(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::Id inputStartIndex, viskores::Id numberOfValuesToCopy, viskores::cont::ArrayHandle< U, COut > &output, viskores::Id outputIndex=0)
Definition: DeviceAdapterAlgorithmOpenMP.h:126
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::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::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: DeviceAdapterAlgorithmOpenMP.h:72
viskores::cont::Token::DetachFromAll
void DetachFromAll()
Detaches this Token from all resources to allow them to be used elsewhere or deleted.
viskores::cont::openmp::CopyIfHelper::NumChunks
viskores::Id NumChunks
Definition: FunctorsOpenMP.h:199
viskores::cont::openmp::UniqueHelper
Definition: FunctorsOpenMP.h:644
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
viskores::cont::ArrayPortalToIteratorBegin
viskores::cont::ArrayPortalToIterators< PortalType >::IteratorType ArrayPortalToIteratorBegin(const PortalType &portal)
Convenience function for converting an ArrayPortal to a begin iterator.
Definition: ArrayPortalToIterators.h:189
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::ScanExclusive
static T ScanExclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmOpenMP.h:262
Error.h
viskores::cont::openmp::ReduceByKeyHelper
void ReduceByKeyHelper(KeysInArray keysInArray, ValuesInArray valuesInArray, KeysOutArray keysOutArray, ValuesOutArray valuesOutArray, BinaryFunctor functor)
Definition: FunctorsOpenMP.h:522
viskores::cont::DeviceAdapterAlgorithm::Unique
static void Unique(viskores::cont::ArrayHandle< T, Storage > &values)
Reduce an array to only the unique values it contains.
viskores::cont::DeviceAdapterAlgorithm::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Compute an inclusive prefix sum operation on the input ArrayHandle.
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::ArrayHandle::GetNumberOfValues
viskores::Id GetNumberOfValues() const
Returns the number of entries in the array.
Definition: ArrayHandle.h:482
ParallelScanOpenMP.h
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::cont::openmp::scan::Adder
Definition: ParallelScanOpenMP.h:64
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Schedule
static void Schedule(Hints, FunctorType functor, viskores::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmOpenMP.h:389
ParallelSortOpenMP.h
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Schedule
static void Schedule(FunctorType &&functor, viskores::Id numInstances)
Definition: DeviceAdapterAlgorithmOpenMP.h:383
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::SortByKey
static void SortByKey(viskores::cont::ArrayHandle< T, StorageT > &keys, viskores::cont::ArrayHandle< U, StorageU > &values)
Definition: DeviceAdapterAlgorithmOpenMP.h:321
VISKORES_LOG_SCOPE_FUNCTION
#define VISKORES_LOG_SCOPE_FUNCTION(level)
Definition: Logging.h:225
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::DeviceAdapterTagOpenMP >::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 func)
Definition: DeviceAdapterAlgorithmOpenMP.h:216
viskores::cont::openmp::CopyIfHelper
Definition: FunctorsOpenMP.h:193
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::ScanInclusive
static T ScanInclusive(const viskores::cont::ArrayHandle< T, CIn > &input, viskores::cont::ArrayHandle< T, COut > &output)
Definition: DeviceAdapterAlgorithmOpenMP.h:228
Logging.h
Logging utilities.
TaskTilingOpenMP.h
viskores::cont::openmp::OpenMPReductionSupported
std::false_type OpenMPReductionSupported
Definition: FunctorsOpenMP.h:311
viskores::Vec< viskores::Id, 2 >
viskores::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:43
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Reduce
static U Reduce(const viskores::cont::ArrayHandle< T, CIn > &input, U initialValue)
Definition: DeviceAdapterAlgorithmOpenMP.h:186
viskores::cont::openmp::CopyIfHelper::Initialize
void Initialize(viskores::Id numValues, viskores::Id valueSize)
Definition: FunctorsOpenMP.h:205
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Sort
static void Sort(viskores::cont::ArrayHandle< T, Storage > &values, BinaryCompare binary_compare)
Definition: DeviceAdapterAlgorithmOpenMP.h:312
viskores::cont::DeviceAdapterAlgorithm< viskores::cont::DeviceAdapterTagOpenMP >::Schedule
static void Schedule(FunctorType &&functor, viskores::Id3 rangeMax)
Definition: DeviceAdapterAlgorithmOpenMP.h:398
viskores::cont::DeviceAdapterAlgorithm::Schedule
static void Schedule(Functor functor, viskores::Id numInstances)
Schedule many instances of a function to run on concurrent threads.