pub enum PeerDeviceAffinityPolicy {
Any,
MatchName,
Groups(Vec<BTreeSet<String>>),
}Expand description
Which of a peer’s NICs a local NIC is allowed to pair with for a transfer.
Two NICs both being up does not mean the fabric carries traffic between
them. For example, some fabrics may be organized into planes, where NICs
can only talk to other NICs in the same plane. Instead of trying to add
complex, dynamic network topology detection into monarch, it’s much easier
to simply let the user tell us the topology of their network. This is
configurable using the config attr.
RDMA_PEER_DEVICE_AFFINITY.
Variants§
Any
Every local NIC reaches every peer NIC.
MatchName
A local NIC reaches a peer NIC only if the two carry the same device name.
Groups(Vec<BTreeSet<String>>)
A local NIC reaches a peer NIC only where some group names both. A NIC no group names reaches nothing. There may be any number of groups, of any size, and they are disjoint, so a NIC belongs to at most one.
Implementations§
Source§impl PeerDeviceAffinityPolicy
impl PeerDeviceAffinityPolicy
Sourcepub fn pairs(&self, local: &[String], remote: &[String]) -> Vec<Option<usize>>
pub fn pairs(&self, local: &[String], remote: &[String]) -> Vec<Option<usize>>
Pair each device in local with at most one device in remote.
Entry i is the index in remote that local[i] should use, or None
when it has no partner: no NIC appears in two pairs, so the shorter list
bounds how many pairs there are, and the policy can rule out the rest.
Same-named NICs pair first, no matter what the policy says.
Whatever is left over pairs subject to the policy, taking the
first NIC in remote it can still reach.
The leftovers are matched greedily in order, so an earlier device can take the only partner a later one could have used. Maximizing the number of pairs is likely not worth a matching algorithm here.
Sourcepub fn choose(
&self,
devices: &[String],
max: Option<NonZeroUsize>,
) -> Vec<String>
pub fn choose( &self, devices: &[String], max: Option<NonZeroUsize>, ) -> Vec<String>
The devices to serve one buffer from: at most max of devices, or all
of them when max is None.
Which devices are dropped is decided by position, so the caller decides
what “first” means by how it orders devices.
Selection logic depends on the policy:
Self::Any: any two NICs can talk to each other, so buffers should spread across tied devices rather than always funneling through the first.choosepicks a random offset intodevices, then takes up tomaxstarting from that offset, wrapping around if necessary.Self::MatchName: takes the firstmaxNICs in the order in which they appear in devices. Callers should passdevicesin a known, consistent order so that different processes agree on the choice.Self::Groups: takes one device from every groupdevicestouches before taking a second from any of them, so a peer served by any of those groups still finds a partner here. A device no group names comes last: it reaches no peer device, so it is worth registering only once nothing else fillsmax.
Trait Implementations§
Source§impl Clone for PeerDeviceAffinityPolicy
impl Clone for PeerDeviceAffinityPolicy
Source§fn clone(&self) -> PeerDeviceAffinityPolicy
fn clone(&self) -> PeerDeviceAffinityPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PeerDeviceAffinityPolicy
impl Debug for PeerDeviceAffinityPolicy
impl Eq for PeerDeviceAffinityPolicy
Source§impl FromStr for PeerDeviceAffinityPolicy
impl FromStr for PeerDeviceAffinityPolicy
Source§impl PartialEq for PeerDeviceAffinityPolicy
impl PartialEq for PeerDeviceAffinityPolicy
Source§fn eq(&self, other: &PeerDeviceAffinityPolicy) -> bool
fn eq(&self, other: &PeerDeviceAffinityPolicy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for PeerDeviceAffinityPolicy
Auto Trait Implementations§
impl Freeze for PeerDeviceAffinityPolicy
impl RefUnwindSafe for PeerDeviceAffinityPolicy
impl Send for PeerDeviceAffinityPolicy
impl Sync for PeerDeviceAffinityPolicy
impl Unpin for PeerDeviceAffinityPolicy
impl UnsafeUnpin for PeerDeviceAffinityPolicy
impl UnwindSafe for PeerDeviceAffinityPolicy
Blanket Implementations§
impl<T> Allocation for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].