MCPcopy Create free account
hub / github.com/Rust-GPU/rust-cuda / from_slice_async

Method from_slice_async

crates/cust/src/memory/device/device_buffer.rs:387–391  ·  view source on GitHub ↗

Asynchronously allocate a new buffer of the same size as `slice`, initialized with a clone of the data in `slice`. # Safety For why this function is unsafe, see [AsyncCopyDestination](trait.AsyncCopyDestination.html) # Errors If the allocation fails, returns the error from CUDA. # Examples ``` # let _context = cust::quick_init().unwrap(); use cust::memory::*; use cust::stream::{Stream, Strea

(slice: &[T], stream: &Stream)

Source from the content-addressed store, hash-verified

385 /// }
386 /// ```
387 pub unsafe fn from_slice_async(slice: &[T], stream: &Stream) -> CudaResult<Self> {
388 let mut uninit = DeviceBuffer::uninitialized_async(slice.len(), stream)?;
389 uninit.async_copy_from(slice, stream)?;
390 Ok(uninit)
391 }
392
393 /// Explicitly creates a [`DeviceSlice`] from this buffer.
394 pub fn as_slice(&self) -> &DeviceSlice<T> {

Callers

nothing calls this directly

Calls 2

lenMethod · 0.45
async_copy_fromMethod · 0.45

Tested by

no test coverage detected