Skip to main content

OpInput

Trait OpInput 

Source
pub trait OpInput<'a, T: Dist> { }
Expand description

This trait is used to represent the input to a batched LamellarArray element-wise operation.

§Contents

§Overview

Valid inputs to batched operations are essentially “safe” list-like data structures, such as Vec<T> and slice &[T]. We have also provided functions on the LamellarArray types that allow you to access a PE’s local data. These functions appropriately protect the local data so the the safety guarantees of the given array type are maintained. See a list of batch-compatible input types and type conversion methods below.

Currently it is not recommended to try to implement this for your types. Rather you should try to convert to a slice if possible.

§Batch-compatible input types and type conversion methods

Methods that return a batch-compatible input type (and the array type that provides it):

Batch-compatible input types:

  • T and &T
  • &[T]
    • the local data of a ReadOnlyArray is directly the underlying slice
    • read_only_array.local_data();
  • Vec[T] and &Vec[T]
  • AtomicLocalData
    • atomic_array.local_data();
  • LocalLockLocalData
    • local_lock_array.read_local_data();
    • local_lock_array.write_local_data();
  • GlobalLockLocalData
    • global_lock_array.read_local_data();
    • global_lock_array.write_local_data();

It is possible to use a LamellarMemoryRegion or UnsafeArray as the parent source, but these will require unsafe calls to retrieve the underlying slices. The retrieved slices can then be used for the batched operation

 unsafe { onesided_mem_region.as_slice().expect("not on allocating PE") };
 unsafe { shared_mem_region.as_slice() };
 unsafe { unsafe_array.local_data() };

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a Vec<T>

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a [T]

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a mut (dyn Iterator<Item = T> + 'a)

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a mut Vec<T>

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a mut [T]

Source§

impl<'a, T: Dist> OpInput<'a, T> for &T

Source§

impl<'a, T: Dist> OpInput<'a, T> for Vec<T>

Implementors§

Source§

impl<'a, T: Dist + ElementOps> OpInput<'a, T> for &AtomicLocalData<T>

Source§

impl<'a, T: Dist + ElementOps> OpInput<'a, T> for AtomicLocalData<T>

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a GlobalLockLocalData<T>

Source§

impl<'a, T: Dist> OpInput<'a, T> for &'a LocalLockLocalData<T>

Source§

impl<'a, T: Dist> OpInput<'a, T> for T