pub struct CartesianCut { /* private fields */ }
Expand description
Select a block in source/destination sets to send traffic according to a pattern and the remainder according to another. The uncut_sides
parameter define a large block that may be the whole set, otherwise discarding elements from the end. The cut_sides
parameter defines a subblock embedded in the former. This defines two sets of nodes: the ones in the subblock and the rest. A pattern can be provided for each of these two sets. It is possible to specify offsets and strides for the subblock.
For example, in a network with 150 servers we could do the following to see it as a [3,10,5]
block with an [3,4,3]
block embedded in it. The small block of 36 server selects destinations randomly inside it. The rest of the network, 150-36=114
servers also send randomly among themselves. No message is send between those two sets. The middle dimension has offset 1, so coordinates [x,0,z]
are out of the small block. It has also stride 2, so it only includes odd y
coordinates. More precisely, it includes those [x,y,z]
with any x
, z<3
, and y=2k+1
for k<4
.
CartesianCut{
uncut_sides: [3,10,5],
cut_sides: [3,4,3],
cut_strides: [1,2,1],// defaults to a 1s vector
cut_offsets: [0,1,0],// defaults to a 0s vector
cut_pattern: Uniform,
remainder_pattern: Uniform,//defaults to Identity
}
This same example would work for more than 150 servers, putting all that excess in the large set.
Another notable example is to combine several of them. Here, we use a decomposition of the previous whole [3,10,5]
block into two disjoint blocks of size [3,5,5]
. The offset is chosen to make sure of both being disjoint (a packing) and covering the whole. Then we select a pattern for each block. Since the two patterns are disjoint the can be composed to obtain a pattern that follows each of the blocks.
Composition{patterns:[
CartesianCut{
uncut_sides: [3,10,5],
cut_sides: [3,5,5],
cut_offsets: [0,0,0],
cut_pattern: RandomPermutation,
//remainder_pattern: Identity,
},
CartesianCut{
uncut_sides: [3,10,5],
cut_sides: [3,5,5],
cut_offsets: [0,5,0],
cut_pattern: Uniform,
//remainder_pattern: Identity,
},
]}
Implementations§
Source§impl CartesianCut
impl CartesianCut
pub fn new(arg: PatternBuilderArgument<'_>) -> CartesianCut
Trait Implementations§
Source§impl Debug for CartesianCut
impl Debug for CartesianCut
Source§impl Pattern for CartesianCut
impl Pattern for CartesianCut
Source§fn initialize(
&mut self,
source_size: usize,
target_size: usize,
topology: &dyn Topology,
rng: &mut StdRng,
)
fn initialize( &mut self, source_size: usize, target_size: usize, topology: &dyn Topology, rng: &mut StdRng, )
Source§impl Quantifiable for CartesianCut
impl Quantifiable for CartesianCut
Source§fn total_memory(&self) -> usize
fn total_memory(&self) -> usize
Source§fn print_memory_breakdown(&self)
fn print_memory_breakdown(&self)
Source§fn forecast_total_memory(&self) -> usize
fn forecast_total_memory(&self) -> usize
Auto Trait Implementations§
impl Freeze for CartesianCut
impl !RefUnwindSafe for CartesianCut
impl !Send for CartesianCut
impl !Sync for CartesianCut
impl Unpin for CartesianCut
impl !UnwindSafe for CartesianCut
Blanket Implementations§
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more