Advises the driver to enqueue an operation on the stream to prefetch the memory to a certain GPU. This will cause the driver to fetch the data to the specified device as soon as the operation is reached on the stream. The device must have the attribute [`DeviceAttribute::ConcurrentManagedAccess`]. # Example ```no_run # fn main() -> Result<(), Box > { # let _context = cust:
(&self, stream: &Stream, device: &Device)
| 671 | /// # } |
| 672 | /// ``` |
| 673 | fn prefetch_to_device(&self, stream: &Stream, device: &Device) -> CudaResult<()> { |
| 674 | let slice = self.as_slice(); |
| 675 | let mem_size = std::mem::size_of_val(slice); |
| 676 | |
| 677 | unsafe { |
| 678 | cuda::cuMemPrefetchAsync( |
| 679 | slice.as_ptr() as cuda::CUdeviceptr, |
| 680 | mem_size, |
| 681 | device.as_raw(), |
| 682 | stream.as_inner(), |
| 683 | ) |
| 684 | .to_result()?; |
| 685 | } |
| 686 | Ok(()) |
| 687 | } |
| 688 | |
| 689 | /// Advises the driver that this memory range is mostly going to be read to, and occasionally written to. |
| 690 | /// |