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

Method new_async

crates/cust/src/memory/device/device_box.rs:86–90  ·  view source on GitHub ↗

Allocates device memory asynchronously and asynchronously copies `val` into it. This doesn't actually allocate if `T` is zero-sized. If the memory behind `val` is not page-locked (pinned), a staging buffer will be allocated using a worker thread. If you are going to be making many asynchronous copies, it is generally a good idea to keep the data as a [`crate::memory::LockedBuffer`] or [`crate::m

(val: &T, stream: &Stream)

Source from the content-addressed store, hash-verified

84 /// # Ok(())
85 /// # }
86 pub unsafe fn new_async(val: &T, stream: &Stream) -> CudaResult<Self> {
87 let mut dev_box = DeviceBox::uninitialized_async(stream)?;
88 dev_box.async_copy_from(val, stream)?;
89 Ok(dev_box)
90 }
91
92 /// Enqueues an operation to free the memory backed by this [`DeviceBox`] on a
93 /// particular stream. The stream will free the allocation as soon as it reaches

Callers

nothing calls this directly

Calls 1

async_copy_fromMethod · 0.45

Tested by

no test coverage detected