Skip to main content

MpiBackend

Trait MpiBackend 

Source
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§

Source

type Peer<'a>: Copy

A destination or source rank handle, borrowed from the caller’s communicator.

Source

type Probed

A message that has been probed and must be received exactly once.

Required Methods§

Source

fn is_self(peer: Self::Peer<'_>) -> bool

Whether peer is the calling rank.

Source

fn send_bytes(&self, to: Self::Peer<'_>, tag: Tag, buffer: &[u8])

Blocking send of buffer as bytes.

Source

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.

Source

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".

Implementors§