FMI 1.0
FaaS Message Interface
|
Interface that defines channel operations. Only provides a few default implementations, the rest is implemented in the specific ClientServer or PeerToPeer channel types. More...
#include <Channel.h>
Public Member Functions | |
virtual void | send (channel_data buf, FMI::Utils::peer_num dest)=0 |
Send data to peer with id dest, must match a recv call. More... | |
virtual void | recv (channel_data buf, FMI::Utils::peer_num src)=0 |
Receive data from peer with id src, must match a send call. More... | |
virtual void | bcast (channel_data buf, FMI::Utils::peer_num root)=0 |
Broadcast data. Buf only needs to contain useful data for root, the buffer is overwritten for all other peers. More... | |
virtual void | barrier ()=0 |
Barrier synchronization collective. More... | |
virtual void | gather (channel_data sendbuf, channel_data recvbuf, FMI::Utils::peer_num root) |
Root gathers data from all peers. More... | |
virtual void | scatter (channel_data sendbuf, channel_data recvbuf, FMI::Utils::peer_num root) |
Scatter data from root to all peers. More... | |
virtual void | reduce (channel_data sendbuf, channel_data recvbuf, FMI::Utils::peer_num root, raw_function f)=0 |
Apply function f to sendbuf of all peers. More... | |
virtual void | allreduce (channel_data sendbuf, channel_data recvbuf, raw_function f) |
Apply function f to sendbuf of all peers, make result available to everyone. More... | |
virtual void | scan (channel_data sendbuf, channel_data recvbuf, raw_function f)=0 |
Inclusive prefix scan, recvbuf / sendbuf needs to be set for all peers. More... | |
void | set_peer_id (FMI::Utils::peer_num num) |
Helper utility to set peer id, ID needs to be set before first collective operation. More... | |
void | set_num_peers (FMI::Utils::peer_num num) |
Helper utility to set number of peers, needs to be set before first collective operation. More... | |
void | set_comm_name (std::string communication_name) |
Helper utility to set the communicator name, should be set before first collective operation to avoid conflicts with empty communicator name. More... | |
virtual void | finalize () |
Called before communicator is destructed, can be used by channels to clean up (e.g., delete resources) More... | |
virtual double | get_latency (Utils::peer_num producer, Utils::peer_num consumer, std::size_t size_in_bytes)=0 |
Performance model of an individual channel, provides latency for a simple exchange with a number of producers / consumers. More... | |
virtual double | get_price (Utils::peer_num producer, Utils::peer_num consumer, std::size_t size_in_bytes)=0 |
Cost model of an individual channel, provides price for a simple exchange with a number of producers / consumers. More... | |
virtual double | get_operation_latency (Utils::OperationInfo op_info)=0 |
Performance model for collective operations, provides the latency for the given operation. More... | |
virtual double | get_operation_price (Utils::OperationInfo op_info)=0 |
Cost model for collective operations, provides the price for the given operation. More... | |
Static Public Member Functions | |
static std::shared_ptr< Channel > | get_channel (std::string name, std::map< std::string, std::string > params, std::map< std::string, std::string > model_params) |
Create a new channel with the given config and model params. More... | |
Protected Attributes | |
FMI::Utils::peer_num | peer_id |
FMI::Utils::peer_num | num_peers |
std::string | comm_name |
Can optionally be used by channels to avoid resource conflicts that may occur because of multiple concurrent communicators. More... | |
Interface that defines channel operations. Only provides a few default implementations, the rest is implemented in the specific ClientServer or PeerToPeer channel types.
|
virtual |
Apply function f to sendbuf of all peers, make result available to everyone.
Provides a default implementation with a reduce, followed by a broadcast. Channel types / implementations can provide more optimized ones. The same considerations for the evaluation order (as with reduce) hold
sendbuf | Data that is sent by every peer |
recvbuf | Relevant for all peers in contrast to reduce |
f |
Reimplemented in FMI::Comm::PeerToPeer.
|
pure virtual |
Barrier synchronization collective.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
pure virtual |
Broadcast data. Buf only needs to contain useful data for root, the buffer is overwritten for all other peers.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
inlinevirtual |
Called before communicator is destructed, can be used by channels to clean up (e.g., delete resources)
Note that we provide an explicit finalize function on purpose (and do not use a virtual destructor), because derived classes may require that some values of parent classes still exist when cleaning up.
Reimplemented in FMI::Comm::ClientServer.
|
virtual |
Root gathers data from all peers.
Channel provides a default implementation where peers use send for sending the buffers to the root peer. Child classes may create more optimized implementations.
sendbuf | Data that is sent to the root |
recvbuf | Buffer to receive data in, only relevant for root. Needs to have a size of (at least) num_peers * sendbuf.size |
Reimplemented in FMI::Comm::PeerToPeer.
|
static |
Create a new channel with the given config and model params.
This function is only used for the bundled channels, all other should be instantiated outside of the framework and added over the Communicator interface.
|
pure virtual |
Performance model of an individual channel, provides latency for a simple exchange with a number of producers / consumers.
Implemented in FMI::Comm::Direct, FMI::Comm::Redis, and FMI::Comm::S3.
|
pure virtual |
Performance model for collective operations, provides the latency for the given operation.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
pure virtual |
Cost model for collective operations, provides the price for the given operation.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
pure virtual |
Cost model of an individual channel, provides price for a simple exchange with a number of producers / consumers.
Implemented in FMI::Comm::Direct, FMI::Comm::Redis, and FMI::Comm::S3.
|
pure virtual |
Receive data from peer with id src, must match a send call.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
pure virtual |
Apply function f to sendbuf of all peers.
When f is not commutative / associative, a strict left-to-right evaluation order is guaranteed. Otherwise, the implementation is free to choose the order, but two executions with the same topology should result in the same order / result.
sendbuf | Data that is sent by every peer |
recvbuf | Only relevant for root. Needs to have the same size as sendbuf |
f | Associativity / Commutativity of f controls choice of algorithm, depending on the channel / channel type |
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
pure virtual |
Inclusive prefix scan, recvbuf / sendbuf needs to be set for all peers.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
virtual |
Scatter data from root to all peers.
Channel provides a default implementation where root sends the relevant slice to all peers, which use recv to receive it.
sendbuf | Only relevant for root, contains the data that is scattered and needs to have a (divisible) size of num_peers * recvbuf.size |
recvbuf | Buffer to receive the data (of size sendbuf.size / num_peers), needs to be set by all peers |
Reimplemented in FMI::Comm::PeerToPeer.
|
pure virtual |
Send data to peer with id dest, must match a recv call.
Implemented in FMI::Comm::ClientServer, and FMI::Comm::PeerToPeer.
|
inline |
Helper utility to set the communicator name, should be set before first collective operation to avoid conflicts with empty communicator name.
|
inline |
Helper utility to set number of peers, needs to be set before first collective operation.
|
inline |
Helper utility to set peer id, ID needs to be set before first collective operation.
|
protected |
Can optionally be used by channels to avoid resource conflicts that may occur because of multiple concurrent communicators.
For instance, the communicator name can be used as a prefix for key or file names. Some channels might not need this because other mechanisms exist, but every channel has to ensure that multiple concurrent communicators work as expected.
|
protected |
|
protected |