Skip to content

Commit 735630f

Browse files
authored
Merge pull request #255 from cwpearson/docs/channel
docs: document Channel
2 parents 06bb3c9 + c90c952 commit 735630f

2 files changed

Lines changed: 74 additions & 0 deletions

File tree

docs/api/channel.rst

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
*******
2+
Channel
3+
*******
4+
5+
.. cpp:namespace:: KokkosComm
6+
7+
.. cpp:class:: template <typename CommSpace = DefaultCommunicationSpace> Channel
8+
9+
A persistent communication channel for repeated point-to-point exchanges.
10+
11+
``Channel`` binds a fixed source rank, destination rank, and message tag. After
12+
registering send and receive buffers with :cpp:func:`sendinit` and
13+
:cpp:func:`recvinit`, the user calls :cpp:func:`start` to launch all queued
14+
operations and :cpp:func:`wait` to block until they complete.
15+
16+
The communication pattern is established once at construction time. Subsequent
17+
``start`` / ``wait`` cycles reuse the same endpoints and message descriptors,
18+
which lets the communication backend optimize repeated exchanges. This is
19+
particularly useful for iterative algorithms where the same point-to-point
20+
pattern is repeated every iteration.
21+
22+
:tparam CommSpace: The communication backend to use. Defaults to ``DefaultCommunicationSpace``.
23+
24+
.. cpp:function:: explicit Channel(int dest_rank, int src_rank, int tag, typename CommSpace::communicator_type comm)
25+
26+
Constructs a ``Channel`` with fixed endpoints.
27+
28+
:param dest_rank: The destination rank for send operations.
29+
:param src_rank: The source rank for receive operations.
30+
:param tag: The message tag.
31+
:param comm: A communicator handle for the target communication backend.
32+
33+
.. cpp:function:: template <class SendView> void sendinit(SendView view)
34+
35+
Registers a send buffer with the channel.
36+
37+
The view's data type determines the element type communicated. The view must
38+
remain valid until the corresponding :cpp:func:`start` has been matched by a
39+
:cpp:func:`wait`.
40+
41+
Multiple calls accumulate into the send queue.
42+
43+
:tparam SendView: A Kokkos View type.
44+
:param view: The view to register as a send buffer.
45+
46+
.. cpp:function:: template <class RecvView> void recvinit(RecvView view)
47+
48+
Registers a receive buffer with the channel.
49+
50+
The view's data type determines the element type communicated. The view must
51+
remain valid until the corresponding :cpp:func:`start` has been matched by a
52+
:cpp:func:`wait`.
53+
54+
Multiple calls accumulate into the receive queue.
55+
56+
:tparam RecvView: A Kokkos View type.
57+
:param view: The view to register as a receive buffer.
58+
59+
.. cpp:function:: void start()
60+
61+
Launches all queued send and receive operations.
62+
63+
All pending Kokkos kernel work is fenced before the communication operations
64+
are initiated, ensuring that send buffers are fully populated and receive
65+
buffers are not in use.
66+
67+
.. cpp:function:: void wait()
68+
69+
Blocks until all previously started send and receive operations have completed.
70+
71+
Upon return, the internal request queues are consumed. To perform another
72+
exchange with the same or different buffers, register new buffers with
73+
:cpp:func:`sendinit` / :cpp:func:`recvinit` and call :cpp:func:`start` again.

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Documentation Content
4141
api/core
4242
api/mpi
4343
api/nccl
44+
api/channel
4445

4546
.. toctree::
4647
:maxdepth: 1

0 commit comments

Comments
 (0)