Skip to main content

mem_prefetch

Function mem_prefetch 

Source
pub fn mem_prefetch(
    ptr: u64,
    count: usize,
    device: &Device,
    stream: &Stream,
) -> CudaResult<()>
Expand description

Prefetches unified memory to the specified device.

This is an asynchronous operation enqueued on stream. The data is migrated to the target device so that subsequent accesses from that device will not cause page faults.

§Parameters

  • ptr — device pointer to the start of the unified memory region.
  • count — size of the region in bytes.
  • device — the target device to prefetch to.
  • stream — the stream on which to enqueue the prefetch.

§Errors

Returns an error if the pointer is not a managed allocation, the device is invalid, or the driver call fails.