Skip to main content

apply_migration_policy

Function apply_migration_policy 

Source
pub fn apply_migration_policy(
    ptr: u64,
    byte_size: usize,
    policy: &MigrationPolicy,
    device: &Device,
) -> CudaResult<()>
Expand description

Applies a MigrationPolicy to a raw unified memory region.

This is a convenience function that translates the high-level policy into the appropriate mem_advise calls.

§Parameters

  • ptr — device pointer to the managed allocation.
  • byte_size — size of the region in bytes.
  • policy — the migration policy to apply.
  • device — the device to which hints are directed.

§Errors

Forwards any error from the underlying driver call. Returns CudaError::InvalidValue if byte_size is zero (when policy is not Default).