[][src]Trait rustacuda::memory::AsyncCopyDestination

pub trait AsyncCopyDestination<O: ?Sized>: Sealed {
    unsafe fn async_copy_from(
        &mut self,
        source: &O,
        stream: &Stream
    ) -> CudaResult<()>;
unsafe fn async_copy_to(
        &self,
        dest: &mut O,
        stream: &Stream
    ) -> CudaResult<()>; }

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:

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<()>

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.

Loading content...

Implementors

impl<T: DeviceCopy> AsyncCopyDestination<DeviceBox<T>> for DeviceBox<T>[src]

impl<T: DeviceCopy> AsyncCopyDestination<DeviceBuffer<T>> for DeviceSlice<T>[src]

impl<T: DeviceCopy> AsyncCopyDestination<DeviceSlice<T>> for DeviceSlice<T>[src]

impl<T: DeviceCopy, I: AsRef<[T]> + AsMut<[T]> + ?Sized> AsyncCopyDestination<I> for DeviceSlice<T>[src]

Loading content...