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 forMigrationPolicy::ReadMostly. Ignored byMigrationPolicy::PreferHost(which always targets the CPU) and byMigrationPolicy::PreferDevice(which resolves its own ordinal viaDevice::getinstead, so the advice always targets the ordinal the caller declared in the policy rather than whateverdevicehappens to be).
§Errors
Forwards any error from the underlying driver call, including
CudaError::InvalidDevice if MigrationPolicy::PreferDevice’s
ordinal does not name a valid device.
Returns CudaError::InvalidValue if byte_size is zero (when
policy is not Default).