mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Merge topic 'upgrade_algorithms_to_support_runtime_device'
59c8bd28a vtkm::cont::Algorithm now can be told which device to run on at runtime Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Kenneth Moreland <kmorel@sandia.gov> Merge-request: !1365
This commit is contained in:
commit
18fdc009a3
26
docs/changelog/agorithms_support_runtime_device.md
Normal file
26
docs/changelog/agorithms_support_runtime_device.md
Normal file
@ -0,0 +1,26 @@
|
||||
# vtkm::cont::Algorithm now can be told which device to use at runtime
|
||||
|
||||
The `vtkm::cont::Algorithm` has been extended to support the user specifying
|
||||
which device to use at runtime previously Algorithm would only use the first
|
||||
enabled device, requiring users to modify the `vtkm::cont::GlobalRuntimeDeviceTracker`
|
||||
if they wanted a specific device used.
|
||||
|
||||
To select a specific device with vtkm::cont::Algorithm pass the `vtkm::cont::DeviceAdapterId`
|
||||
as the first parameter.
|
||||
|
||||
```cpp
|
||||
vtkm::cont::ArrayHandle<double> values;
|
||||
|
||||
|
||||
//call with no tag, will run on first enabled device
|
||||
auto result = vtkm::cont::Algorithm::Reduce(values, 0.0);
|
||||
|
||||
//call with an explicit device tag, will only run on serial
|
||||
vtkm::cont::DeviceAdapterTagSerial serial;
|
||||
result = vtkm::cont::Algorithm::Reduce(serial, values, 0.0);
|
||||
|
||||
//call with an runtime device tag, will only run on serial
|
||||
vtkm::cont::DeviceAdapterId device = serial;
|
||||
result = vtkm::cont::Algorithm::Reduce(device, values, 0.0);
|
||||
|
||||
```
|
@ -317,30 +317,71 @@ struct UpperBoundsFunctor
|
||||
struct Algorithm
|
||||
{
|
||||
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
VTKM_CONT static void Copy(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<U, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::CopyFunctor(), input, output);
|
||||
}
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
VTKM_CONT static void Copy(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<U, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::CopyFunctor(), input, output);
|
||||
Copy(vtkm::cont::DeviceAdapterIdAny(), input, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class CIn, class CStencil, class COut>
|
||||
VTKM_CONT static void CopyIf(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<U, CStencil>& stencil,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::CopyIfFunctor(), input, stencil, output);
|
||||
}
|
||||
template <typename T, typename U, class CIn, class CStencil, class COut>
|
||||
VTKM_CONT static void CopyIf(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<U, CStencil>& stencil,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::CopyIfFunctor(), input, stencil, output);
|
||||
CopyIf(vtkm::cont::DeviceAdapterIdAny(), input, stencil, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
|
||||
VTKM_CONT static void CopyIf(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<U, CStencil>& stencil,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output,
|
||||
UnaryPredicate unary_predicate)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
|
||||
}
|
||||
template <typename T, typename U, class CIn, class CStencil, class COut, class UnaryPredicate>
|
||||
VTKM_CONT static 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)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::CopyIfFunctor(), input, stencil, output, unary_predicate);
|
||||
CopyIf(vtkm::cont::DeviceAdapterIdAny(), input, stencil, output, unary_predicate);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
VTKM_CONT static bool CopySubRange(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::Id inputStartIndex,
|
||||
vtkm::Id numberOfElementsToCopy,
|
||||
vtkm::cont::ArrayHandle<U, COut>& output,
|
||||
vtkm::Id outputIndex = 0)
|
||||
{
|
||||
detail::CopySubRangeFunctor functor;
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
|
||||
return functor.valid;
|
||||
}
|
||||
template <typename T, typename U, class CIn, class COut>
|
||||
VTKM_CONT static bool CopySubRange(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::Id inputStartIndex,
|
||||
@ -348,54 +389,124 @@ struct Algorithm
|
||||
vtkm::cont::ArrayHandle<U, COut>& output,
|
||||
vtkm::Id outputIndex = 0)
|
||||
{
|
||||
detail::CopySubRangeFunctor functor;
|
||||
vtkm::cont::TryExecute(
|
||||
functor, input, inputStartIndex, numberOfElementsToCopy, output, outputIndex);
|
||||
return functor.valid;
|
||||
return CopySubRange(vtkm::cont::DeviceAdapterIdAny(),
|
||||
input,
|
||||
inputStartIndex,
|
||||
numberOfElementsToCopy,
|
||||
output,
|
||||
outputIndex);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class CVal, class COut>
|
||||
VTKM_CONT static void LowerBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::LowerBoundsFunctor(), input, values, output);
|
||||
}
|
||||
template <typename T, class CIn, class CVal, class COut>
|
||||
VTKM_CONT static void LowerBounds(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::LowerBoundsFunctor(), input, values, output);
|
||||
LowerBounds(vtkm::cont::DeviceAdapterIdAny(), input, values, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
|
||||
VTKM_CONT static void LowerBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::LowerBoundsFunctor(), input, values, output, binary_compare);
|
||||
}
|
||||
template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
|
||||
VTKM_CONT static void LowerBounds(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::LowerBoundsFunctor(), input, values, output, binary_compare);
|
||||
LowerBounds(vtkm::cont::DeviceAdapterIdAny(), input, values, output, binary_compare);
|
||||
}
|
||||
|
||||
|
||||
template <class CIn, class COut>
|
||||
VTKM_CONT static void LowerBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::LowerBoundsFunctor(), input, values_output);
|
||||
}
|
||||
template <class CIn, class COut>
|
||||
VTKM_CONT static void LowerBounds(const vtkm::cont::ArrayHandle<vtkm::Id, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::LowerBoundsFunctor(), input, values_output);
|
||||
LowerBounds(vtkm::cont::DeviceAdapterIdAny(), input, values_output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class CIn>
|
||||
VTKM_CONT static U Reduce(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
U initialValue)
|
||||
{
|
||||
detail::ReduceFunctor<U> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, initialValue);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, typename U, class CIn>
|
||||
VTKM_CONT static U Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input, U initialValue)
|
||||
{
|
||||
detail::ReduceFunctor<U> functor;
|
||||
vtkm::cont::TryExecute(functor, input, initialValue);
|
||||
return functor.result;
|
||||
return Reduce(vtkm::cont::DeviceAdapterIdAny(), input, initialValue);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class CIn, class BinaryFunctor>
|
||||
VTKM_CONT static U Reduce(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
U initialValue,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
detail::ReduceFunctor<U> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, initialValue, binary_functor);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, typename U, class CIn, class BinaryFunctor>
|
||||
VTKM_CONT static U Reduce(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
U initialValue,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
detail::ReduceFunctor<U> functor;
|
||||
vtkm::cont::TryExecute(functor, input, initialValue, binary_functor);
|
||||
return functor.result;
|
||||
return Reduce(vtkm::cont::DeviceAdapterIdAny(), input, initialValue, binary_functor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T,
|
||||
typename U,
|
||||
class CKeyIn,
|
||||
class CValIn,
|
||||
class CKeyOut,
|
||||
class CValOut,
|
||||
class BinaryFunctor>
|
||||
VTKM_CONT static void ReduceByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
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)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId,
|
||||
detail::ReduceByKeyFunctor(),
|
||||
keys,
|
||||
values,
|
||||
keys_output,
|
||||
values_output,
|
||||
binary_functor);
|
||||
}
|
||||
template <typename T,
|
||||
typename U,
|
||||
class CKeyIn,
|
||||
@ -409,39 +520,81 @@ struct Algorithm
|
||||
vtkm::cont::ArrayHandle<U, CValOut>& values_output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
vtkm::cont::TryExecute(
|
||||
detail::ReduceByKeyFunctor(), keys, values, keys_output, values_output, binary_functor);
|
||||
ReduceByKey(
|
||||
vtkm::cont::DeviceAdapterIdAny(), keys, values, keys_output, values_output, binary_functor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T ScanInclusive(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::ScanInclusiveResultFunctor<T> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, output);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T ScanInclusive(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::ScanInclusiveResultFunctor<T> functor;
|
||||
vtkm::cont::TryExecute(functor, input, output);
|
||||
return functor.result;
|
||||
return ScanInclusive(vtkm::cont::DeviceAdapterIdAny(), input, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T StreamingScanExclusive(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::Id numBlocks,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::StreamingScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, numBlocks, input, output);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T StreamingScanExclusive(const vtkm::Id numBlocks,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::StreamingScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecute(functor, numBlocks, input, output);
|
||||
return functor.result;
|
||||
return StreamingScanExclusive(vtkm::cont::DeviceAdapterIdAny(), numBlocks, input, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class COut, class BinaryFunctor>
|
||||
VTKM_CONT static T ScanInclusive(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
detail::ScanInclusiveResultFunctor<T> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, output, binary_functor);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, class CIn, class COut, class BinaryFunctor>
|
||||
VTKM_CONT static T ScanInclusive(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
detail::ScanInclusiveResultFunctor<T> functor;
|
||||
vtkm::cont::TryExecute(functor, input, output, binary_functor);
|
||||
return functor.result;
|
||||
return ScanInclusive(vtkm::cont::DeviceAdapterIdAny(), input, output, binary_functor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T,
|
||||
typename U,
|
||||
typename KIn,
|
||||
typename VIn,
|
||||
typename VOut,
|
||||
typename BinaryFunctor>
|
||||
VTKM_CONT static void ScanInclusiveByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& values_output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
|
||||
}
|
||||
template <typename T,
|
||||
typename U,
|
||||
typename KIn,
|
||||
@ -453,38 +606,84 @@ struct Algorithm
|
||||
vtkm::cont::ArrayHandle<U, VOut>& values_output,
|
||||
BinaryFunctor binary_functor)
|
||||
{
|
||||
vtkm::cont::TryExecute(
|
||||
detail::ScanInclusiveByKeyFunctor(), keys, values, values_output, binary_functor);
|
||||
ScanInclusiveByKey(
|
||||
vtkm::cont::DeviceAdapterIdAny(), keys, values, values_output, binary_functor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, typename KIn, typename VIn, typename VOut>
|
||||
VTKM_CONT static void ScanInclusiveByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
|
||||
}
|
||||
template <typename T, typename U, typename KIn, typename VIn, typename VOut>
|
||||
VTKM_CONT static void ScanInclusiveByKey(const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::ScanInclusiveByKeyFunctor(), keys, values, values_output);
|
||||
ScanInclusiveByKey(vtkm::cont::DeviceAdapterIdAny(), keys, values, values_output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T ScanExclusive(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::ScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, output);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, class CIn, class COut>
|
||||
VTKM_CONT static T ScanExclusive(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output)
|
||||
{
|
||||
detail::ScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecute(functor, input, output);
|
||||
return functor.result;
|
||||
return ScanExclusive(vtkm::cont::DeviceAdapterIdAny(), input, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class COut, class BinaryFunctor>
|
||||
VTKM_CONT static T ScanExclusive(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output,
|
||||
BinaryFunctor binaryFunctor,
|
||||
const T& initialValue)
|
||||
{
|
||||
detail::ScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecuteOnDevice(devId, functor, input, output, binaryFunctor, initialValue);
|
||||
return functor.result;
|
||||
}
|
||||
template <typename T, class CIn, class COut, class BinaryFunctor>
|
||||
VTKM_CONT static T ScanExclusive(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<T, COut>& output,
|
||||
BinaryFunctor binaryFunctor,
|
||||
const T& initialValue)
|
||||
{
|
||||
detail::ScanExclusiveFunctor<T> functor;
|
||||
vtkm::cont::TryExecute(functor, input, output, binaryFunctor, initialValue);
|
||||
return functor.result;
|
||||
return ScanExclusive(
|
||||
vtkm::cont::DeviceAdapterIdAny(), input, output, binaryFunctor, initialValue);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, typename KIn, typename VIn, typename VOut, class BinaryFunctor>
|
||||
VTKM_CONT static void ScanExclusiveByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& output,
|
||||
const U& initialValue,
|
||||
BinaryFunctor binaryFunctor)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId,
|
||||
detail::ScanExclusiveByKeyFunctor(),
|
||||
keys,
|
||||
values,
|
||||
output,
|
||||
initialValue,
|
||||
binaryFunctor);
|
||||
}
|
||||
template <typename T, typename U, typename KIn, typename VIn, typename VOut, class BinaryFunctor>
|
||||
VTKM_CONT static void ScanExclusiveByKey(const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
@ -492,60 +691,139 @@ struct Algorithm
|
||||
const U& initialValue,
|
||||
BinaryFunctor binaryFunctor)
|
||||
{
|
||||
vtkm::cont::TryExecute(
|
||||
detail::ScanExclusiveByKeyFunctor(), keys, values, output, initialValue, binaryFunctor);
|
||||
ScanExclusiveByKey(
|
||||
vtkm::cont::DeviceAdapterIdAny(), keys, values, output, initialValue, binaryFunctor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class KIn, typename VIn, typename VOut>
|
||||
VTKM_CONT static void ScanExclusiveByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::ScanExclusiveByKeyFunctor(), keys, values, output);
|
||||
}
|
||||
template <typename T, typename U, class KIn, typename VIn, typename VOut>
|
||||
VTKM_CONT static void ScanExclusiveByKey(const vtkm::cont::ArrayHandle<T, KIn>& keys,
|
||||
const vtkm::cont::ArrayHandle<U, VIn>& values,
|
||||
vtkm::cont::ArrayHandle<U, VOut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::ScanExclusiveByKeyFunctor(), keys, values, output);
|
||||
ScanExclusiveByKey(vtkm::cont::DeviceAdapterIdAny(), keys, values, output);
|
||||
}
|
||||
|
||||
|
||||
template <class Functor>
|
||||
VTKM_CONT static void Schedule(vtkm::cont::DeviceAdapterId devId,
|
||||
Functor functor,
|
||||
vtkm::Id numInstances)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::ScheduleFunctor(), functor, numInstances);
|
||||
}
|
||||
template <class Functor>
|
||||
VTKM_CONT static void Schedule(Functor functor, vtkm::Id numInstances)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::ScheduleFunctor(), functor, numInstances);
|
||||
Schedule(vtkm::cont::DeviceAdapterIdAny(), functor, numInstances);
|
||||
}
|
||||
|
||||
|
||||
template <class Functor>
|
||||
VTKM_CONT static void Schedule(vtkm::cont::DeviceAdapterId devId,
|
||||
Functor functor,
|
||||
vtkm::Id3 rangeMax)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::ScheduleFunctor(), functor, rangeMax);
|
||||
}
|
||||
template <class Functor>
|
||||
VTKM_CONT static void Schedule(Functor functor, vtkm::Id3 rangeMax)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::ScheduleFunctor(), functor, rangeMax);
|
||||
Schedule(vtkm::cont::DeviceAdapterIdAny(), functor, rangeMax);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class Storage>
|
||||
VTKM_CONT static void Sort(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, Storage>& values)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::SortFunctor(), values);
|
||||
}
|
||||
template <typename T, class Storage>
|
||||
VTKM_CONT static void Sort(vtkm::cont::ArrayHandle<T, Storage>& values)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::SortFunctor(), values);
|
||||
Sort(vtkm::cont::DeviceAdapterIdAny(), values);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class Storage, class BinaryCompare>
|
||||
VTKM_CONT static void Sort(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, Storage>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::SortFunctor(), values, binary_compare);
|
||||
}
|
||||
template <typename T, class Storage, class BinaryCompare>
|
||||
VTKM_CONT static void Sort(vtkm::cont::ArrayHandle<T, Storage>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::SortFunctor(), values, binary_compare);
|
||||
Sort(vtkm::cont::DeviceAdapterIdAny(), values, binary_compare);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename U, class StorageT, class StorageU>
|
||||
VTKM_CONT static void SortByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, StorageT>& keys,
|
||||
vtkm::cont::ArrayHandle<U, StorageU>& values)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::SortByKeyFunctor(), keys, values);
|
||||
}
|
||||
template <typename T, typename U, class StorageT, class StorageU>
|
||||
VTKM_CONT static void SortByKey(vtkm::cont::ArrayHandle<T, StorageT>& keys,
|
||||
vtkm::cont::ArrayHandle<U, StorageU>& values)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::SortByKeyFunctor(), keys, values);
|
||||
SortByKey(vtkm::cont::DeviceAdapterIdAny(), keys, values);
|
||||
}
|
||||
|
||||
template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
|
||||
VTKM_CONT static void SortByKey(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, StorageT>& keys,
|
||||
vtkm::cont::ArrayHandle<U, StorageU>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::SortByKeyFunctor(), keys, values, binary_compare);
|
||||
}
|
||||
template <typename T, typename U, class StorageT, class StorageU, class BinaryCompare>
|
||||
VTKM_CONT static void SortByKey(vtkm::cont::ArrayHandle<T, StorageT>& keys,
|
||||
vtkm::cont::ArrayHandle<U, StorageU>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::SortByKeyFunctor(), keys, values, binary_compare);
|
||||
SortByKey(vtkm::cont::DeviceAdapterIdAny(), keys, values, binary_compare);
|
||||
}
|
||||
|
||||
VTKM_CONT static void Synchronize() { vtkm::cont::TryExecute(detail::SynchronizeFunctor()); }
|
||||
|
||||
VTKM_CONT static void Synchronize(vtkm::cont::DeviceAdapterId devId)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::SynchronizeFunctor());
|
||||
}
|
||||
VTKM_CONT static void Synchronize() { Synchronize(vtkm::cont::DeviceAdapterIdAny()); }
|
||||
|
||||
|
||||
template <typename T,
|
||||
typename U,
|
||||
typename V,
|
||||
typename StorageT,
|
||||
typename StorageU,
|
||||
typename StorageV,
|
||||
typename BinaryFunctor>
|
||||
VTKM_CONT static void Transform(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, StorageT>& input1,
|
||||
const vtkm::cont::ArrayHandle<U, StorageU>& input2,
|
||||
vtkm::cont::ArrayHandle<V, StorageV>& output,
|
||||
BinaryFunctor binaryFunctor)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::TransformFunctor(), input1, input2, output, binaryFunctor);
|
||||
}
|
||||
template <typename T,
|
||||
typename U,
|
||||
typename V,
|
||||
@ -558,44 +836,87 @@ struct Algorithm
|
||||
vtkm::cont::ArrayHandle<V, StorageV>& output,
|
||||
BinaryFunctor binaryFunctor)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::TransformFunctor(), input1, input2, output, binaryFunctor);
|
||||
Transform(vtkm::cont::DeviceAdapterIdAny(), input1, input2, output, binaryFunctor);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class Storage>
|
||||
VTKM_CONT static void Unique(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, Storage>& values)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::UniqueFunctor(), values);
|
||||
}
|
||||
template <typename T, class Storage>
|
||||
VTKM_CONT static void Unique(vtkm::cont::ArrayHandle<T, Storage>& values)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::UniqueFunctor(), values);
|
||||
Unique(vtkm::cont::DeviceAdapterIdAny(), values);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class Storage, class BinaryCompare>
|
||||
VTKM_CONT static void Unique(vtkm::cont::DeviceAdapterId devId,
|
||||
vtkm::cont::ArrayHandle<T, Storage>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::UniqueFunctor(), values, binary_compare);
|
||||
}
|
||||
template <typename T, class Storage, class BinaryCompare>
|
||||
VTKM_CONT static void Unique(vtkm::cont::ArrayHandle<T, Storage>& values,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::UniqueFunctor(), values, binary_compare);
|
||||
Unique(vtkm::cont::DeviceAdapterIdAny(), values, binary_compare);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class CVal, class COut>
|
||||
VTKM_CONT static void UpperBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::UpperBoundsFunctor(), input, values, output);
|
||||
}
|
||||
template <typename T, class CIn, class CVal, class COut>
|
||||
VTKM_CONT static void UpperBounds(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::UpperBoundsFunctor(), input, values, output);
|
||||
UpperBounds(vtkm::cont::DeviceAdapterIdAny(), input, values, output);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
|
||||
VTKM_CONT static void UpperBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(
|
||||
devId, detail::UpperBoundsFunctor(), input, values, output, binary_compare);
|
||||
}
|
||||
template <typename T, class CIn, class CVal, class COut, class BinaryCompare>
|
||||
VTKM_CONT static void UpperBounds(const vtkm::cont::ArrayHandle<T, CIn>& input,
|
||||
const vtkm::cont::ArrayHandle<T, CVal>& values,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& output,
|
||||
BinaryCompare binary_compare)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::UpperBoundsFunctor(), input, values, output, binary_compare);
|
||||
UpperBounds(vtkm::cont::DeviceAdapterIdAny(), input, values, output, binary_compare);
|
||||
}
|
||||
|
||||
|
||||
template <class CIn, class COut>
|
||||
VTKM_CONT static void UpperBounds(vtkm::cont::DeviceAdapterId devId,
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecuteOnDevice(devId, detail::UpperBoundsFunctor(), input, values_output);
|
||||
}
|
||||
template <class CIn, class COut>
|
||||
VTKM_CONT static void UpperBounds(const vtkm::cont::ArrayHandle<vtkm::Id, CIn>& input,
|
||||
vtkm::cont::ArrayHandle<vtkm::Id, COut>& values_output)
|
||||
{
|
||||
vtkm::cont::TryExecute(detail::UpperBoundsFunctor(), input, values_output);
|
||||
UpperBounds(vtkm::cont::DeviceAdapterIdAny(), input, values_output);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user