Channel¶
-
template<CommunicationSpace CommSpace = MpiSpace>
class Channel¶ An MPI persistent communication channel for repeated point-to-point exchanges.
Only the
Channel<MpiSpace>specialization is currently provided.Channelbinds a fixed source rank, destination rank, and message tag. After registering send and receive buffers withsendinit()andrecvinit(), the user callsstart()to launch all registered operations andwait()to block until they complete.Each registered operation is represented by a persistent MPI request. Register the communication pattern once, then repeat
start/waitcycles to execute the same operations. The persistent requests are released when the channel is destroyed.A persistent request retains the buffer address, element count, and datatype supplied during registration.
Channeldoes not retain the View object or its allocation. The application must therefore keep every registered buffer allocation valid and at the same address until the channel is destroyed. Between a completedwait()and the nextstart(), send buffers may be modified and receive buffers may be read or modified. While an operation is active, the usual MPI buffer-access restrictions apply.The communicator is borrowed rather than duplicated. It must remain valid until the channel is destroyed, and the channel must be destroyed before
MPI_Finalize. Every call tostart()must be matched by a successfulwait()before destruction.- Template Parameters:
CommSpace – The communication backend. Only
MpiSpaceis supported.
-
explicit Channel(int dest_rank, int src_rank, int tag, MPI_Comm comm)¶
Constructs a
Channelwith fixed endpoints.- Parameters:
dest_rank – The destination rank for send operations.
src_rank – The source rank for receive operations.
tag – The message tag.
comm – The borrowed MPI communicator used by every registered operation.
-
~Channel()¶
Releases all registered persistent requests with
MPI_Request_free. The channel must have no active operations; the destructor does not wait for them.
-
Channel(const Channel&) = delete¶
-
auto operator=(const Channel&) -> Channel& = delete¶
Copy construction and copy assignment are deleted because a channel exclusively owns its persistent requests.
-
Channel(Channel &&other) noexcept¶
Transfers ownership of all persistent requests and the borrowed communicator from
other. The moved-from channel is empty and may be safely destroyed.
-
auto operator=(Channel &&other) noexcept -> Channel&¶
Releases the destination’s existing persistent requests, then transfers ownership from
other. The moved-from channel is empty and may be safely destroyed.The destination must have no active operations before assignment.
-
template<class SendView>
void sendinit(SendView view)¶ Registers a send buffer with the channel.
The View’s data type determines the element type communicated. Its underlying allocation must remain valid until the channel is destroyed.
Each call registers an additional persistent send operation.
- Template Parameters:
SendView – A Kokkos View type.
- Parameters:
view – The view to register as a send buffer.
-
template<class RecvView>
void recvinit(RecvView view)¶ Registers a receive buffer with the channel.
The View’s data type determines the element type communicated. Its underlying allocation must remain valid until the channel is destroyed.
Each call registers an additional persistent receive operation.
- Template Parameters:
RecvView – A Kokkos View type.
- Parameters:
view – The view to register as a receive buffer.
-
void start()¶
Activates all registered persistent requests.
All pending Kokkos kernel work is fenced before the communication operations are initiated, ensuring that send buffers are fully populated and receive buffers are not in use.