Skip to main content

NetTransport

Struct NetTransport 

Source
pub struct NetTransport { /* private fields */ }
Expand description

Full-mesh TCP transport implementing both Transport (two-sided send/recv) and SymmetricTransport (one-sided put/get/barrier). Construct via TcpTransport::bind or ThunderboltTransport::bind.

Implementations§

Source§

impl NetTransport

Source

pub fn from_listener( rank: u32, world: u32, listener: TcpListener, peers: Vec<SocketAddr>, heap_size: usize, ) -> Result<Self>

Build a transport from an already-bound listener. Ranks above us we connect to; ranks below us we accept from (each connector announces itself with a HELLO). peers[r] is rank r’s listen address; peers[rank] must match listener.

Public so callers (and multi-rank tests) can pre-bind ephemeral ports, exchange the addresses out-of-band, then construct the mesh — avoiding the fixed-port races TcpTransport::bind is subject to.

Trait Implementations§

Source§

impl Drop for NetTransport

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl SymmetricTransport for NetTransport

Source§

fn num_ranks(&self) -> u32

How many ranks participate.
Source§

fn this_rank(&self) -> Rank

This process’s rank.
Source§

fn put(&self, buf: SymmetricBuffer, src: &[u8]) -> Result<(), CollectiveError>

Write src into buf. Errors on length mismatch.
Source§

fn get( &self, buf: SymmetricBuffer, dst: &mut [u8], ) -> Result<(), CollectiveError>

Read from buf into dst. Errors on length mismatch.
Source§

fn barrier(&self) -> Result<(), CollectiveError>

Block until every rank has reached this barrier. Local emulation is a memory fence + a counter; real transports implement their own.
Source§

impl Transport for NetTransport

Source§

fn rank(&self) -> u32

This process’s rank in 0..world_size.
Source§

fn world_size(&self) -> u32

Total number of participating ranks.
Source§

fn send_bytes( &self, to: u32, tag: u32, bytes: &[u8], ) -> Result<(), CollectiveError>

Send bytes to rank to, tagged tag. Returns once the bytes are handed to the transport (not necessarily delivered).
Source§

fn recv_bytes(&self, from: u32, tag: u32) -> Result<Vec<u8>, CollectiveError>

Block until a message with matching (from, tag) arrives, and return its payload.
Source§

fn barrier(&self) -> Result<(), CollectiveError>

Block until every rank has reached this barrier. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.