From 53c45c2c3f19b3647050b4c7bc2963f0adbaf28d Mon Sep 17 00:00:00 2001 From: rkmohan2 Date: Sun, 9 Mar 2025 11:26:54 -0500 Subject: [PATCH 1/2] Docs - Reductions - added contribute() details --- docs/reductions-api.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/reductions-api.rst b/docs/reductions-api.rst index acfdc555..0b35112c 100644 --- a/docs/reductions-api.rst +++ b/docs/reductions-api.rst @@ -6,7 +6,15 @@ A reduction is a distributed and scalable operation that reduces data distributed across chares into a smaller set of data. A reduction involves the chares in a collection (Group, Array or Section). They are started by the elements calling their ``Chare.reduce()`` or ``Chare.allreduce()`` -methods (see :ref:`Chare `). +methods (see :ref:`Chare `). + +The reduction calls accumulate objects from a chare collection to a single desired +collection/object. ``Chare.reduce(, , )`` is the general format. +This returns a single collection/object to the callback function after applying the Reducer +function on all individual chare data. + +Alternatively, one can use the ``Chare.contribute()`` to achieve the same. The signature of the +contribute function is ``Chare.contribute(, , )`` .. important:: From c2453a05fb33d3169a896851fcb52919dd394e3b Mon Sep 17 00:00:00 2001 From: rkmohan2 Date: Wed, 12 Mar 2025 15:20:01 -0500 Subject: [PATCH 2/2] method params for contribute/reduce --- docs/reductions-api.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/reductions-api.rst b/docs/reductions-api.rst index 0b35112c..a9021501 100644 --- a/docs/reductions-api.rst +++ b/docs/reductions-api.rst @@ -16,6 +16,12 @@ function on all individual chare data. Alternatively, one can use the ``Chare.contribute()`` to achieve the same. The signature of the contribute function is ``Chare.contribute(, , )`` +* ``data``: scalar/vector data. Can be a collection/primitive/object. Each chare contributes some compatible data to the reducer. + +* ``Reducer``: charm4py.Reducer - :ref:`reducer-api-label` + +* ``callback``: any method - either belonging to a Chare or global or a different class. The reducer sends each reduced data to the callback. + .. important:: Reduction calls are asynchronous and return immediately. Chares can start