Function rcudnn::cudaMemRangeGetAttribute[][src]

pub unsafe extern "C" fn cudaMemRangeGetAttribute(
    data: *mut c_void,
    dataSize: usize,
    attribute: cudaMemRangeAttribute,
    devPtr: *const c_void,
    count: usize
) -> cudaError
Expand description

\brief Query an attribute of a given memory range

Query an attribute about the memory range starting at \p devPtr with a size of \p count bytes. The memory range must refer to managed memory allocated via ::cudaMallocManaged or declared via managed variables.

The \p attribute parameter can take the following values:

  • ::cudaMemRangeAttributeReadMostly: If this attribute is specified, \p data will be interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be 1 if all pages in the given memory range have read-duplication enabled, or 0 otherwise.
  • ::cudaMemRangeAttributePreferredLocation: If this attribute is specified, \p data will be interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be a GPU device id if all pages in the memory range have that GPU as their preferred location, or it will be cudaCpuDeviceId if all pages in the memory range have the CPU as their preferred location, or it will be cudaInvalidDeviceId if either all the pages don’t have the same preferred location or some of the pages don’t have a preferred location at all. Note that the actual location of the pages in the memory range at the time of the query may be different from the preferred location.
  • ::cudaMemRangeAttributeAccessedBy: If this attribute is specified, \p data will be interpreted as an array of 32-bit integers, and \p dataSize must be a non-zero multiple of 4. The result returned will be a list of device ids that had ::cudaMemAdviceSetAccessedBy set for that entire memory range. If any device does not have that advice set for the entire memory range, that device will not be included. If \p data is larger than the number of devices that have that advice set for that memory range, cudaInvalidDeviceId will be returned in all the extra space provided. For ex., if \p dataSize is 12 (i.e. \p data has 3 elements) and only device 0 has the advice set, then the result returned will be { 0, cudaInvalidDeviceId, cudaInvalidDeviceId }. If \p data is smaller than the number of devices that have that advice set, then only as many devices will be returned as can fit in the array. There is no guarantee on which specific devices will be returned, however.
  • ::cudaMemRangeAttributeLastPrefetchLocation: If this attribute is specified, \p data will be interpreted as a 32-bit integer, and \p dataSize must be 4. The result returned will be the last location to which all pages in the memory range were prefetched explicitly via ::cudaMemPrefetchAsync. This will either be a GPU id or cudaCpuDeviceId depending on whether the last location for prefetch was a GPU or the CPU respectively. If any page in the memory range was never explicitly prefetched or if all pages were not prefetched to the same location, cudaInvalidDeviceId will be returned. Note that this simply returns the last location that the applicaton requested to prefetch the memory range to. It gives no indication as to whether the prefetch operation to that location has completed or even begun.

\param data - A pointers to a memory location where the result of each attribute query will be written to. \param dataSize - Array containing the size of data \param attribute - The attribute to query \param devPtr - Start of the range to query \param count - Size of the range to query

\return ::cudaSuccess, ::cudaErrorInvalidValue \notefnerr \note_async \note_null_stream \note_init_rt \note_callback

\sa ::cudaMemRangeGetAttributes, ::cudaMemPrefetchAsync, ::cudaMemAdvise, ::cuMemRangeGetAttribute