diff --git a/docs/source/API/alphabetical.rst b/docs/source/API/alphabetical.rst index b335e8d9f..b725ec79d 100644 --- a/docs/source/API/alphabetical.rst +++ b/docs/source/API/alphabetical.rst @@ -150,6 +150,8 @@ Core +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `Max `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Maximum reduction | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| `MaxFirstLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing maximum and its smallest index position | ++--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `MaxLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing maximum and an associated index | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `(U)MDRangePolicy `_ | `Core `_ | `Execution Policies `_ | Policy to iterate over a multidimensional index range. | @@ -158,10 +160,14 @@ Core +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `Min `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Minimum reduction | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| `MinFirstLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing minimum and its smallest index position | ++--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `MinLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing minimum and an associated index | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `MinMax `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing both minimum and maximum | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ +| `MinMaxFirstLastLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing both minimum at its smallest index & maximum at its largest index | ++--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `MinMaxLoc `_ | `Core `_ | `Built-in Reducers `_ | Reducer for Reduction providing both minimum and maximum and associated indices | +--------------------------------------------------------------------------------------+---------------------------+------------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+ | `OpenMP `_ | `Core `_ | `Spaces `_ | Execution space using non-target OpenMP parallel execution mechanisms. | diff --git a/docs/source/API/core/builtin_reducers.rst b/docs/source/API/core/builtin_reducers.rst index e6d2ce2b5..52aa7dfdc 100644 --- a/docs/source/API/core/builtin_reducers.rst +++ b/docs/source/API/core/builtin_reducers.rst @@ -21,14 +21,20 @@ Reducer objects used in conjunction with `parallel_reduce `__ - Maximum reduction + * - `MaxFirstLoc `__ + - Reduction providing maximum and its smallest associated index * - `MaxLoc `__ - Reduction providing maximum and an associated index * - `Min `__ - Minimum reduction + * - `MinFirstLoc `__ + - Reduction providing minimum and its smallest associated index * - `MinLoc `__ - Reduction providing minimum and an associated index * - `MinMax `__ - Reduction providing both minimum and maximum + * - `MinMaxFirstLastLoc `__ + - Reduction providing both minimum at its smallest index & maximum at its largest index * - `MinMaxLoc `__ - Reduction providing both minimum and maximum and associated indices * - `Prod `__ @@ -48,10 +54,13 @@ Reducer objects used in conjunction with `parallel_reduce `_ storing the maximum value. +If there are equivalent values, stores the smallest index. + +Header File: ```` + +Usage +----- + +.. code-block:: cpp + + MaxFirstLoc::value_type result; + parallel_reduce(N, Functor, MaxFirstLoc(result)); + +Synopsis +-------- + +.. code-block:: cpp + + template + struct MaxFirstLoc{ + using reducer = MaxFirstLoc; + using value_type = ValLocScalar, std::remove_cv_t>; + using result_view_type = View; + + MaxFirstLoc(value_type& value_); + MaxFirstLoc(const result_view_type& value_); + + void join(value_type& dest, const value_type& src) const; + void init(value_type& val) const; + value_type& reference() const; + result_view_type view() const; + bool references_scalar() const; + }; + + template + MaxFirstLoc(View, Ps...> const&) + -> MaxFirstLoc, Ps...>::memory_space>; + +Interface +--------- + +.. cpp:class:: template MaxFirstLoc + + .. rubric:: Public Types: + + .. cpp:type:: reducer + + The self type. + + .. cpp:type:: value_type + + The reduction scalar type (specialization of `ValLocScalar `_). + + .. cpp:type:: result_view_type + + A ``View`` referencing the reduction result. + + .. rubric:: Constructors: + + .. cpp:function:: MaxFirstLoc(value_type& value_); + + Constructs a reducer which references a local variable as its result location. + + .. cpp:function:: MaxFirstLoc(const result_view_type& value_); + + Constructs a reducer which references a specific view as its result location. + + .. rubric:: Public Member Functions: + + .. cpp:function:: void join(value_type& dest, const value_type& src) const; + + If ``dest.val == src.val && src.loc < dest.loc`` then ``dest.loc = src.loc``; + otherwise if ``dest.val < src.val`` then ``dest.val = src.val`` & ``dest.loc = src.loc``. + + .. cpp:function:: void init(value_type& val) const; + + Initialize ``val.val`` using the ``reduction_identity::max()`` method. The default implementation sets ``val=_MIN``. + Initialize ``val.loc`` using the ``reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. + + .. cpp:function:: value_type& reference() const; + + :return: A reference to the result provided in class constructor. + + .. cpp:function:: result_view_type view() const; + + :return: A ``View`` of the result place provided in class constructor. + + .. cpp:function:: bool references_scalar() const; + + :return: ``true`` if the reducer was constructed with a scalar; ``false`` if the reducer was constructed with a ``View``. + + .. rubric:: Explicit Deduction Guides (CTAD): + + .. cpp:function:: template MaxFirstLoc(View, Ps...> const&) -> MaxFirstLoc, Ps...>::memory_space>; + +Additional Information +^^^^^^^^^^^^^^^^^^^^^^ + +* ``MaxFirstLoc::value_type`` is specialization of ``ValLocScalar`` on non-``const`` ``T`` and non-``const`` ``I``. + +* ``MaxFirstLoc::result_view_type`` is ``View>``. Note that the ``S`` (memory space) must be the same as the space where the result resides. + +* Requires: ``Scalar`` has ``operator=`` and ``operator>`` defined. ``reduction_identity::max()`` is a valid expression. + +* Requires: ``Index`` has ``operator=`` defined. ``reduction_identity::min()`` is a valid expression. + +* In order to use ``MaxFirstLoc`` with a custom type of either ``Scalar`` or ``Index``, a template specialization of ``reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html>`_ for details. diff --git a/docs/source/API/core/builtinreducers/MaxLoc.rst b/docs/source/API/core/builtinreducers/MaxLoc.rst index b43d378d9..78db9bfa6 100644 --- a/docs/source/API/core/builtinreducers/MaxLoc.rst +++ b/docs/source/API/core/builtinreducers/MaxLoc.rst @@ -83,6 +83,10 @@ Interface Store maximum with index of ``src`` and ``dest`` into ``dest``: ``dest = (src.val > dest.val) ? src :dest;``. + .. note:: It is unspecified which index is stored if there are duplicate equivalent maximum values. To ensure the smallest index, use MaxFirstLoc_ instead of ``MaxLoc``. + + .. _MaxFirstLoc: ../builtinreducers/MaxFirstLoc.html + .. cpp:function:: KOKKOS_INLINE_FUNCTION void init(value_type& val) const; Initialize ``val.val`` using the ``Kokkos::reduction_identity::max()`` method. The default implementation sets ``val=_MIN``. diff --git a/docs/source/API/core/builtinreducers/MinFirstLoc.rst b/docs/source/API/core/builtinreducers/MinFirstLoc.rst new file mode 100644 index 000000000..dcfa69ce2 --- /dev/null +++ b/docs/source/API/core/builtinreducers/MinFirstLoc.rst @@ -0,0 +1,113 @@ +``MinFirstLoc`` +=============== + +.. role:: cpp(code) + :language: cpp + +Specific implementation of `ReducerConcept `_ storing the minimum value. +If there are equivalent values, stores the smallest index. + +Header File: ```` + +Usage +----- + +.. code-block:: cpp + + MinFirstLoc::value_type result; + parallel_reduce(N, Functor, MinFirstLoc(result)); + +Synopsis +-------- + +.. code-block:: cpp + + template + struct MinFirstLoc{ + using reducer = MinFirstLoc; + using value_type = ValLocScalar, std::remove_cv_t>; + using result_view_type = View; + + MinFirstLoc(value_type& value_); + MinFirstLoc(const result_view_type& value_); + + void join(value_type& dest, const value_type& src) const; + void init(value_type& val) const; + value_type& reference() const; + result_view_type view() const; + bool references_scalar() const; + }; + + template + MinFirstLoc(View, Ps...> const&) + -> MinFirstLoc, Ps...>::memory_space>; + +Interface +--------- + +.. cpp:class:: template MinFirstLoc + + .. rubric:: Public Types: + + .. cpp:type:: reducer + + The self type. + + .. cpp:type:: value_type + + The reduction scalar type (specialization of `ValLocScalar `_). + + .. cpp:type:: result_view_type + + A ``View`` referencing the reduction result. + + .. rubric:: Constructors: + + .. cpp:function:: MinFirstLoc(value_type& value_); + + Constructs a reducer which references a local variable as its result location. + + .. cpp:function:: MinFirstLoc(const result_view_type& value_); + + Constructs a reducer which references a specific view as its result location. + + .. rubric:: Public Member Functions: + + .. cpp:function:: void join(value_type& dest, const value_type& src) const; + + If ``src.val == dest.val`` && ``src.loc < dest.loc`` then ``dest.loc = src.loc``; + otherwise if ``src.val < dest.val`` then ``dest.val = src.val`` && ``dest.loc = src.loc``. + + .. cpp:function:: void init(value_type& val) const; + + Initialize ``val.val`` using the ``reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. + Initialize ``val.loc`` using the ``reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. + + .. cpp:function:: value_type& reference() const; + + :return: A reference to the result provided in class constructor. + + .. cpp:function:: result_view_type view() const; + + :return: A ``View`` of the result place provided in class constructor. + + .. cpp:function:: bool references_scalar() const; + + :return: ``true`` if the reducer was constructed with a scalar; ``false`` if the reducer was constructed with a ``View``. + + .. rubric:: Explicit Deduction Guides (CTAD): + + .. cpp:function:: template MinFirstLoc(View, Ps...> const&) -> MinFirstLoc, Ps...>::memory_space>; + +Additional Information +^^^^^^^^^^^^^^^^^^^^^^ + +* ``MinFirstLoc::value_type`` is specialization of ``ValLocScalar`` on non-``const`` ``T`` and non-``const`` ``I``. + +* ``MinFirstLoc::result_view_type`` is ``View>``. Note that the ``S`` (memory space) must be the same as the space where the result resides. + +* Requires: ``Scalar`` has ``operator=`` and ``operator>`` defined. ``reduction_identity::max()`` is a valid expression. + +* Requires: ``Index`` has ``operator=`` defined. ``reduction_identity::min()`` is a valid expression. + +* In order to use ``MinFirstLoc`` with a custom type of either ``Scalar`` or ``Index``, a template specialization of ``reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html>`_ for details. diff --git a/docs/source/API/core/builtinreducers/MinLoc.rst b/docs/source/API/core/builtinreducers/MinLoc.rst index 98d580832..c513390ad 100644 --- a/docs/source/API/core/builtinreducers/MinLoc.rst +++ b/docs/source/API/core/builtinreducers/MinLoc.rst @@ -83,6 +83,10 @@ Interface Store minimum with index of ``src`` and ``dest`` into ``dest``: ``dest = (src.val < dest.val) ? src :dest;``. + .. note:: It is unspecified which index is stored if there are duplicate equivalent minimum values. To ensure the smallest index, use MinFirstLoc_ instead of ``MinLoc``. + + .. _MinFirstLoc: ../builtinreducers/MinFirstLoc.html + .. cpp:function:: KOKKOS_INLINE_FUNCTION void init(value_type& val) const; Initialize ``val.val`` using the ``Kokkos::reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. diff --git a/docs/source/API/core/builtinreducers/MinMaxFirstLastLoc.rst b/docs/source/API/core/builtinreducers/MinMaxFirstLastLoc.rst new file mode 100644 index 000000000..95d491adf --- /dev/null +++ b/docs/source/API/core/builtinreducers/MinMaxFirstLastLoc.rst @@ -0,0 +1,121 @@ +``MinMaxFirstLastLoc`` +====================== + +.. role:: cpp(code) + :language: cpp + +Specific implementation of `ReducerConcept `_ storing both the minimum and maximum values with corresponding indices. If there are equivalent minimum values, stores the smallest corresponding index. If there are equivalent maximum values, stores the largest corresponding index. + +Header File: ```` + +Usage +----- + +.. code-block:: cpp + + MinMaxFirstLastLoc::value_type result; + parallel_reduce(N, Functor, MinMaxFirstLastLoc(result)); + +Synopsis +-------- + +.. code-block:: cpp + + template + struct MinMaxFirstLastLoc { + using reducer = MinMaxFirstLastLoc; + using value_type = MinMaxLocScalar, std::remove_cv_t>; + using result_view_type = View; + + MinMaxFirstLastLoc(value_type& value_); + MinMaxFirstLastLoc(const result_view_type& value_); + + void join(value_type& dest, const value_type& src) const; + void init(value_type& val) const; + value_type& reference() const; + result_view_type view() const; + bool references_scalar() const; + }; + + template + MinMaxFirstLastLoc(View, Ps...> const&) + -> MinMaxFirstLastLoc, Ps...>::memory_space>; + +Interface +--------- + +.. cpp:class:: template MinMaxFirstLastLoc + + .. rubric:: Public Types: + + .. cpp:type:: reducer + + The self type. + + .. cpp:type:: value_type + + The reduction scalar type (specialization of `MinMaxLocScalar `_) + + .. cpp:type:: result_view_type + + A ``View`` referencing the reduction result. + + .. rubric:: Constructors: + + .. cpp:function:: MinMaxFirstLastLoc(value_type& value_); + + Constructs a reducer which references a local variable as its result location. + + .. cpp:function:: MinMaxFirstLastLoc(const result_view_type& value_); + + Constructs a reducer which references a specific view as its result location. + + .. rubric:: Public Member Functions: + + .. cpp:function:: void join(value_type& dest, const value_type& src) const; + + If ``dest.min_val == src.min_val && src.min_loc < dest.min_loc`` then ``dest.min_loc = src.min_loc``; + otherwise if ``src.min_val < dest.min_val`` then ``dest.min_val = src.min_val`` & ``dest.min_loc = src.min_loc``. + + If ``dest.max_val == src.max_val && src.max_loc > dest.max_loc`` then ``dest.max_loc = src.max_loc``. + otherwise if ``dest.max_val < src.max_val`` then ``dest.max_val = src.max_val`` & ``dest.max_loc = src.max_loc``. + + .. cpp:function:: void init(value_type& val) const; + + Initialize ``val.min_val`` using the ``Kokkos::reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. + + Initialize ``val.max_val`` using the ``Kokkos::reduction_identity::max()`` method. The default implementation sets ``val=_MIN``. + + Initialize ``val.min_loc`` using the ``Kokkos::reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. + + Initialize ``val.max_loc`` using the ``Kokkos::reduction_identity::max()`` method. The default implementation sets ``val=_MAX``. + + .. cpp:function:: value_type& reference() const; + + :return: A reference to the result provided in class constructor. + + .. cpp:function:: result_view_type view() const; + + :return: A ``View`` of the result place provided in class constructor. + + .. cpp:function:: bool references_scalar() const; + + :return: ``true`` if the reducer was constructed with a scalar; ``false`` if the reducer was constructed with a ``View``. + + .. rubric:: Explicit Deduction Guides (CTAD): + + .. cpp:function:: template MinMaxFirstLastLoc(View, Ps...> const&) -> MinMaxFirstLastLoc, Ps...>::memory_space>; + +Additional Information +^^^^^^^^^^^^^^^^^^^^^^ + +* ``MinMaxFirstLastLoc::value_type`` is specialization of ``MinMaxLocScalar`` on non-``const`` ``T`` and non-``const`` ``I``. + +* ``MinMaxFirstLastLoc::result_view_type`` is ``View>``. Note that the ``S`` (memory space) must be the same as the space where the result resides. + +* Requires: ``Scalar`` has ``operator=``, ``operator<`` and ``operator>`` defined. ``reduction_identity::min()`` & ``reduction_identity::max()`` are valid expressions. + +* Requires: ``Index`` has ``operator=`` defined. ``reduction_identity::min()`` is a valid expression. + +* In order to use ``MinMaxFirstLastLoc`` with a custom type of either ``Scalar`` or ``Index``, a template specialization of ``reduction_identity`` must be defined. See `Built-In Reducers with Custom Scalar Types <../../../ProgrammingGuide/Custom-Reductions-Built-In-Reducers-with-Custom-Scalar-Types.html>`_ for details. + diff --git a/docs/source/API/core/builtinreducers/MinMaxLoc.rst b/docs/source/API/core/builtinreducers/MinMaxLoc.rst index f152bc9c2..806c68154 100644 --- a/docs/source/API/core/builtinreducers/MinMaxLoc.rst +++ b/docs/source/API/core/builtinreducers/MinMaxLoc.rst @@ -84,6 +84,10 @@ Interface Store minimum with location of ``src`` and ``dest`` into ``dest``. Store maximum with location of ``src`` and ``dest`` into ``dest``. + .. note:: It is unspecified which index is stored if there are duplicate equivalent minimum or maximum values. To ensure the smallest index for the minimum value and the largest index for the maximum value, use MinMaxFirstLastLoc_ instead of ``MinMaxLoc``. + + .. _MinMaxFirstLastLoc: ../builtinreducers/MinMaxFirstLastLoc.html + .. cpp:function:: KOKKOS_INLINE_FUNCTION void init( value_type& val) const; Initialize ``val.min_val`` using the ``Kokkos::reduction_identity::min()`` method. The default implementation sets ``val=_MAX``. diff --git a/docs/source/API/core/builtinreducers/ReducerConcept.rst b/docs/source/API/core/builtinreducers/ReducerConcept.rst index 018625dd9..f7e87ed24 100644 --- a/docs/source/API/core/builtinreducers/ReducerConcept.rst +++ b/docs/source/API/core/builtinreducers/ReducerConcept.rst @@ -126,10 +126,13 @@ Kokkos provides a number of built-in reducers that automatically work with the i * `Kokkos::LAnd `_ * `Kokkos::LOr `_ * `Kokkos::Max `_ +* `Kokkos::MaxFirstLoc `_ * `Kokkos::MaxLoc `_ * `Kokkos::Min `_ +* `Kokkos::MinFirstLoc `_ * `Kokkos::MinLoc `_ * `Kokkos::MinMax `_ +* `Kokkos::MinMaxFirstLastLoc `_ * `Kokkos::MinMaxLoc `_ * `Kokkos::Prod `_ * `Kokkos::Sum `_ diff --git a/docs/source/ProgrammingGuide/Custom-Reductions-Built-In-Reducers.md b/docs/source/ProgrammingGuide/Custom-Reductions-Built-In-Reducers.md index 801283c15..d03cb706f 100644 --- a/docs/source/ProgrammingGuide/Custom-Reductions-Built-In-Reducers.md +++ b/docs/source/ProgrammingGuide/Custom-Reductions-Built-In-Reducers.md @@ -6,16 +6,19 @@ Kokkos provides Reducers for the most common reduction types: * [LAnd](../API/core/builtinreducers/LAnd): Do a logical “and” reduction * [LOr](../API/core/builtinreducers/LOr): Do a logical “or” reduction * [Max](../API/core/builtinreducers/Max): Finding the maximum value +* [MaxFirstLoc](../API/core/builtinreducers/MaxFirstLoc): Retrieve the maximum value and its smallest index position * [MaxLoc](../API/core/builtinreducers/MaxLoc): Retrieve the maximum value as well as its associated index * [Min](../API/core/builtinreducers/Min): Finding the minimum value +* [MinFirstLoc](../API/core/builtinreducers/MinFirstLoc): Retrieve the minimum value and its smallest index position * [MinLoc](../API/core/builtinreducers/MinLoc): Retrieve the minimum value as well as its associated index * [MinMax](../API/core/builtinreducers/MinMax): Finding the minimum and the maximum value +* [MinMaxFirstLastLoc](../API/core/builtinreducers/MinMaxFirstLastLoc): Find both the maximum with its largest index & the minimum with its smallest index * [MinMaxLoc](../API/core/builtinreducers/MinMaxLoc): Find both the maximum and minimum value as well as their associated indices * [Prod](../API/core/builtinreducers/Prod): Computing the product of all input values * [Sum](../API/core/builtinreducers/Sum): For simple Summations These reducers work only for scalar data, i.e. you can’t have a runtime length array as the reduction type (for example finding the minimum values for each vector in a multi vector concurrently). -Generally the Reducers are templated on the Scalar type for the reduction as well as an optional template parameter for the memory space of the result (more on that later). The [`MinLoc`](../API/core/builtinreducers/MinLoc), [`MaxLoc`](../API/core/builtinreducers/MaxLoc) and [`MinMaxLoc`](../API/core/builtinreducers/MinMaxLoc) reducers are additionally templated on the index type. +Generally the Reducers are templated on the Scalar type for the reduction as well as an optional template parameter for the memory space of the result (more on that later). The [`MinLoc`](../API/core/builtinreducers/MinLoc), [`MaxLoc`](../API/core/builtinreducers/MaxLoc), [`MinMaxFirstLastLoc`](../API/core/builtinreducers/MinMaxFirstLastLoc) and [`MinMaxLoc`](../API/core/builtinreducers/MinMaxLoc) reducers are additionally templated on the index type. The following is an example for doing a simple min-reduction, finding the minimal value in a discretization of a parable. @@ -44,7 +47,7 @@ Kokkos::parallel_reduce( "MinReduce", N, KOKKOS_LAMBDA (const int& x, double& lm printf("Min: %lf\n", min); ``` -For the [`MinLoc`](../API/core/builtinreducers/MinLoc), [`MaxLoc`](../API/core/builtinreducers/MaxLoc) and [`MinMaxLoc`](../API/core/builtinreducers/MinMaxLoc) reducers the reduction type is a complex scalar type which is accessible through a `value_type` typedef. +For the [`MinFirstLoc`](../API/core/builtinreducers/MinFirstLoc), [`MinLoc`](../API/core/builtinreducers/MinLoc), [`MaxFirstLoc`](../API/core/builtinreducers/MaxFirstLoc), [`MaxLoc`](../API/core/builtinreducers/MaxLoc), [`MinMaxFirstLastLoc`](../API/core/builtinreducers/MinMaxFirstLastLoc) and [`MinMaxLoc`](../API/core/builtinreducers/MinMaxLoc) reducers the reduction type is a complex scalar type which is accessible through a `value_type` typedef. [`MinLoc`](../API/core/builtinreducers/MinLoc) and [`MaxLoc`](../API/core/builtinreducers/MaxLoc) have value types which contain a `val` and `loc` member to store the reduction value and the index respectively. Note that index (`loc`) can be a struct itself, for example to store a multidimensional index result (see later). ```c++ diff --git a/docs/source/ProgrammingGuide/HierarchicalParallelism.md b/docs/source/ProgrammingGuide/HierarchicalParallelism.md index 00398703a..064510ad6 100644 --- a/docs/source/ProgrammingGuide/HierarchicalParallelism.md +++ b/docs/source/ProgrammingGuide/HierarchicalParallelism.md @@ -265,7 +265,7 @@ parallel_for (TeamPolicy<> (league_size, team_size), }, Kokkos::Experimental::Prod(product); }); ``` -Note that custom reductions must employ one of the functor join patterns recognized by Kokkos; these include `Sum, Prod, Min, Max, LAnd, LOr, BAnd, BOr, ValLocScalar, MinLoc, MaxLoc, MinMaxScalar, MinMax, MinMaxLocScalar` and `MinMaxLoc`. +Note that custom reductions must employ one of the functor join patterns recognized by Kokkos; these include `Sum, Prod, Min, Max, LAnd, LOr, BAnd, BOr, ValLocScalar, MinFirstLoc, MinLoc, MaxFirstLoc, MaxLoc, MinMaxScalar, MinMax, MinMaxLocScalar`, `MinMaxFirstLastLoc` and `MinMaxLoc`. The third pattern is [`parallel_scan()`](../API/core/parallel-dispatch/parallel_scan) which can be used to perform prefix scans.