pub struct GPUNdarray<T, D>where
T: Clone + Send + Sync + 'static + Zero + Div<f64, Output = T>,
D: Clone + Send + Sync + 'static + RemoveAxis + Dimension,{ /* private fields */ }
Expand description
A mock implementation of a GPU array
Implementations§
Source§impl<T, D> GPUNdarray<T, D>
impl<T, D> GPUNdarray<T, D>
Sourcepub fn new(host_data: Array<T, D>, config: GPUConfig) -> Self
pub fn new(host_data: Array<T, D>, config: GPUConfig) -> Self
Create a new GPU array from a host array.
Sourcepub fn host_data_mut(&mut self) -> &mut Array<T, D>
pub fn host_data_mut(&mut self) -> &mut Array<T, D>
Get a mutable reference to the host data.
Sourcepub fn execute_kernel<F, R>(&self, kernel: F) -> CoreResult<R>
pub fn execute_kernel<F, R>(&self, kernel: F) -> CoreResult<R>
Sourcepub fn sync_to_host(&mut self) -> CoreResult<()>
pub fn sync_to_host(&mut self) -> CoreResult<()>
Sourcepub fn sync_to_gpu(&mut self) -> CoreResult<()>
pub fn sync_to_gpu(&mut self) -> CoreResult<()>
Trait Implementations§
Source§impl<T, D> ArrayProtocol for GPUNdarray<T, D>
impl<T, D> ArrayProtocol for GPUNdarray<T, D>
Source§fn array_function(
&self,
func: &ArrayFunction,
_types: &[TypeId],
args: &[Box<dyn Any>],
kwargs: &HashMap<String, Box<dyn Any>>,
) -> Result<Box<dyn Any>, NotImplemented>
fn array_function( &self, func: &ArrayFunction, _types: &[TypeId], args: &[Box<dyn Any>], kwargs: &HashMap<String, Box<dyn Any>>, ) -> Result<Box<dyn Any>, NotImplemented>
Implementation of the array protocol. Read more
Source§fn shape(&self) -> &[usize]
fn shape(&self) -> &[usize]
Get the shape of the array (default implementation returns empty slice)
Source§fn box_clone(&self) -> Box<dyn ArrayProtocol>
fn box_clone(&self) -> Box<dyn ArrayProtocol>
Clone this array protocol object.
Source§impl<T, D> Clone for GPUNdarray<T, D>
impl<T, D> Clone for GPUNdarray<T, D>
Source§impl<T, D> Debug for GPUNdarray<T, D>
impl<T, D> Debug for GPUNdarray<T, D>
Source§impl<T, D> GPUArray for GPUNdarray<T, D>
impl<T, D> GPUArray for GPUNdarray<T, D>
Source§fn to_gpu(&self) -> CoreResult<Box<dyn GPUArray>>
fn to_gpu(&self) -> CoreResult<Box<dyn GPUArray>>
§Errors
Returns CoreError
if GPU transfer fails.
Source§fn to_cpu(&self) -> CoreResult<Box<dyn ArrayProtocol>>
fn to_cpu(&self) -> CoreResult<Box<dyn ArrayProtocol>>
§Errors
Returns CoreError
if CPU transfer fails.
Source§impl<T, D> MixedPrecisionSupport for GPUNdarray<T, D>
Implement MixedPrecisionSupport for GPUNdarray.
impl<T, D> MixedPrecisionSupport for GPUNdarray<T, D>
Implement MixedPrecisionSupport for GPUNdarray.
Source§fn to_precision(
&self,
precision: Precision,
) -> CoreResult<Box<dyn MixedPrecisionSupport>>
fn to_precision( &self, precision: Precision, ) -> CoreResult<Box<dyn MixedPrecisionSupport>>
Convert the array to the specified precision.
Source§fn supports_precision(&self, _precision: Precision) -> bool
fn supports_precision(&self, _precision: Precision) -> bool
Check if the array supports the specified precision.
Auto Trait Implementations§
impl<T, D> Freeze for GPUNdarray<T, D>where
D: Freeze,
impl<T, D> RefUnwindSafe for GPUNdarray<T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for GPUNdarray<T, D>
impl<T, D> Sync for GPUNdarray<T, D>
impl<T, D> Unpin for GPUNdarray<T, D>where
D: Unpin,
impl<T, D> UnwindSafe for GPUNdarray<T, D>where
D: UnwindSafe,
T: RefUnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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