(&mut self, val: &T, stream: &Stream)
| 466 | } |
| 467 | impl<T: DeviceCopy> AsyncCopyDestination<T> for DeviceBox<T> { |
| 468 | unsafe fn async_copy_from(&mut self, val: &T, stream: &Stream) -> CudaResult<()> { |
| 469 | let size = mem::size_of::<T>(); |
| 470 | if size != 0 { |
| 471 | cuda::cuMemcpyHtoDAsync_v2( |
| 472 | self.ptr.as_raw(), |
| 473 | val as *const _ as *const c_void, |
| 474 | size, |
| 475 | stream.as_inner(), |
| 476 | ) |
| 477 | .to_result()? |
| 478 | } |
| 479 | Ok(()) |
| 480 | } |
| 481 | |
| 482 | unsafe fn async_copy_to(&self, val: &mut T, stream: &Stream) -> CudaResult<()> { |
| 483 | let size = mem::size_of::<T>(); |