pub struct Map2D {
pub x_size: usize,
}Expand description
This mapping strategy is useful when we want to reshape a 1D array into a 2D array and then distribute one element to a thread one by one until consuming all. It creates a new non-continuous partition for each thread.
- IndexType is (usize, usize)
Example: Example:
- array: [T; 20]
- x_size = 5 => y_size = 4
- dim: x=2, y=2, z=1
0 1 2 3 4 5
┌───┬───┬───┬───┬───┐
│0,0│1,0│0,0│1,0│0,0│
├───┼───┼───┼───┼───┤
│0,1│1,1│0,1│1,1│0,1│
├───┼───┼───┼───┼───┤
│0,0│1,0│0,0│1,0│0,0│
├───┼───┼───┼───┼───┤
│0,1│1,1│0,1│1,1│0,1│
└───┴───┴───┴───┴───┘In this case,
- thread(1,0) and (1,1) should only have access to a shape of 2*2 = 4 elements.
- thread (0,0) and (0,1) have access to a shape of 3*2 = 6 elements.
Fields§
§x_size: usizeImplementations§
Trait Implementations§
Source§impl<CS: ChunkScope> ScopeUniqueMap<CS> for Map2D
impl<CS: ChunkScope> ScopeUniqueMap<CS> for Map2D
impl Copy for Map2D
Auto Trait Implementations§
impl Freeze for Map2D
impl RefUnwindSafe for Map2D
impl Send for Map2D
impl Sync for Map2D
impl Unpin for Map2D
impl UnwindSafe for Map2D
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
Mutably borrows from an owned value. Read more