pub struct CudaView<'a, T> { /* private fields */ }Expand description
&[T] on a cuda device. An immutable sub-view into a CudaSlice created by CudaSlice::as_view()/CudaSlice::slice().
Implementations§
Source§impl<'a, T> CudaView<'a, T>
impl<'a, T> CudaView<'a, T>
Sourcepub fn view_ptr(self, stream: &'a CudaStream) -> (CUdeviceptr, SyncOnDrop<'a>)
pub fn view_ptr(self, stream: &'a CudaStream) -> (CUdeviceptr, SyncOnDrop<'a>)
Identical behavior to DevicePtr::device_ptr(), but the lifetime on the returned SyncOnDrop, matches the lifetime of the view.
Source§impl<'a, T> CudaView<'a, T>
impl<'a, T> CudaView<'a, T>
Sourcepub fn slice(&self, bounds: impl RangeBounds<usize>) -> Self
pub fn slice(&self, bounds: impl RangeBounds<usize>) -> Self
Sourcepub fn try_slice(&self, bounds: impl RangeBounds<usize>) -> Option<Self>
pub fn try_slice(&self, bounds: impl RangeBounds<usize>) -> Option<Self>
Fallible version of CudaView::slice
Sourcepub unsafe fn transmute<S>(&self, len: usize) -> Option<CudaView<'a, S>>
pub unsafe fn transmute<S>(&self, len: usize) -> Option<CudaView<'a, S>>
Reinterprets the slice of memory into a different type. len is the number
of elements of the new type S that are expected. If not enough bytes
are allocated in self for the view, then this returns None.
§Safety
This is unsafe because not the memory for the view may not be a valid interpretation
for the type S.
pub fn split_at(&self, mid: usize) -> (Self, Self)
Sourcepub fn try_split_at(&self, mid: usize) -> Option<(Self, Self)>
pub fn try_split_at(&self, mid: usize) -> Option<(Self, Self)>
Fallible version of CudaSlice::split_at.
Returns None if mid > self.len.
Sourcepub fn chunks_exact(
&self,
chunk_size: usize,
) -> impl Iterator<Item = CudaView<'a, T>> + '_
pub fn chunks_exact( &self, chunk_size: usize, ) -> impl Iterator<Item = CudaView<'a, T>> + '_
Returns an iterarow over subviews of size chunk_size. Differs from std::slice::ChunksExact,
in that it asserts that the chunk_size must divide evenly into the length, instead of returning
a remainder.