-
Notifications
You must be signed in to change notification settings - Fork 0
StdNumeric
Header File: Kokkos_Core.hpp
All algorithms are currently in the Kokkos::Experimental namespace.
Currently supported (see below the full details):
reducetransform_reduceexclusive_scantransform_exclusive_scaninclusive_scantransform_inclusive_scanadjacent_difference
//
// overload set A
//
template <class ExecutionSpace, class IteratorType>
typename IteratorType::value_type reduce(const ExecutionSpace& exespace, (1)
IteratorType first,
IteratorType last);
template <class ExecutionSpace, class IteratorType>
typename IteratorType::value_type reduce(const std::string& label, (2)
const ExecutionSpace& exespace,
IteratorType first,
IteratorType last);
template <class ExecutionSpace, class DataType, class... Properties>
auto reduce(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType, Properties...>& view);
template <class ExecutionSpace, class DataType, class... Properties>
auto reduce(const std::string& label, const ExecutionSpace& exespace, (4)
const ::Kokkos::View<DataType, Properties...>& view);
//
// overload set B
//
template <class ExecutionSpace, class IteratorType, class ValueType>
ValueType reduce(const ExecutionSpace& exespace, (5)
IteratorType first, IteratorType last,
ValueType init_reduction_value);
template <class ExecutionSpace, class IteratorType, class ValueType>
ValueType reduce(const std::string& label, const ExecutionSpace& exespace, (6)
IteratorType first, IteratorType last,
ValueType init_reduction_value);
template <class ExecutionSpace, class DataType, class... Properties, class ValueType>
ValueType reduce(const ExecutionSpace& exespace, (7)
const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value);
template <class ExecutionSpace, class DataType, class... Properties, class ValueType>
ValueType reduce(const std::string& label, (8)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value);
//
// overload set C
//
template <
class ExecutionSpace, class IteratorType, class ValueType,
class BinaryOp>
ValueType reduce(const ExecutionSpace& exespace, (9)
IteratorType first, IteratorType last,
ValueType init_reduction_value,
BinaryOp joiner);
template <
class ExecutionSpace, class IteratorType, class ValueType,
class BinaryOp>
ValueType reduce(const std::string& label, const ExecutionSpace& exespace, (10)
IteratorType first, IteratorType last,
ValueType init_reduction_value,
BinaryOp joiner);
template <
class ExecutionSpace, class DataType, class... Properties,
class ValueType, class BinaryOp>
ValueType reduce(const ExecutionSpace& exespace, (11)
const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value,
BinaryOp joiner);
template <
class ExecutionSpace, class DataType, class... Properties,
class ValueType, class BinaryOp>
ValueType reduce(const std::string& label, const ExecutionSpace& exespace, (12)
const ::Kokkos::View<DataType, Properties...>& view,
ValueType init_reduction_value,
BinaryOp joiner);-
Overload set A (1,2,3,4): performs a reduction of the elements in the range
[first, last)(1,2) or inview(3,4). -
Overload set B (5,6,7,8): performs a reduction of the elements in the range
[first, last)(5,6) or inview(7,8) accounting for the initial valueinit_reduction_value. -
Overload set C (9,10,11,12): performs a reduction of the elements in the range
[first, last)(9,10) or inview(11,12) accounting for the initial valueinit_reduction_valueusing the functorjoinerto join operands during the reduction operation.
-
exespace:- execution space instance
-
label:- used to name the implementation kernels for debugging purposes
- for 1,5,9 the default string is: "Kokkos::reduce_iterator_api_default"
- for 3,7,11 the default string is: "Kokkos::reduce_view_api_default"
-
first,last:- range of elements to reduce over
- must be random access iterators
- must represent a valid range, i.e.,
last >= first(checked in debug mode) - must be accessible from
exespace
-
view:- view to reduce
- must be rank-1, and have
LayoutLeft,LayoutRight, orLayoutStride - must be accessible from
exespace
-
init_reduction_value:- initial reduction value to use
-
joiner:-
binary functor performing the desired operation to join two elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
a,bof type (possible const)ValueType, and must not modifya,b. - Must conform to:
struct JoinFunctor { KOKKOS_FUNCTION constexpr ValueType operator()(const ValueType& a, const ValueType& b) const { return /* ... */ } KOKKOS_FUNCTION constexpr ValueType operator()(const volatile ValueType& a, const volatile ValueType& b) const { return /* ... */ } };
- The behavior is non-deterministic if the
joineroperation is not associative or not commutative.
-
binary functor performing the desired operation to join two elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
The reduction result.
//
// overload set A
//
template <
class ExecutionSpace, class IteratorType1,
class IteratorType2, class ValueType>
ValueType transform_reduce(const ExecutionSpace& exespace, (1)
IteratorType1 first1, IteratorType1 last1,
IteratorType2 first2,
ValueType init_reduction_value);
template <
class ExecutionSpace, class IteratorType1,
class IteratorType2, class ValueType>
ValueType transform_reduce(const std::string& label, (2)
const ExecutionSpace& exespace,
IteratorType1 first1, IteratorType1 last1,
IteratorType2 first2,
ValueType init_reduction_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType>
ValueType transform_reduce(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType1, Properties1...>& first_view,
const ::Kokkos::View<DataType2, Properties2...>& second_view,
ValueType init_reduction_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType>
ValueType transform_reduce(const std::string& label, (4)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& first_view,
const ::Kokkos::View<DataType2, Properties2...>& second_view,
ValueType init_reduction_value);
//
// overload set B
//
template <
class ExecutionSpace,
class IteratorType1, class IteratorType2,
class ValueType,
class BinaryJoinerType, class BinaryTransform>
ValueType transform_reduce(const ExecutionSpace& exespace, (5)
IteratorType1 first1,
IteratorType1 last1, IteratorType2 first2,
ValueType init_reduction_value,
BinaryJoinerType joiner,
BinaryTransform binary_transformer);
template <
class ExecutionSpace,
class IteratorType1, class IteratorType2,
class ValueType,
class BinaryJoinerType, class BinaryTransform>
ValueType transform_reduce(const std::string& label, (6)
const ExecutionSpace& exespace,
IteratorType1 first1, IteratorType1 last1,
IteratorType2 first2,
ValueType init_reduction_value,
BinaryJoinerType joiner,
BinaryTransform binary_transformer);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType,
class BinaryJoinerType, class BinaryTransform>
ValueType transform_reduce(const ExecutionSpace& exespace, (7)
const ::Kokkos::View<DataType1, Properties1...>& first_view,
const ::Kokkos::View<DataType2, Properties2...>& second_view,
ValueType init_reduction_value,
BinaryJoinerType joiner,
BinaryTransform binary_transformer);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType,
class BinaryJoinerType, class BinaryTransform>
ValueType transform_reduce(const std::string& label, (8)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& first_view,
const ::Kokkos::View<DataType2, Properties2...>& second_view,
ValueType init_reduction_value,
BinaryJoinerType joiner,
BinaryTransform binary_transformer);
//
// overload set C
//
template <
class ExecutionSpace,
class IteratorType, class ValueType,
class BinaryJoinerType, class UnaryTransform>
ValueType transform_reduce(const ExecutionSpace& exespace, (9)
IteratorType first1, IteratorType last1,
ValueType init_reduction_value,
BinaryJoinerType joiner,
UnaryTransform unary_transformer);
template <
class ExecutionSpace,
class IteratorType, class ValueType,
class BinaryJoinerType, class UnaryTransform>
ValueType transform_reduce(const std::string& label,
const ExecutionSpace& exespace, (10)
IteratorType first1, IteratorType last1,
ValueType init_reduction_value,
BinaryJoinerType joiner,
UnaryTransform unary_transformer);
template <
class ExecutionSpace,
class DataType, class... Properties, class ValueType,
class BinaryJoinerType, class UnaryTransform>
ValueType transform_reduce(const ExecutionSpace& exespace, (11)
const ::Kokkos::View<DataType, Properties...>& first_view,
ValueType init_reduction_value,
BinaryJoinerType joiner,
UnaryTransform unary_transformer);
template <
class ExecutionSpace,
class DataType, class... Properties, class ValueType,
class BinaryJoinerType, class UnaryTransform>
ValueType transform_reduce(const std::string& label, (12)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType, Properties...>& first_view,
ValueType init_reduction_value,
BinaryJoinerType joiner,
UnaryTransform unary_transformer);-
(1,2): performs the product (via
operator*) between each pair of elements in the range[first1, last1)and the range starting atfirst2, and reduces the results along with the initial valueinit_reduction_value -
(3,4): performs the product (via
operator*) between each pair of elements infirst_viewandsecond_view, and reduces the results along with the initial valueinit_reduction_value -
(5,6): applies the functor
binary_transformerto each pair of elements in the range[first1, last1)and the range starting atfirst2, and reduces the results along with the initial valueinit_reduction_valuewith the join operation done via the binary functorjoiner -
(7,8): applies the functor
binary_transformerto each pair of elements infirst_viewandsecond_view, and reduces the result along with the initial valueinit_reduction_valuewith the join operation done via the binary functorjoiner -
(9,10): applies the functor
unary_transformerto each element in the range[first, last), and reduces the results along with the initial valueinit_reduction_valuewith the join operation done via the binary functorjoiner -
(11,12): applies the functor
unary_transformerto each element inview, and reduces the results along with the initial valueinit_reduction_valuewith the join operation done via the binary functorjoiner
-
exespace:- execution space instance
-
label:- used to name the implementation kernels for debugging purposes
- for 1,5,9 the default string is: "Kokkos::transform_reduce_iterator_api_default"
- for 3,7,11 the default string is: "Kokkos::transform_reduce_view_api_default"
-
first1,last1,first2:- ranges of elements to transform and reduce
- must be random access iterators
- must represent a valid range, i.e.,
last1 >= first1(checked in debug mode) - must be accessible from
exespace
-
first_view,second_view:- views to transform and reduce
- must be rank-1, and have
LayoutLeft,LayoutRight, orLayoutStride - must be accessible from
exespace
-
init_reduction_value:- initial reduction value to use
-
joiner:-
binary functor performing the desired operation to join two elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
a,bof type (possible const)ValueType, and must not modifya,b. - Must conform to:
struct JoinFunctor { KOKKOS_FUNCTION constexpr ValueType operator()(const ValueType& a, const ValueType& b) const { return /* ... */ } KOKKOS_FUNCTION constexpr ValueType operator()(const volatile ValueType& a, const volatile ValueType& b) const { return /* ... */ } };
- The behavior is non-deterministic if the
joineroperation is not associative or not commutative.
-
binary functor performing the desired operation to join two elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
-
binary_transformer:-
binary functor applied to each pair of elements before doing the reduction.
Must be valid to be called from the execution space passed, and callable with
two arguments
a,bof type (possible const)value_type_aandvalue_type_b, wherevalue_type_{a,b}are the value types offirst1andfirst2(for 1,2,5,6) or the value types offirst_viewandsecond_view(for 3,4,7,8), and must not modifya,b. - Must conform to:
struct BinaryTransformer { KOKKOS_FUNCTION constexpr return_type operator()(const value_type_a & a, const value_type_b & b) const { return /* ... */ } };
- the
return_typeis such that it can be accepted by thejoiner
-
binary functor applied to each pair of elements before doing the reduction.
Must be valid to be called from the execution space passed, and callable with
two arguments
-
unary_transformer:-
unary functor performing the desired operation to an element.
Must be valid to be called from the execution space passed, and callable with
an arguments
vof type (possible const)value_type, wherevalue_typeis the value type offirst1(for 9,10) or the value type offirst_view(for 11,12), and must not modifyv. - Must conform to:
struct UnaryTransformer { KOKKOS_FUNCTION constexpr value_type operator()(const value_type & v) const { return /* ... */ } };
-
unary functor performing the desired operation to an element.
Must be valid to be called from the execution space passed, and callable with
an arguments
The reduction result.
//
// overload set A
//
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType>
OutputIteratorType exclusive_scan(const ExecutionSpace& exespace, (1)
InputIteratorType first,
InputIteratorType last,
OutputIteratorType first_dest,
ValueType init_value);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType>
OutputIteratorType exclusive_scan(const std::string& label, (2)
const ExecutionSpace& exespace,
InputIteratorType first,
InputIteratorType last,
OutputIteratorType first_dest,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType>
auto exclusive_scan(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType>
auto exclusive_scan(const std::string& label, const ExecutionSpace& exespace, (4)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value);
//
// overload set B
//
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType, class BinaryOpType
>
OutputIteratorType exclusive_scan(const ExecutionSpace& exespace, (5)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
ValueType init_value, BinaryOpType bin_op);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType, class BinaryOpType
>
OutputIteratorType exclusive_scan(const std::string& label, (6)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
ValueType init_value, BinaryOpType bin_op);
template <
class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2, class ValueType,
class BinaryOpType>
auto exclusive_scan(const ExecutionSpace& exespace, (7)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value, BinaryOpType bin_op);
template <
class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2, class ValueType,
class BinaryOpType>
auto exclusive_scan(const std::string& label, const ExecutionSpace& exespace, (8)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value, BinaryOpType bin_op);-
1,2,3,4: computes an exclusive prefix sum for the range
[first_from, last_from)(1,2) orview_from(3,4), usinginitas the initial value, and writes the results to the range beginning atfirst_dest(1,2) or toview_dest(3,4). -
5,6,7,8: computes an exclusive prefix scan using the binary functor
bin_opto combine two elements for the range[first_from, last_from)(5,6) orview_from(7,8), usinginitas the initial value, and writes the results to the range beginning atfirst_dest(5,6) or toview_dest(7,8).
Exclusive means that the i-th input element is not included in the i-th sum.
-
exespace:- execution space instance
-
label:- used to name the implementation kernels for debugging purposes
- for 1,2 the default string is: "Kokkos::exclusive_scan_iterator_api_default"
- for 5,6 the default string is: "Kokkos::exclusive_scan_view_api_default"
-
first_from,last_from,first_dest:- range of elements to read from (
*_from) and write to (first_dest) - must be random access iterators
- must represent a valid range, i.e.,
last_from >= first_from(checked in debug mode) - must be accessible from
exespace
- range of elements to read from (
-
view_from,view_dest:- views to read elements from
view_fromand write toview_dest - must be rank-1, and have
LayoutLeft,LayoutRight, orLayoutStride - must be accessible from
exespace
- views to read elements from
-
bin_op:-
binary functor representing the operation to combine pair of elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
a,bof type (possible const)value_type, wherevalue_typeis the value type ofInputIteratorType(for 1,2,5,6) or the value type ofview_from(for 3,4,7,8), and must not modifya,b. - must conform to:
struct BinaryOp { KOKKOS_INLINE_FUNCTION return_type operator()(const value_type & a, const value_type & b) const { return /* ... */; } return_type operator()(const volatile value_type & a, const volatile value_type & b) const { return /* ... */; } };
The return type
return_typemust be such that an object of typeOutputIteratorTypefor (1,2,5,6) or an object of typevalue_typewherevalue_typeis the value type ofview_destfor (3,4,7,8) can be dereferenced and assigned a value of typereturn_type.- the volatile overload is needed for correctness by the current Kokkos implementation of prefix scan operations
-
binary functor representing the operation to combine pair of elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
Iterator to the element after the last element written.
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType,
class BinaryOpType, class UnaryOpType>
OutputIteratorType transform_exclusive_scan(const ExecutionSpace& exespace, (1)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
ValueType init_value,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class ValueType,
class BinaryOpType, class UnaryOpType>
OutputIteratorType transform_exclusive_scan(const std::string& label, (2)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
ValueType init_value,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType, class BinaryOpType, class UnaryOpType>
auto transform_exclusive_scan(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value, BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class ValueType, class BinaryOpType, class UnaryOpType>
auto transform_exclusive_scan(const std::string& label, (4)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
ValueType init_value, BinaryOpType binary_op,
UnaryOpType unary_op);-
1,2: transforms each element in the range
[first_from, last_from)withunary_op, then computes an exclusive prefix scan operation usingbinary_opover the resulting range, withinitas the initial value, and writes the results to the range beginning atfirst_dest. "exclusive" means that the i-th input element is not included in the i-th sum -
3,4: same as (1,2) except that the elements are read from
view_fromand written toview_dest
-
exespace,first_from,first_last,first_dest,view_from,view_dest:- same as
exclusive_scan
- same as
-
label:- used to name the implementation kernels for debugging purposes
- for 1 the default string is: "Kokkos::transform_exclusive_scan_iterator_api_default"
- for 3 the default string is: "Kokkos::transform_exclusive_scan_view_api_default"
-
unary_op:-
unary functor performing the desired transformation operation to an element.
Must be valid to be called from the execution space passed, and callable with
an arguments
vof type (possible const)value_type, wherevalue_typeis the value type offirst_from(for 1,2) or the value type ofview_from(for 3,4), and must not modifyv. - Must conform to:
struct UnaryOp { KOKKOS_FUNCTION constexpr value_type operator()(const value_type & v) const { return /* ... */ } };
-
unary functor performing the desired transformation operation to an element.
Must be valid to be called from the execution space passed, and callable with
an arguments
Iterator to the element after the last element written.
//
// overload set A
//
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType>
OutputIteratorType inclusive_scan(const ExecutionSpace& exespace, (1)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest);
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType>
OutputIteratorType inclusive_scan(const std::string& label, (2)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2>
auto inclusive_scan(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2>
auto inclusive_scan(const std::string& label, const ExecutionSpace& exespace, (4)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest);
//
// overload set B
//
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType
>
OutputIteratorType inclusive_scan(const ExecutionSpace& exespace, (5)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType bin_op);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType
>
OutputIteratorType inclusive_scan(const std::string& label, (6)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType bin_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType>
auto inclusive_scan(const ExecutionSpace& exespace, (7)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType bin_op);
template <
class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType>
auto inclusive_scan(const std::string& label, const ExecutionSpace& exespace, (8)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType bin_op);
//
// overload set C
//
template <
class ExecutionSpace,
class InputIteratorType, class OutputIteratorType,
class BinaryOpType, class ValueType
>
OutputIteratorType inclusive_scan(const ExecutionSpace& exespace, (9)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType bin_op,
ValueType init_value);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType, class ValueType
>
OutputIteratorType inclusive_scan(const std::string& label, (10)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType bin_op,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class ValueType>
auto inclusive_scan(const ExecutionSpace& exespace, (11)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType bin_op,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class ValueType>
auto inclusive_scan(const std::string& label, const ExecutionSpace& exespace, (12)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType bin_op,
ValueType init_value);-
1,2,3,4: computes an inclusive prefix scan over the range
[first_from, last_from)(1,2) or forview_from(3,4) using the binary opbin_opto combine two elements, and writes the results to the range beginning atfirst_dest(1,2) or toview_dest(3,4). -
5,6,7,8: computes an inclusive prefix scan over the range
[first_from, last_from)(5,6) orview_from(7,8) using the binary opbin_opto combine two elements, and writes the results to the range beginning atfirst_dest(5,6) or toview_dest(7,8). -
9,10,11,12: computes an inclusive prefix scan over the range
[first_from, last_from)(9,10) orview_from(11,12) using the binary functorbin_opto combine two elements andinitas the initial value, and writes the results to the range beginning atfirst_dest(9,10) or toview_dest(11,12).
Inclusive means that the i-th input element is included in the i-th sum.
-
exespace,first_from,first_last,first_dest,view_from,view_dest,bin_op:- same as in
exclusive_scan
- same as in
-
label:- used to name the implementation kernels for debugging purposes
- for 1,5,9 the default string is: "Kokkos::inclusive_scan_iterator_api_default"
- for 3,7,11 the default string is: "Kokkos::inclusive_scan_view_api_default"
Iterator to the element after the last element written.
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType, class UnaryOpType>
OutputIteratorType transform_inclusive_scan(const ExecutionSpace& exespace, (1)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType, class UnaryOpType>
OutputIteratorType transform_inclusive_scan(const std::string& label, (2)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class UnaryOpType>
auto transform_inclusive_scan(const ExecutionSpace& exespace, (3)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class UnaryOpType>
auto transform_inclusive_scan(const std::string& label, (4)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType binary_op,
UnaryOpType unary_op);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType, class UnaryOpType,
class ValueType>
OutputIteratorType transform_inclusive_scan(const ExecutionSpace& exespace, (5)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType binary_op,
UnaryOpType unary_op,
ValueType init_value);
template <
class ExecutionSpace, class InputIteratorType,
class OutputIteratorType, class BinaryOpType, class UnaryOpType,
class ValueType>
OutputIteratorType transform_inclusive_scan(const std::string& label, (6)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOpType binary_op,
UnaryOpType unary_op,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class UnaryOpType, class ValueType>
auto transform_inclusive_scan(const ExecutionSpace& exespace, (7)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType binary_op, UnaryOpType unary_op,
ValueType init_value);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOpType, class UnaryOpType, class ValueType>
auto transform_inclusive_scan(const std::string& label, (8)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOpType binary_op, UnaryOpType unary_op,
ValueType init_value);-
1,2: transforms each element in the range
[first_from, last_from)withunary_op, then computes an inclusive prefix scan operation usingbinary_opover the resulting range, and writes the results to the range beginning atfirst_dest. -
3,4: same as (1,2) except that the elements are read from
view_fromand written toview_dest -
5,6: same as (1,2) but the scan accounts for the
init_value. -
7,8: same as (3,4) but the scan accounts for the
init_value.
Inclusive means that the i-th input element is included in the i-th sum.
-
exespace,first_from,first_last,first_dest,view_from,view_dest,init_value,bin_op,unary_op:- same as
transform_exclusive_scan
- same as
-
label:- used to name the implementation kernels for debugging purposes
- for 1,5 the default string is: "Kokkos::transform_inclusive_scan_iterator_api_default"
- for 3,7 the default string is: "Kokkos::transform_inclusive_scan_view_api_default"
Iterator to the element after the last element written.
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType>
OutputIteratorType adjacent_difference(const ExecutionSpace& exespace, (1)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest);
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType, class BinaryOp>
OutputIteratorType adjacent_difference(const ExecutionSpace& exespace, (2)
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOp bin_op);
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType>
OutputIteratorType adjacent_difference(const std::string& label, (3)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest);
template <class ExecutionSpace, class InputIteratorType, class OutputIteratorType, class BinaryOp>
OutputIteratorType adjacent_difference(const std::string& label, (4)
const ExecutionSpace& exespace,
InputIteratorType first_from,
InputIteratorType last_from,
OutputIteratorType first_dest,
BinaryOp bin_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2>
auto adjacent_difference(const ExecutionSpace& exespace, (5)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOp>
auto adjacent_difference(const ExecutionSpace& exespace, (6)
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOp bin_op);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2>
auto adjacent_difference(const std::string& label, (7)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest);
template <
class ExecutionSpace,
class DataType1, class... Properties1,
class DataType2, class... Properties2,
class BinaryOp>
auto adjacent_difference(const std::string& label, (8)
const ExecutionSpace& exespace,
const ::Kokkos::View<DataType1, Properties1...>& view_from,
const ::Kokkos::View<DataType2, Properties2...>& view_dest,
BinaryOp bin_op);-
(1,3,5,7): First, a copy of
*first_fromis written to*first_destfor (1,3), or a copy ofview_from(0)is written toview_dest(0)for (5,7). Second, it computes the difference between the second and the first of each adjacent pair of elements of the range[first_from, last_from)for (1,3) or inview_fromfor (5,7), and writes them to the range beginning atfirst_dest + 1for (1,3), orview_destfor (5,7). -
(2,4,6,8): First, a copy of
*first_fromis written to*first_destfor (2,4), or a copy ofview_from(0)is written toview_dest(0)for (6,8). Second, it calls the binary functor with the second and the first elements of each adjacent pair of elements of the range[first_from, last_from)for (2,4) or inview_fromfor (6,8), and writes them to the range beginning atfirst_dest + 1for (2,4), orview_destfor (6,8).
-
exespace:- execution space instance
-
label:- used to name the implementation kernels for debugging purposes
- for 1,2 the default string is: "Kokkos::adjacent_difference_iterator_api_default"
- for 5,6 the default string is: "Kokkos::adjacent_difference_view_api_default"
-
first_from,last_from,first_dest:- range of elements to read from
*_fromand write tofirst_dest - must be random access iterators
- must represent a valid range, i.e.,
last_from >= first_from(checked in debug mode) - must be accessible from
exespace
- range of elements to read from
-
view_from,view_dest:- views to read elements from
view_fromand write toview_dest - must be rank-1, and have
LayoutLeft,LayoutRight, orLayoutStride - must be accessible from
exespace
- views to read elements from
-
bin_op:-
binary functor representing the operation to apply to each pair of elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
a,bof type (possible const)value_type, wherevalue_typeis the value type ofInputIteratorType(for 1,2,3,4) or the value type ofview_from(for 5,6,7,8), and must not modifya,b. - must conform to:
The return typestruct BinaryOp { KOKKOS_INLINE_FUNCTION return_type operator()(const value_type & a, const value_type & b) const { return /* ... */; } // or, also valid return_type operator()(value_type a, value_type b) const { return /* ... */; } };
return_typemust be such that an object of typeOutputIteratorTypefor (1,2,3,4) or an object of typevalue_typewherevalue_typeis the value type ofview_destfor (5,6,7,8) can be dereferenced and assigned a value of typereturn_type. -
binary functor representing the operation to apply to each pair of elements.
Must be valid to be called from the execution space passed, and callable with
two arguments
Iterator to the element after the last element written.