Struct CartesianCut

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

Trait Implementations§

Source§

impl Debug for CartesianCut

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Pattern for CartesianCut

Source§

fn initialize( &mut self, source_size: usize, target_size: usize, topology: &dyn Topology, rng: &mut StdRng, )

Fix the input and output size, providing the topology and random number generator. Careful with using topology in sub-patterns. For example, it may be misleading to use the dragonfly topology when building a pattern among groups or a pattern among the routers of a single group. Even just a pattern of routers instead of a pattern of servers can lead to mistakes. Read the documentation of the traffic or meta-pattern using the pattern to know what its their input and output.
Source§

fn get_destination( &self, origin: usize, topology: &dyn Topology, rng: &mut StdRng, ) -> usize

Obtain a destination of a source. This will be called repeatedly as the traffic requires destination for its messages.
Source§

impl Quantifiable for CartesianCut

Source§

fn total_memory(&self) -> usize

Get the total memory currently being employed by the implementing type. Both stack and heap.
Source§

fn print_memory_breakdown(&self)

Prints by stdout how much memory is used per component.
Source§

fn forecast_total_memory(&self) -> usize

Get an estimation on how much memory the type could reach during the simulation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V