Skip to content
53 changes: 34 additions & 19 deletions docs/source/API/containers/ScatterView.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,34 @@

Header File: ``<Kokkos_ScatterView.hpp>``

.. _parallelReduce: ../core/parallel-dispatch/parallel_reduce.html
Description
-----------
`Kokkos View-based <../core/view/view.html>`_ data structure that abstracts over "scatter - contribute" algorithms, where many contributors (over multiple indices) are reduced to fewer output resultants (*e.g.*, sum, product, maximum or minimum). ``ScatterView`` transparently switches between **Atomic**-, and **Data Replication**-based scatter algorithms. Typically, a ``ScatterView`` wraps an existing View.

.. |parallelReduce| replace:: :cpp:func:`parallel_reduce`

Description
Interface
-----------

.. cppkokkos:class:: template <class DataType, class LayoutType, class ExecutionSpace, class Operation, class Duplication, class Contribution> ScatterView


Parameters
-----------

.. cppkokkos:class:: template <typename DataType, int Op, typename ExecSpace, typename Layout, int contribution> ScatterView
* ``DataType``: See `Kokkos View DataType <../core/view/view.html>`_

* ``Layout``: See `Kokkos View LayoutType <../core/view/view.html>`_

.. rubric:: Public Member Variables
* ``ExecutionSpace``: Defaults to ``Kokkos::DefaultExecutionSpace``

* ``Operation``: ScatterSum, ScatterProd, ScatterMin, ScatterMax

* ``Duplication``: ScatterDuplicated, ScatterNonDuplicated

* ``Contribution``: ScatterAtomic, ScatterNonAtomic

Public Class Members
--------------------

.. cppkokkos:type:: original_view_type

Expand All @@ -31,17 +49,19 @@ Description

.. cppkokkos:type:: data_type_info

DuplicatedDataType, a newly created DataType that has a new runtime dimension which becomes the largest-stride dimension, from the given View DataType.
DuplicatedDataType, a newly created DataType with a new runtime dimension that becomes the largest-stride dimension from the given View DataType.

.. cppkokkos:type:: internal_data_type

Value type of data_type_info.

.. cppkokkos:type:: internal_view_type

A View type created from the internal_data_type.
Type alias for a View type created from the internal_data_type.

.. rubric:: Constructors

Constructors
-------------

.. cppkokkos:function:: ScatterView()

Expand All @@ -61,11 +81,9 @@ Description
This constructor allows passing an object created by ``Kokkos::view_alloc`` as first argument, e.g., for specifying an execution space via
``Kokkos::view_alloc(exec_space, "label")``.

.. rubric:: Public Methods

.. cppkokkos:function:: constexpr bool is_allocated() const

:return: true if the ``internal_view`` points to a valid memory location. This function works for both managed and unmanaged views. With the unmanaged view, there is no guarantee that referenced address is valid, only that it is a non-null pointer.
Public Class Methods
--------------------

.. cppkokkos:function:: access() const

Expand All @@ -85,7 +103,7 @@ Description

.. cppkokkos:function:: reset_except(View<DT, RP...> const& view)

tbd
excludes a Kokkos View from reset

.. cppkokkos:function:: resize(const size_t n0 = 0, const size_t n1 = 0, const size_t n2 = 0, const size_t n3 = 0, const size_t n4 = 0, const size_t n5 = 0, const size_t n6 = 0, const size_t n7 = 0)

Expand All @@ -96,18 +114,15 @@ Description
resize a view with discarding old data


.. rubric:: *Private* Members

:member: typedef original_view_type internal_view_type;
:member: internal_view_type internal_view;

Free Functions
--------------------

.. rubric:: Free Functions

.. cppkokkos:function:: contribute(View<DT1, VP...>& dest, Kokkos::Experimental::ScatterView<DT2, LY, ES, OP, CT, DP> const& src)

convenience function to perform final reduction of ScatterView
results into a resultant View; may be called following |parallelReduce|_.
(intermediate) results into a (final) resultant View; may be called following `parallel_reduce <../core/parallel-dispatch/parallel_reduce.html>`_ .


Example
Expand Down