class communicator
Declaration
class communicator { /* full declaration omitted */ };
Description
Interface for peer-to-peer and collective communication across nodes to be implemented for MPI or similar system APIs. Celerity maintains one root communicator which can be cloned collectively, and the same communicator instance in this "cloning tree" must participate in corresponding operations on each node. Communicator instances themselves are not thread-safe, but if there are multiple (cloned) instances, each may be used from their own thread. Peer-to-peer operations (send/receive/poll) can be arbitrarily re-ordered by the communicator, but collectives will always be executed precisely in the order they are submitted.
Member Function Overview
- collective_barrier() → virtual void
- collective_clone() → virtual std::unique_ptr<communicator>
- communicator()
- communicator(const communicator &)
- communicator(communicator &&)
- get_local_node_id() const → virtual node_id
- get_num_nodes() const → virtual size_t
- operator=(const communicator &) → communicator &
- operator=(communicator &&) → communicator &
- poll_inbound_pilots() → [[nodiscard]] virtual std::vector<inbound_pilot>
- receive_payload(node_id from, message_id msgid, void * base, const stride & stride) → [[nodiscard]] virtual async_event
- send_outbound_pilot(const outbound_pilot & pilot) → virtual void
- send_payload(node_id to, message_id msgid, const void * base, const stride & stride) → [[nodiscard]] virtual async_event
- ~communicator() → virtual
Member Functions
¶virtual void collective_barrier()
virtual void collective_barrier()
Description
Blocks until all nodes in this communicator have called collective_barrier()
. Must be ordered identically to all other collective operations on this communicator across all nodes.
¶virtual std::unique_ptr<communicator>
collective_clone()
virtual std::unique_ptr<communicator>
collective_clone()
Description
Creates a new communicator that is fully concurrent to this one, and which has its own "namespace" for peer-to-peer and collective operations. Must be ordered identically to all other collective operations on this communicator across all nodes.
¶communicator()
communicator()
¶communicator(const communicator&)
communicator(const communicator&)
Parameters
- const communicator&
¶communicator(communicator&&)
communicator(communicator&&)
Parameters
¶virtual node_id get_local_node_id() const
virtual node_id get_local_node_id() const
Description
Returns the 0-based id of the local node in the communicator.
¶virtual size_t get_num_nodes() const
virtual size_t get_num_nodes() const
Description
Returns the number of nodes (processes) that are part of this communicator.
¶communicator& operator=(const communicator&)
communicator& operator=(const communicator&)
Parameters
- const communicator&
¶communicator& operator=(communicator&&)
communicator& operator=(communicator&&)
Parameters
¶[[nodiscard]] virtual std::vector<inbound_pilot>
poll_inbound_pilots()
[[nodiscard]] virtual std::vector<inbound_pilot>
poll_inbound_pilots()
Description
Returns all inbound pilots received on this communicator since the last invocation of the same function. Never blocks.
¶[[nodiscard]] virtual async_event receive_payload(
node_id from,
message_id msgid,
void* base,
const stride& stride)
[[nodiscard]] virtual async_event receive_payload(
node_id from,
message_id msgid,
void* base,
const stride& stride)
Description
Begins receiving strided data (which was previously announced using an inbound_pilot) from the specified node. The base
allocation must remain live until the returned event completes, and no element inside stride
must be written to during that time.
Parameters
- node_id from
- message_id msgid
- void* base
- const stride& stride
¶virtual void send_outbound_pilot(
const outbound_pilot& pilot)
virtual void send_outbound_pilot(
const outbound_pilot& pilot)
Description
Asynchronously sends a pilot message, returning without acknowledgement from the receiver. The pilot is copied internally and the reference does not need to remain live after the function returns.
Parameters
- const outbound_pilot& pilot
¶[[nodiscard]] virtual async_event send_payload(
node_id to,
message_id msgid,
const void* base,
const stride& stride)
[[nodiscard]] virtual async_event send_payload(
node_id to,
message_id msgid,
const void* base,
const stride& stride)
Description
Begins sending strided data (that was previously announced using an outbound_pilot) to the specified node. The base
allocation must remain live until the returned event completes, and no element inside stride
must be written to during that time.
Parameters
- node_id to
- message_id msgid
- const void* base
- const stride& stride
¶virtual ~communicator()
virtual ~communicator()
Description
Communicator destruction is a collective operation like collective_barrier
. The user must ensure that any asynchronous operation is already complete when the destructor runs.