libmuscle.peer_manager module¶
- class libmuscle.peer_manager.PeerManager(kernel: Reference, index: List[int], conduits: List[Conduit], peer_dims: Dict[Reference, List[int]], peer_locations: Dict[Reference, List[str]])[source]¶
Bases:
object
Manages information about peers for a Communicator
Create a PeerManager.
Peers here are instances, and peer_dims and peer_locations are indexed by a Reference to an instance. Instance sets are multi-dimensional arrays with sizes given by peer_dims.
- Parameters
kernel – The kernel for the instance whose peers we’re managing.
index – The index of the instance whose peers we’re managing.
conduits – A list of conduits attached to this compute element, as received from the manager.
peer_dims – For each peer we share a conduit with, the dimensions of the instance set.
peer_locations – A list of locations for each peer instance we share a conduit with.
- get_peer_dims(peer_kernel: Reference) List[int] [source]¶
Get the dimensions of a peer kernel.
- Parameters
peer_kernel – The peer kernel whose dimensions to get.
- get_peer_endpoint(port: Identifier, slot: List[int]) Endpoint [source]¶
Determine the peer endpoint for the given port and slot.
- Parameters
port – The port on our side to send or receive on.
slot – The slot to send or receive on.
- Returns
The peer endpoint.
- get_peer_locations(peer_instance: Reference) List[str] [source]¶
Get the locations of a peer instance.
- There may be multiple, if the peer supports more than one
protocol.
- Parameters
peer_instance – The instance whose locations to get.