pub struct Status(/* private fields */);
Expand description
Implementations§
Source§impl Status
impl Status
Sourcepub fn from_raw(status: MPI_Status) -> Status
pub fn from_raw(status: MPI_Status) -> Status
Construct a Status
value from the raw MPI type
Sourcepub fn source_rank(&self) -> Rank
pub fn source_rank(&self) -> Rank
The rank of the message source
Examples found in repository?
examples/readme.rs (line 30)
7fn main() {
8 let universe = mpi::initialize().unwrap();
9 let world = universe.world();
10 let size = world.size();
11 let rank = world.rank();
12
13 let next_rank = if rank + 1 < size { rank + 1 } else { 0 };
14 let previous_rank = if rank > 0 { rank - 1 } else { size - 1 };
15
16 let msg = vec![rank, 2 * rank, 4 * rank];
17 mpi::request::scope(|scope| {
18 let _sreq = WaitGuard::from(
19 world
20 .process_at_rank(next_rank)
21 .immediate_send(scope, &msg[..]),
22 );
23
24 let (msg, status) = world.any_process().receive_vec();
25
26 println!(
27 "Process {} got message {:?}.\nStatus is: {:?}",
28 rank, msg, status
29 );
30 let x = status.source_rank();
31 assert_eq!(x, previous_rank);
32 assert_eq!(vec![x, 2 * x, 4 * x], msg);
33
34 let root_rank = 0;
35 let root_process = world.process_at_rank(root_rank);
36
37 let mut a;
38 if world.rank() == root_rank {
39 a = vec![2, 4, 8, 16];
40 println!("Root broadcasting value: {:?}.", &a[..]);
41 } else {
42 a = vec![0; 4];
43 }
44 root_process.broadcast_into(&mut a[..]);
45 println!("Rank {} received value: {:?}.", world.rank(), &a[..]);
46 assert_eq!(&a[..], &[2, 4, 8, 16]);
47 });
48}
More examples
examples/send_receive.rs (line 38)
8fn main() {
9 let universe = mpi::initialize().unwrap();
10 let world = universe.world();
11 let size = world.size();
12 let rank = world.rank();
13
14 let next_rank = if rank + 1 < size { rank + 1 } else { 0 };
15 let next_process = world.process_at_rank(next_rank);
16 let previous_rank = if rank > 0 { rank - 1 } else { size - 1 };
17 let previous_process = world.process_at_rank(previous_rank);
18
19 let (msg, status): (Rank, _) = p2p::send_receive(&rank, &previous_process, &next_process);
20 println!(
21 "Process {} got message {}.\nStatus is: {:?}",
22 rank, msg, status
23 );
24 world.barrier();
25 assert_eq!(msg, next_rank);
26
27 if rank > 0 {
28 let msg = vec![rank, rank + 1, rank - 1];
29 world.process_at_rank(0).send(&msg[..]);
30 } else {
31 for _ in 1..size {
32 let (msg, status) = world.any_process().receive_vec::<Rank>();
33 println!(
34 "Process {} got long message {:?}.\nStatus is: {:?}",
35 rank, msg, status
36 );
37
38 let x = status.source_rank();
39 let v = vec![x, x + 1, x - 1];
40 assert_eq!(v, msg);
41 }
42 }
43 world.barrier();
44
45 let mut x = rank;
46 p2p::send_receive_replace_into(&mut x, &next_process, &previous_process);
47 assert_eq!(x, previous_rank);
48}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnwindSafe for Status
Blanket Implementations§
Source§impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
impl<Src, Scheme> ApproxFrom<Src, Scheme> for Srcwhere
Scheme: ApproxScheme,
Source§fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
fn approx_from(src: Src) -> Result<Src, <Src as ApproxFrom<Src, Scheme>>::Err>
Convert the given value into an approximately equivalent representation.
Source§impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
impl<Dst, Src, Scheme> ApproxInto<Dst, Scheme> for Srcwhere
Dst: ApproxFrom<Src, Scheme>,
Scheme: ApproxScheme,
Source§type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
type Err = <Dst as ApproxFrom<Src, Scheme>>::Err
The error type produced by a failed conversion.
Source§fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
fn approx_into(self) -> Result<Dst, <Src as ApproxInto<Dst, Scheme>>::Err>
Convert the subject into an approximately equivalent representation.
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, Dst> ConvAsUtil<Dst> for T
impl<T, Dst> ConvAsUtil<Dst> for T
Source§impl<T> ConvUtil for T
impl<T> ConvUtil for T
Source§fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
fn approx_as<Dst>(self) -> Result<Dst, Self::Err>where
Self: Sized + ApproxInto<Dst>,
Approximate the subject to a given type with the default scheme.
Source§fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
fn approx_as_by<Dst, Scheme>(self) -> Result<Dst, Self::Err>
Approximate the subject to a given type with a specific scheme.