Trait mpi::datatype::UncommittedDatatype

source ·
pub trait UncommittedDatatype: AsRaw<Raw = MPI_Datatype> {
    type DuplicatedDatatype: FromRaw<Raw = MPI_Datatype>;

    // Provided method
    fn dup(&self) -> Self::DuplicatedDatatype { ... }
}
Expand description

An UncommittedDatatype is a partial description of the layout of messages in memory which may not yet have been committed to an implementation-defined message format.

Committed datatypes can be treated as-if they are uncommitted.

Required Associated Types§

source

type DuplicatedDatatype: FromRaw<Raw = MPI_Datatype>

The type returned when the datatype is duplicated.

Provided Methods§

source

fn dup(&self) -> Self::DuplicatedDatatype

Creates a new datatype with the same key-values as this datatype.

§Standard section(s)

4.1.10

Examples found in repository?
examples/datatype_dup.rs (line 12)
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
fn main() {
    let universe = mpi::initialize().unwrap();
    let world = universe.world();

    let root_process = world.process_at_rank(0);

    let int_type = i32::equivalent_datatype().dup();

    let mut ints = if world.rank() == 0 {
        [1i32, 2, 3, 4]
    } else {
        [0, 0, 0, 0]
    };

    let mut buffer =
        unsafe { DynBufferMut::from_raw(ints.as_mut_ptr(), ints.count(), int_type.as_ref()) };

    root_process.broadcast_into(&mut buffer);

    assert_eq!([1, 2, 3, 4], ints);
}

Implementations on Foreign Types§

source§

impl<'a, D> UncommittedDatatype for &'a D
where D: 'a + UncommittedDatatype,

Implementors§