pub struct SystemOperation(/* private fields */);
Expand description
Implementations§
Source§impl SystemOperation
impl SystemOperation
Sourcepub fn max() -> SystemOperation
pub fn max() -> SystemOperation
A built-in operation
Examples found in repository?
examples/immediate_reduce.rs (line 97)
68fn main() {
69 let universe = mpi::initialize().unwrap();
70 let world = universe.world();
71 let rank = world.rank();
72 let size = world.size();
73 let root_rank = 0;
74
75 if rank == root_rank {
76 let mut sum: Rank = 0;
77 mpi::request::scope(|scope| {
78 world
79 .process_at_rank(root_rank)
80 .immediate_reduce_into_root(scope, &rank, &mut sum, SystemOperation::sum())
81 .wait();
82 });
83 assert_eq!(sum, size * (size - 1) / 2);
84 } else {
85 mpi::request::scope(|scope| {
86 world
87 .process_at_rank(root_rank)
88 .immediate_reduce_into(scope, &rank, SystemOperation::sum())
89 .wait();
90 });
91 }
92
93 let mut max: Rank = -1;
94
95 mpi::request::scope(|scope| {
96 world
97 .immediate_all_reduce_into(scope, &rank, &mut max, SystemOperation::max())
98 .wait();
99 });
100 assert_eq!(max, size - 1);
101
102 let a = (0..size).collect::<Vec<_>>();
103 let mut b: Rank = 0;
104
105 mpi::request::scope(|scope| {
106 world
107 .immediate_reduce_scatter_block_into(scope, &a[..], &mut b, SystemOperation::product())
108 .wait();
109 });
110 assert_eq!(b, rank.wrapping_pow(size as u32));
111
112 test_user_operations(universe.world());
113
114 let mut d = 0;
115 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
116 mpi::request::scope(|scope| {
117 world
118 .immediate_all_reduce_into(scope, &rank, &mut d, &op)
119 .wait();
120 });
121 assert_eq!(d, size * (size - 1) / 2);
122}
More examples
examples/reduce.rs (line 90)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Sourcepub fn min() -> SystemOperation
pub fn min() -> SystemOperation
A built-in operation
Sourcepub fn sum() -> SystemOperation
pub fn sum() -> SystemOperation
A built-in operation
Examples found in repository?
examples/scan.rs (line 18)
12fn main() {
13 let universe = mpi::initialize().unwrap();
14 let world = universe.world();
15 let rank = world.rank();
16
17 let mut x = 0;
18 world.scan_into(&rank, &mut x, &SystemOperation::sum());
19 assert_eq!(x, (rank * (rank + 1)) / 2);
20
21 let y = rank + 1;
22 let mut z = 0;
23 world.exclusive_scan_into(&y, &mut z, &SystemOperation::product());
24 if rank > 0 {
25 assert_eq!(z, fac(y - 1));
26 }
27}
More examples
examples/immediate_scan.rs (line 20)
12fn main() {
13 let universe = mpi::initialize().unwrap();
14 let world = universe.world();
15 let rank = world.rank();
16
17 let mut x = 0;
18 mpi::request::scope(|scope| {
19 world
20 .immediate_scan_into(scope, &rank, &mut x, SystemOperation::sum())
21 .wait();
22 });
23 assert_eq!(x, (rank * (rank + 1)) / 2);
24
25 let y = rank + 1;
26 let mut z = 0;
27 mpi::request::scope(|scope| {
28 world
29 .immediate_exclusive_scan_into(scope, &y, &mut z, SystemOperation::product())
30 .wait();
31 });
32 if rank > 0 {
33 assert_eq!(z, fac(y - 1));
34 }
35}
examples/immediate_reduce.rs (line 80)
68fn main() {
69 let universe = mpi::initialize().unwrap();
70 let world = universe.world();
71 let rank = world.rank();
72 let size = world.size();
73 let root_rank = 0;
74
75 if rank == root_rank {
76 let mut sum: Rank = 0;
77 mpi::request::scope(|scope| {
78 world
79 .process_at_rank(root_rank)
80 .immediate_reduce_into_root(scope, &rank, &mut sum, SystemOperation::sum())
81 .wait();
82 });
83 assert_eq!(sum, size * (size - 1) / 2);
84 } else {
85 mpi::request::scope(|scope| {
86 world
87 .process_at_rank(root_rank)
88 .immediate_reduce_into(scope, &rank, SystemOperation::sum())
89 .wait();
90 });
91 }
92
93 let mut max: Rank = -1;
94
95 mpi::request::scope(|scope| {
96 world
97 .immediate_all_reduce_into(scope, &rank, &mut max, SystemOperation::max())
98 .wait();
99 });
100 assert_eq!(max, size - 1);
101
102 let a = (0..size).collect::<Vec<_>>();
103 let mut b: Rank = 0;
104
105 mpi::request::scope(|scope| {
106 world
107 .immediate_reduce_scatter_block_into(scope, &a[..], &mut b, SystemOperation::product())
108 .wait();
109 });
110 assert_eq!(b, rank.wrapping_pow(size as u32));
111
112 test_user_operations(universe.world());
113
114 let mut d = 0;
115 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
116 mpi::request::scope(|scope| {
117 world
118 .immediate_all_reduce_into(scope, &rank, &mut d, &op)
119 .wait();
120 });
121 assert_eq!(d, size * (size - 1) / 2);
122}
examples/reduce.rs (line 80)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Sourcepub fn product() -> SystemOperation
pub fn product() -> SystemOperation
A built-in operation
Examples found in repository?
examples/scan.rs (line 23)
12fn main() {
13 let universe = mpi::initialize().unwrap();
14 let world = universe.world();
15 let rank = world.rank();
16
17 let mut x = 0;
18 world.scan_into(&rank, &mut x, &SystemOperation::sum());
19 assert_eq!(x, (rank * (rank + 1)) / 2);
20
21 let y = rank + 1;
22 let mut z = 0;
23 world.exclusive_scan_into(&y, &mut z, &SystemOperation::product());
24 if rank > 0 {
25 assert_eq!(z, fac(y - 1));
26 }
27}
More examples
examples/immediate_scan.rs (line 29)
12fn main() {
13 let universe = mpi::initialize().unwrap();
14 let world = universe.world();
15 let rank = world.rank();
16
17 let mut x = 0;
18 mpi::request::scope(|scope| {
19 world
20 .immediate_scan_into(scope, &rank, &mut x, SystemOperation::sum())
21 .wait();
22 });
23 assert_eq!(x, (rank * (rank + 1)) / 2);
24
25 let y = rank + 1;
26 let mut z = 0;
27 mpi::request::scope(|scope| {
28 world
29 .immediate_exclusive_scan_into(scope, &y, &mut z, SystemOperation::product())
30 .wait();
31 });
32 if rank > 0 {
33 assert_eq!(z, fac(y - 1));
34 }
35}
examples/immediate_reduce.rs (line 107)
68fn main() {
69 let universe = mpi::initialize().unwrap();
70 let world = universe.world();
71 let rank = world.rank();
72 let size = world.size();
73 let root_rank = 0;
74
75 if rank == root_rank {
76 let mut sum: Rank = 0;
77 mpi::request::scope(|scope| {
78 world
79 .process_at_rank(root_rank)
80 .immediate_reduce_into_root(scope, &rank, &mut sum, SystemOperation::sum())
81 .wait();
82 });
83 assert_eq!(sum, size * (size - 1) / 2);
84 } else {
85 mpi::request::scope(|scope| {
86 world
87 .process_at_rank(root_rank)
88 .immediate_reduce_into(scope, &rank, SystemOperation::sum())
89 .wait();
90 });
91 }
92
93 let mut max: Rank = -1;
94
95 mpi::request::scope(|scope| {
96 world
97 .immediate_all_reduce_into(scope, &rank, &mut max, SystemOperation::max())
98 .wait();
99 });
100 assert_eq!(max, size - 1);
101
102 let a = (0..size).collect::<Vec<_>>();
103 let mut b: Rank = 0;
104
105 mpi::request::scope(|scope| {
106 world
107 .immediate_reduce_scatter_block_into(scope, &a[..], &mut b, SystemOperation::product())
108 .wait();
109 });
110 assert_eq!(b, rank.wrapping_pow(size as u32));
111
112 test_user_operations(universe.world());
113
114 let mut d = 0;
115 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
116 mpi::request::scope(|scope| {
117 world
118 .immediate_all_reduce_into(scope, &rank, &mut d, &op)
119 .wait();
120 });
121 assert_eq!(d, size * (size - 1) / 2);
122}
examples/reduce.rs (line 111)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Sourcepub fn logical_and() -> SystemOperation
pub fn logical_and() -> SystemOperation
A built-in operation
Sourcepub fn bitwise_and() -> SystemOperation
pub fn bitwise_and() -> SystemOperation
A built-in operation
Examples found in repository?
examples/reduce.rs (line 97)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Sourcepub fn logical_or() -> SystemOperation
pub fn logical_or() -> SystemOperation
A built-in operation
Sourcepub fn bitwise_or() -> SystemOperation
pub fn bitwise_or() -> SystemOperation
A built-in operation
Examples found in repository?
examples/reduce.rs (line 101)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Sourcepub fn logical_xor() -> SystemOperation
pub fn logical_xor() -> SystemOperation
A built-in operation
Sourcepub fn bitwise_xor() -> SystemOperation
pub fn bitwise_xor() -> SystemOperation
A built-in operation
Examples found in repository?
examples/reduce.rs (line 105)
69fn main() {
70 let universe = mpi::initialize().unwrap();
71 let world = universe.world();
72 let rank = world.rank();
73 let size = world.size();
74 let root_rank = 0;
75
76 if rank == root_rank {
77 let mut sum: Rank = 0;
78 world
79 .process_at_rank(root_rank)
80 .reduce_into_root(&rank, &mut sum, SystemOperation::sum());
81 assert_eq!(sum, size * (size - 1) / 2);
82 } else {
83 world
84 .process_at_rank(root_rank)
85 .reduce_into(&rank, SystemOperation::sum());
86 }
87
88 let mut max: Rank = -1;
89
90 world.all_reduce_into(&rank, &mut max, SystemOperation::max());
91 assert_eq!(max, size - 1);
92
93 let a: u16 = 0b0000_1111_1111_0000;
94 let b: u16 = 0b0011_1100_0011_1100;
95
96 let mut c = b;
97 collective::reduce_local_into(&a, &mut c, SystemOperation::bitwise_and());
98 assert_eq!(c, 0b0000_1100_0011_0000);
99
100 let mut d = b;
101 collective::reduce_local_into(&a, &mut d, SystemOperation::bitwise_or());
102 assert_eq!(d, 0b0011_1111_1111_1100);
103
104 let mut e = b;
105 collective::reduce_local_into(&a, &mut e, SystemOperation::bitwise_xor());
106 assert_eq!(e, 0b0011_0011_1100_1100);
107
108 let f = (0..size).collect::<Vec<_>>();
109 let mut g: Rank = 0;
110
111 world.reduce_scatter_block_into(&f[..], &mut g, SystemOperation::product());
112 assert_eq!(g, rank.wrapping_pow(size as u32));
113
114 test_user_operations(universe.world());
115
116 let mut i = 0;
117 let op = unsafe { UnsafeUserOperation::commutative(unsafe_add) };
118 world.all_reduce_into(&(rank + 1), &mut i, &op);
119 assert_eq!(i, size * (size + 1) / 2);
120}
Trait Implementations§
Source§impl AsRaw for SystemOperation
impl AsRaw for SystemOperation
Source§impl Clone for SystemOperation
impl Clone for SystemOperation
Source§fn clone(&self) -> SystemOperation
fn clone(&self) -> SystemOperation
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Operation for SystemOperation
impl Operation for SystemOperation
Source§fn is_commutative(&self) -> bool
fn is_commutative(&self) -> bool
Returns whether the operation is commutative. Read more
impl Copy for SystemOperation
Auto Trait Implementations§
impl Freeze for SystemOperation
impl RefUnwindSafe for SystemOperation
impl !Send for SystemOperation
impl !Sync for SystemOperation
impl Unpin for SystemOperation
impl UnwindSafe for SystemOperation
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.