pub trait MpiBackend {
type Peer<'a>: Copy;
type Probed;
// Required methods
fn is_self(peer: Self::Peer<'_>) -> bool;
fn send_bytes(&self, to: Self::Peer<'_>, tag: Tag, buffer: &[u8]);
fn probe(&self, from: Self::Peer<'_>, tag: Tag) -> (Self::Probed, i64);
fn receive_probed(&self, probed: Self::Probed, buffer: &mut [u8]) -> i64;
}Expand description
The MPI operations one transport call performs.
The protocol itself lives in [crate::engine] and is written once against this
trait, so a second MPI binding only supplies these four operations.
Implementations borrow the caller’s communicator through Peer; nothing here
initializes, finalizes or duplicates a communicator.
§Examples
use tenferro_mpi::MpiBackend;
fn is_self<B: MpiBackend>(peer: B::Peer<'_>) -> bool {
B::is_self(peer)
}Required Associated Types§
Required Methods§
Sourcefn send_bytes(&self, to: Self::Peer<'_>, tag: Tag, buffer: &[u8])
fn send_bytes(&self, to: Self::Peer<'_>, tag: Tag, buffer: &[u8])
Blocking send of buffer as bytes.
Sourcefn probe(&self, from: Self::Peer<'_>, tag: Tag) -> (Self::Probed, i64)
fn probe(&self, from: Self::Peer<'_>, tag: Tag) -> (Self::Probed, i64)
Blocking probe: consume the next message from from on tag and report its
byte length.
Probing before receiving is what keeps a non-conforming frame a typed error instead of a fatal MPI truncation.
Sourcefn receive_probed(&self, probed: Self::Probed, buffer: &mut [u8]) -> i64
fn receive_probed(&self, probed: Self::Probed, buffer: &mut [u8]) -> i64
Receive a probed message, returning the byte count it carried.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".