[−][src]Trait rustacuda::memory::AsyncCopyDestination
Sealed trait implemented by types which can be the source or destination when copying data asynchronously to/from the device or from one device allocation to another.
Safety
The functions of this trait are unsafe because they return control to the calling code while the copy operation could still be occurring in the background. This could allow calling code to read, modify or deallocate the destination buffer, or to modify or deallocate the source buffer resulting in a data race and undefined behavior.
Thus to enforce safety, the following invariants must be upheld:
- The source and destination are not deallocated
- The source is not modified
- The destination is not written or read by any other operation
These invariants must be preserved until the stream is synchronized or an event queued after the copy is triggered.
Required methods
unsafe fn async_copy_from(
&mut self,
source: &O,
stream: &Stream
) -> CudaResult<()>
&mut self,
source: &O,
stream: &Stream
) -> CudaResult<()>
Asynchronously copy data from source
. source
must be the same size as self
.
Host memory used as a source or destination must be page-locked.
Safety
For why this function is unsafe, see AsyncCopyDestination
Errors
If a CUDA error occurs, return the error.
unsafe fn async_copy_to(&self, dest: &mut O, stream: &Stream) -> CudaResult<()>
Asynchronously copy data to dest
. dest
must be the same size as self
.
Host memory used as a source or destination must be page-locked.
Safety
For why this function is unsafe, see AsyncCopyDestination
Errors
If a CUDA error occurs, return the error.
Implementors
impl<T: DeviceCopy> AsyncCopyDestination<DeviceBox<T>> for DeviceBox<T>
[src]
unsafe fn async_copy_from(
&mut self,
val: &DeviceBox<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&mut self,
val: &DeviceBox<T>,
stream: &Stream
) -> CudaResult<()>
unsafe fn async_copy_to(
&self,
val: &mut DeviceBox<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&self,
val: &mut DeviceBox<T>,
stream: &Stream
) -> CudaResult<()>
impl<T: DeviceCopy> AsyncCopyDestination<DeviceBuffer<T>> for DeviceSlice<T>
[src]
unsafe fn async_copy_from(
&mut self,
val: &DeviceBuffer<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&mut self,
val: &DeviceBuffer<T>,
stream: &Stream
) -> CudaResult<()>
unsafe fn async_copy_to(
&self,
val: &mut DeviceBuffer<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&self,
val: &mut DeviceBuffer<T>,
stream: &Stream
) -> CudaResult<()>
impl<T: DeviceCopy> AsyncCopyDestination<DeviceSlice<T>> for DeviceSlice<T>
[src]
unsafe fn async_copy_from(
&mut self,
val: &DeviceSlice<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&mut self,
val: &DeviceSlice<T>,
stream: &Stream
) -> CudaResult<()>
unsafe fn async_copy_to(
&self,
val: &mut DeviceSlice<T>,
stream: &Stream
) -> CudaResult<()>
[src]
&self,
val: &mut DeviceSlice<T>,
stream: &Stream
) -> CudaResult<()>