pub enum LamellarWriteArray<T: Dist> {
UnsafeArray(UnsafeArray<T>),
AtomicArray(AtomicArray<T>),
LocalLockArray(LocalLockArray<T>),
GlobalLockArray(GlobalLockArray<T>),
}Expand description
Represents the array types that allow write operations
Variants§
UnsafeArray(UnsafeArray<T>)
AtomicArray(AtomicArray<T>)
LocalLockArray(LocalLockArray<T>)
GlobalLockArray(GlobalLockArray<T>)
Trait Implementations§
Source§impl<T: Dist> ActiveMessaging for LamellarWriteArray<T>
impl<T: Dist> ActiveMessaging for LamellarWriteArray<T>
Source§type SinglePeAmHandle<R: AmDist> = AmHandle<R>
type SinglePeAmHandle<R: AmDist> = AmHandle<R>
Source§type MultiAmHandle<R: AmDist> = MultiAmHandle<R>
type MultiAmHandle<R: AmDist> = MultiAmHandle<R>
Source§type LocalAmHandle<L> = LocalAmHandle<L>
type LocalAmHandle<L> = LocalAmHandle<L>
Source§fn exec_am_all<F>(&self, am: F) -> Self::MultiAmHandle<F::Output>
fn exec_am_all<F>(&self, am: F) -> Self::MultiAmHandle<F::Output>
Source§fn exec_am_pe<F>(&self, pe: usize, am: F) -> Self::SinglePeAmHandle<F::Output>
fn exec_am_pe<F>(&self, pe: usize, am: F) -> Self::SinglePeAmHandle<F::Output>
Source§fn exec_am_local<F>(&self, am: F) -> Self::LocalAmHandle<F::Output>where
F: LamellarActiveMessage + LocalAM + 'static,
fn exec_am_local<F>(&self, am: F) -> Self::LocalAmHandle<F::Output>where
F: LamellarActiveMessage + LocalAM + 'static,
Source§fn wait_all(&self)
fn wait_all(&self)
Source§fn await_all(&self) -> impl Future<Output = ()> + Send
fn await_all(&self) -> impl Future<Output = ()> + Send
Source§fn barrier(&self)
fn barrier(&self)
Source§fn async_barrier(&self) -> BarrierHandle
fn async_barrier(&self) -> BarrierHandle
Source§fn spawn<F>(&self, f: F) -> LamellarTask<F::Output> ⓘ
fn spawn<F>(&self, f: F) -> LamellarTask<F::Output> ⓘ
Source§fn block_on<F: Future>(&self, f: F) -> F::Output
fn block_on<F: Future>(&self, f: F) -> F::Output
Source§fn block_on_all<I>(
&self,
iter: I,
) -> Vec<<<I as IntoIterator>::Item as Future>::Output>where
I: IntoIterator,
<I as IntoIterator>::Item: Future + Send + 'static,
<<I as IntoIterator>::Item as Future>::Output: Send,
fn block_on_all<I>(
&self,
iter: I,
) -> Vec<<<I as IntoIterator>::Item as Future>::Output>where
I: IntoIterator,
<I as IntoIterator>::Item: Future + Send + 'static,
<<I as IntoIterator>::Item as Future>::Output: Send,
Source§impl<T: ElementArithmeticOps> ArithmeticOps<T> for LamellarWriteArray<T>
impl<T: ElementArithmeticOps> ArithmeticOps<T> for LamellarWriteArray<T>
Source§fn add(&self, index: usize, val: T) -> ArrayOpHandle
fn add(&self, index: usize, val: T) -> ArrayOpHandle
Source§fn batch_add<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayBatchOpHandle ⓘ
fn batch_add<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle ⓘ
Source§fn fetch_add(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
fn fetch_add(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
val into the element specified by index, returning the old value Read moreSource§fn batch_fetch_add<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayFetchBatchOpHandle<T> ⓘ
fn batch_fetch_add<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T> ⓘ
Source§fn sub<'a>(&self, index: usize, val: T) -> ArrayOpHandle
fn sub<'a>(&self, index: usize, val: T) -> ArrayOpHandle
Source§fn batch_sub<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayBatchOpHandle ⓘ
fn batch_sub<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle ⓘ
Source§fn fetch_sub<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
fn fetch_sub<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
val from the element specified by index, returning the old value Read moreSource§fn batch_fetch_sub<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayFetchBatchOpHandle<T> ⓘ
fn batch_fetch_sub<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T> ⓘ
Source§fn mul<'a>(&self, index: usize, val: T) -> ArrayOpHandle
fn mul<'a>(&self, index: usize, val: T) -> ArrayOpHandle
val by the element specified by index and stores the result. Read moreSource§fn batch_mul<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayBatchOpHandle ⓘ
fn batch_mul<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle ⓘ
Source§fn fetch_mul<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
fn fetch_mul<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
val with the element specified by index, returning the old value Read moreSource§fn batch_fetch_mul<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayFetchBatchOpHandle<T> ⓘ
fn batch_fetch_mul<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T> ⓘ
Source§fn div<'a>(&self, index: usize, val: T) -> ArrayOpHandle
fn div<'a>(&self, index: usize, val: T) -> ArrayOpHandle
index with the supplied val and stores the result Read moreSource§fn batch_div<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayBatchOpHandle ⓘ
fn batch_div<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle ⓘ
Source§fn fetch_div<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
fn fetch_div<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
index with the supplied val, returning the old value Read moreSource§fn batch_fetch_div<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayFetchBatchOpHandle<T> ⓘ
fn batch_fetch_div<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T> ⓘ
Source§fn rem<'a>(&self, index: usize, val: T) -> ArrayOpHandle
fn rem<'a>(&self, index: usize, val: T) -> ArrayOpHandle
index with the supplied val and stores the result Read moreSource§fn batch_rem<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayBatchOpHandle ⓘ
fn batch_rem<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle ⓘ
Source§fn fetch_rem<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
fn fetch_rem<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T> ⓘ
index with the supplied val, returning the old value Read moreSource§fn batch_fetch_rem<'a>(
&self,
index: impl OpInput<'a, usize>,
val: impl OpInput<'a, T>,
) -> ArrayFetchBatchOpHandle<T> ⓘ
fn batch_fetch_rem<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T> ⓘ
Source§impl<T: Clone + Dist> Clone for LamellarWriteArray<T>
impl<T: Clone + Dist> Clone for LamellarWriteArray<T>
Source§fn clone(&self) -> LamellarWriteArray<T>
fn clone(&self) -> LamellarWriteArray<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, T> Deserialize<'de> for LamellarWriteArray<T>
impl<'de, T> Deserialize<'de> for LamellarWriteArray<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<T: Dist> From<AtomicArray<T>> for LamellarWriteArray<T>
impl<T: Dist> From<AtomicArray<T>> for LamellarWriteArray<T>
Source§fn from(v: AtomicArray<T>) -> LamellarWriteArray<T>
fn from(v: AtomicArray<T>) -> LamellarWriteArray<T>
Source§impl<T: Dist> From<GlobalLockArray<T>> for LamellarWriteArray<T>
impl<T: Dist> From<GlobalLockArray<T>> for LamellarWriteArray<T>
Source§fn from(v: GlobalLockArray<T>) -> LamellarWriteArray<T>
fn from(v: GlobalLockArray<T>) -> LamellarWriteArray<T>
Source§impl<T: Dist> From<LocalLockArray<T>> for LamellarWriteArray<T>
impl<T: Dist> From<LocalLockArray<T>> for LamellarWriteArray<T>
Source§fn from(v: LocalLockArray<T>) -> LamellarWriteArray<T>
fn from(v: LocalLockArray<T>) -> LamellarWriteArray<T>
Source§impl<T: Dist> From<UnsafeArray<T>> for LamellarWriteArray<T>
impl<T: Dist> From<UnsafeArray<T>> for LamellarWriteArray<T>
Source§fn from(v: UnsafeArray<T>) -> LamellarWriteArray<T>
fn from(v: UnsafeArray<T>) -> LamellarWriteArray<T>
Source§impl<T: Dist> LamellarArray<T> for LamellarWriteArray<T>
impl<T: Dist> LamellarArray<T> for LamellarWriteArray<T>
Source§fn len(&self) -> usize
fn len(&self) -> usize
Returns the team used to construct this array, the PEs in the team represent the same PEs which have a slice of data of the array
§One-sided Operation
the result is returned only on the calling PE
§Examples
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let array: LocalLockArray<usize> = LocalLockArray::new(&world,100,Distribution::Cyclic).block();
let a_team = array.team();Return the total number of elements in this array
§One-sided Operation
the result is returned only on the calling PE
§Examples
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let array: UnsafeArray<usize> = UnsafeArray::new(&world,100,Distribution::Cyclic).block();
assert_eq!(100,array.len());Source§fn num_elems_local(&self) -> usize
fn num_elems_local(&self) -> usize
Return the number of elements of the array local to this PE
§One-sided Operation
the result is returned only on the calling PE
§Examples
Assume a 4 PE system
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let array = ReadOnlyArray::<usize>::new(&world,100,Distribution::Cyclic).block();
assert_eq!(25,array.num_elems_local());Source§fn pe_and_offset_for_global_index(
&self,
__enum_dispatch_arg_0: usize,
) -> Option<(usize, usize)>
fn pe_and_offset_for_global_index( &self, __enum_dispatch_arg_0: usize, ) -> Option<(usize, usize)>
Given a global index, calculate the PE and offset on that PE where the element actually resides. Returns None if the index is Out of bounds
§One-sided Operation
the result is returned only on the calling PE
§Examples
assume we have 4 PEs
§Block
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let block_array: UnsafeArray<usize> = UnsafeArray::new(&world,16,Distribution::Block).block();
// block array index location = PE0 [0,1,2,3], PE1 [4,5,6,7], PE2 [8,9,10,11], PE3 [12,13,14,15]
let Some((pe,offset)) = block_array.pe_and_offset_for_global_index(6) else { panic!("out of bounds");};
assert_eq!((pe,offset) ,(1,2));§Cyclic
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let cyclic_array: UnsafeArray<usize> = UnsafeArray::new(world,16,Distribution::Cyclic).block();
// cyclic array index location = PE0 [0,4,8,12], PE1 [1,5,9,13], PE2 [2,6,10,14], PE3 [3,7,11,15]
let Some((pe,offset)) = cyclic_array.pe_and_offset_for_global_index(6) else { panic!("out of bounds");};
assert_eq!((pe,offset) ,(2,1));Source§fn first_global_index_for_pe(
&self,
__enum_dispatch_arg_0: usize,
) -> Option<usize>
fn first_global_index_for_pe( &self, __enum_dispatch_arg_0: usize, ) -> Option<usize>
Given a PE, return the global index of the first element on that PE Returns None if no data exists on that PE
§One-sided Operation
the result is returned only on the calling PE
§Examples
assume we have 4 PEs
§Block
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let block_array: UnsafeArray<usize> = UnsafeArray::new(&world,16,Distribution::Block).block();
// block array index location = PE0 [0,1,2,3], PE1 [4,5,6,7], PE2 [8,9,10,11], PE3 [12,13,14,15]
let index = block_array.first_global_index_for_pe(0).unwrap();
assert_eq!(index , 0);
let index = block_array.first_global_index_for_pe(1).unwrap();
assert_eq!(index , 4);
let index = block_array.first_global_index_for_pe(2).unwrap();
assert_eq!(index , 8);
let index = block_array.first_global_index_for_pe(3).unwrap();
assert_eq!(index , 12);§Cyclic
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let cyclic_array: UnsafeArray<usize> = UnsafeArray::new(world,16,Distribution::Cyclic).block();
// cyclic array index location = PE0 [0,4,8,12], PE1 [1,5,9,13], PE2 [2,6,10,14], PE3 [3,7,11,15]
let Some((pe,offset)) = cyclic_array.pe_and_offset_for_global_index(6) else { panic!("out of bounds");};
let index = cyclic_array.first_global_index_for_pe(0).unwrap();
assert_eq!(index , 0);
let index = cyclic_array.first_global_index_for_pe(1).unwrap();
assert_eq!(index , 1);
let index = cyclic_array.first_global_index_for_pe(2).unwrap();
assert_eq!(index , 2);
let index = cyclic_array.first_global_index_for_pe(3).unwrap();
assert_eq!(index , 3);Source§fn last_global_index_for_pe(
&self,
__enum_dispatch_arg_0: usize,
) -> Option<usize>
fn last_global_index_for_pe( &self, __enum_dispatch_arg_0: usize, ) -> Option<usize>
Given a PE, return the global index of the first element on that PE Returns None if no data exists on that PE
§One-sided Operation
the result is returned only on the calling PE
§Examples
assume we have 4 PEs
§Block
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let block_array: UnsafeArray<usize> = UnsafeArray::new(&world,16,Distribution::Block).block();
// block array index location = PE0 [0,1,2,3], PE1 [4,5,6,7], PE2 [8,9,10,11], PE3 [12,13,14,15]
let index = block_array.last_global_index_for_pe(0).unwrap();
assert_eq!(index , 3);
let index = block_array.last_global_index_for_pe(1).unwrap();
assert_eq!(index , 7);
let index = block_array.last_global_index_for_pe(2).unwrap();
assert_eq!(index , 11);
let index = block_array.last_global_index_for_pe(3).unwrap();
assert_eq!(index , 15);§Cyclic
use lamellar::array::prelude::*;
let world = LamellarWorldBuilder::new().build();
let cyclic_array: UnsafeArray<usize> = UnsafeArray::new(world,16,Distribution::Cyclic).block();
// cyclic array index location = PE0 [0,4,8,12], PE1 [1,5,9,13], PE2 [2,6,10,14], PE3 [3,7,11,15]
let Some((pe,offset)) = cyclic_array.pe_and_offset_for_global_index(6) else { panic!("out of bounds");};
let index = cyclic_array.last_global_index_for_pe(0).unwrap();
assert_eq!(index , 12);
let index = cyclic_array.last_global_index_for_pe(1).unwrap();
assert_eq!(index , 13);
let index = cyclic_array.last_global_index_for_pe(2).unwrap();
assert_eq!(index , 14);
let index = cyclic_array.last_global_index_for_pe(3).unwrap();
assert_eq!(index , 15);