Skip to main content

LamellarWriteArray

Enum LamellarWriteArray 

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

Source§

type SinglePeAmHandle<R: AmDist> = AmHandle<R>

The handle type for single PE active messages
Source§

type MultiAmHandle<R: AmDist> = MultiAmHandle<R>

The handle type for multi PE active messages
Source§

type LocalAmHandle<L> = LocalAmHandle<L>

The handle type for local active messages
Source§

fn exec_am_all<F>(&self, am: F) -> Self::MultiAmHandle<F::Output>
where F: RemoteActiveMessage + LamellarAM + Serde + AmDist,

launch and execute an active message on every PE (including originating PE). Read more
Source§

fn exec_am_pe<F>(&self, pe: usize, am: F) -> Self::SinglePeAmHandle<F::Output>
where F: RemoteActiveMessage + LamellarAM + Serde + AmDist,

launch and execute an active message on a specifc PE. Read more
Source§

fn exec_am_local<F>(&self, am: F) -> Self::LocalAmHandle<F::Output>
where F: LamellarActiveMessage + LocalAM + 'static,

launch and execute an active message on the calling PE. Read more
Source§

fn wait_all(&self)

blocks calling thread until all remote tasks (e.g. active mesages, array operations) initiated by the calling PE have completed. Read more
Source§

fn await_all(&self) -> impl Future<Output = ()> + Send

blocks calling task until all remote tasks (e.g. active mesages, array operations) initiated by the calling PE have completed. Intended to be used within an async context. Read more
Source§

fn barrier(&self)

Global synchronization method which blocks the calling thread until all PEs in the barrier group (e.g. World, Team, Array) have entered Generally this is intended to be called from the main thread, if a barrier is needed within an active message or async context please see async_barrier Read more
Source§

fn async_barrier(&self) -> BarrierHandle

EXPERIMENTAL: Global synchronization method which blocks the calling task until all PEs in the barrier group (e.g. World, Team, Array) have entered. This function allows for calling barrier in an async context without blocking the worker thread. Care should be taken when using this function to avoid deadlocks,as it is easy to mismatch barrier calls accross threads and PEs. Read more
Source§

fn spawn<F>(&self, f: F) -> LamellarTask<F::Output>
where F: Future + Send + 'static, F::Output: Send,

Spawns a future on the worker threadpool Read more
Source§

fn block_on<F: Future>(&self, f: F) -> F::Output

Run a future to completion on the current thread Read more
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,

Run a collection of futures to completion Read more
Source§

impl<T: ElementArithmeticOps> ArithmeticOps<T> for LamellarWriteArray<T>

Source§

fn add(&self, index: usize, val: T) -> ArrayOpHandle

This call adds the supplied val into the element specified by index Read more
Source§

fn batch_add<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle

This call performs a batched vesion of the add function, Read more
Source§

fn fetch_add(&self, index: usize, val: T) -> ArrayFetchOpHandle<T>

This call adds the supplied val into the element specified by index, returning the old value Read more
Source§

fn batch_fetch_add<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T>

This call performs a batched vesion of the fetch_add function, Read more
Source§

fn sub<'a>(&self, index: usize, val: T) -> ArrayOpHandle

This call subtracts the supplied val from the element specified by index Read more
Source§

fn batch_sub<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle

This call performs a batched vesion of the sub function, Read more
Source§

fn fetch_sub<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T>

This call subtracts the supplied val from the element specified by index, returning the old value Read more
Source§

fn batch_fetch_sub<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T>

This call performs a batched vesion of the fetch_sub function, Read more
Source§

fn mul<'a>(&self, index: usize, val: T) -> ArrayOpHandle

This call multiplies the supplied val by the element specified by index and stores the result. Read more
Source§

fn batch_mul<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle

This call performs a batched vesion of the mul function, Read more
Source§

fn fetch_mul<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T>

This call multiplies the supplied val with the element specified by index, returning the old value Read more
Source§

fn batch_fetch_mul<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T>

This call performs a batched vesion of the fetch_mul function, Read more
Source§

fn div<'a>(&self, index: usize, val: T) -> ArrayOpHandle

This call divides the element specified by index with the supplied val and stores the result Read more
Source§

fn batch_div<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle

This call performs a batched vesion of the div function, Read more
Source§

fn fetch_div<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T>

This call divides the element specified by index with the supplied val, returning the old value Read more
Source§

fn batch_fetch_div<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T>

This call performs a batched vesion of the fetch_div function, Read more
Source§

fn rem<'a>(&self, index: usize, val: T) -> ArrayOpHandle

This call divides the element specified by index with the supplied val and stores the result Read more
Source§

fn batch_rem<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayBatchOpHandle

This call performs a batched vesion of the rem function, Read more
Source§

fn fetch_rem<'a>(&self, index: usize, val: T) -> ArrayFetchOpHandle<T>

This call divides the element specified by index with the supplied val, returning the old value Read more
Source§

fn batch_fetch_rem<'a>( &self, index: impl OpInput<'a, usize>, val: impl OpInput<'a, T>, ) -> ArrayFetchBatchOpHandle<T>

This call performs a batched vesion of the fetch_rem function, Read more
Source§

impl<T: Clone + Dist> Clone for LamellarWriteArray<T>

Source§

fn clone(&self) -> LamellarWriteArray<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'de, T> Deserialize<'de> for LamellarWriteArray<T>

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T: Dist> From<AtomicArray<T>> for LamellarWriteArray<T>

Source§

fn from(v: AtomicArray<T>) -> LamellarWriteArray<T>

Converts to this type from the input type.
Source§

impl<T: Dist> From<GlobalLockArray<T>> for LamellarWriteArray<T>

Source§

fn from(v: GlobalLockArray<T>) -> LamellarWriteArray<T>

Converts to this type from the input type.
Source§

impl<T: Dist> From<LocalLockArray<T>> for LamellarWriteArray<T>

Source§

fn from(v: LocalLockArray<T>) -> LamellarWriteArray<T>

Converts to this type from the input type.
Source§

impl<T: Dist> From<UnsafeArray<T>> for LamellarWriteArray<T>

Source§

fn from(v: UnsafeArray<T>) -> LamellarWriteArray<T>

Converts to this type from the input type.
Source§

impl<T: Dist> LamellarArray<T> for LamellarWriteArray<T>

Source§

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

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)>

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>

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>

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

impl<T: Dist> LamellarEnv for LamellarWriteArray<T>

Source§

fn my_pe(&self) -> usize

Return the PE id of the calling PE, if called on a team instance, the PE id will be with respect to the team (not to the world)
Source§

fn num_pes(&self) -> usize

Return the number of PEs in the execution
Source§

fn num_threads_per_pe(&self) -> usize

Return the number of threads per PE
Source§

fn world(&self) -> Arc<LamellarTeam>

Return a pointer the world team
Source§

fn team(&self) -> Arc<LamellarTeam>

Return a pointer to the LamellarTeam
Source§

impl<T> Serialize for LamellarWriteArray<T>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T: Dist> TryInto<AtomicArray<T>> for LamellarWriteArray<T>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<AtomicArray<T>, <Self as TryInto<AtomicArray<T>>>::Error>

Performs the conversion.
Source§

impl<T: Dist> TryInto<GlobalLockArray<T>> for LamellarWriteArray<T>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<GlobalLockArray<T>, <Self as TryInto<GlobalLockArray<T>>>::Error>

Performs the conversion.
Source§

impl<T: Dist> TryInto<LocalLockArray<T>> for LamellarWriteArray<T>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<LocalLockArray<T>, <Self as TryInto<LocalLockArray<T>>>::Error>

Performs the conversion.
Source§

impl<T: Dist> TryInto<UnsafeArray<T>> for LamellarWriteArray<T>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<UnsafeArray<T>, <Self as TryInto<UnsafeArray<T>>>::Error>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AmDist for T
where T: Serialize + DeserializeOwned + SyncSend + 'static,

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, U> AsyncTeamInto<U> for T
where T: Send, U: AsyncTeamFrom<T>,

Source§

fn team_into<'life0, 'async_trait>( self, team: &'life0 Arc<LamellarTeam>, ) -> Pin<Box<dyn Future<Output = U> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

converts this type into the (usually inferred) input type
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SyncSend for T
where T: Sync + Send,

Source§

impl<T, U> TeamInto<U> for T
where U: TeamFrom<T>,

Source§

fn team_into(self, team: &Arc<LamellarTeam>) -> U

converts this type into the (usually inferred) input type
Source§

impl<T, U> TeamTryInto<U> for T
where U: TeamTryFrom<T>,

Source§

fn team_try_into(self, team: &Arc<LamellarTeam>) -> Result<U, Error>

Trys to convert this type into the (usually inferred) input type
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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