Skip to content

Commit b2dabf8

Browse files
rik404ritvikrao
andauthored
Docs - Reductions - added contribute() details (#288)
* Docs - Reductions - added contribute() details * method params for contribute/reduce --------- Co-authored-by: Ritvik Rao <rsrao2@illinois.edu>
1 parent d18f126 commit b2dabf8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/reductions-api.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,21 @@ A reduction is a distributed and scalable operation that reduces data
66
distributed across chares into a smaller set of data.
77
A reduction involves the chares in a collection (Group, Array or Section). They are
88
started by the elements calling their ``Chare.reduce()`` or ``Chare.allreduce()``
9-
methods (see :ref:`Chare <chare-api-label>`).
9+
methods (see :ref:`Chare <chare-api-label>`).
10+
11+
The reduction calls accumulate objects from a chare collection to a single desired
12+
collection/object. ``Chare.reduce(<callback>, <data>, <Reducer>)`` is the general format.
13+
This returns a single collection/object to the callback function after applying the Reducer
14+
function on all individual chare data.
15+
16+
Alternatively, one can use the ``Chare.contribute()`` to achieve the same. The signature of the
17+
contribute function is ``Chare.contribute(<data>, <Reducer>, <callback>)``
18+
19+
* ``data``: scalar/vector data. Can be a collection/primitive/object. Each chare contributes some compatible data to the reducer.
20+
21+
* ``Reducer``: charm4py.Reducer - :ref:`reducer-api-label`
22+
23+
* ``callback``: any method - either belonging to a Chare or global or a different class. The reducer sends each reduced data to the callback.
1024

1125
.. important::
1226

0 commit comments

Comments
 (0)