Function rcudnn::cudaPointerGetAttributes[][src]

pub unsafe extern "C" fn cudaPointerGetAttributes(
    attributes: *mut cudaPointerAttributes,
    ptr: *const c_void
) -> cudaError
Expand description

\brief Returns attributes about a specified pointer

Returns in \p *attributes the attributes of the pointer \p ptr. If pointer was not allocated in, mapped by or registered with context supporting unified addressing ::cudaErrorInvalidValue is returned.

\note In CUDA 11.0 forward passing host pointer will return ::cudaMemoryTypeUnregistered in ::cudaPointerAttributes::type and call will return ::cudaSuccess.

The ::cudaPointerAttributes structure is defined as: \code struct cudaPointerAttributes { enum cudaMemoryType type; int device; void *devicePointer; void *hostPointer; } \endcode In this structure, the individual fields mean

  • \ref ::cudaPointerAttributes::type identifies type of memory. It can be ::cudaMemoryTypeUnregistered for unregistered host memory, ::cudaMemoryTypeHost for registered host memory, ::cudaMemoryTypeDevice for device memory or ::cudaMemoryTypeManaged for managed memory.

  • \ref ::cudaPointerAttributes::device “device” is the device against which \p ptr was allocated. If \p ptr has memory type ::cudaMemoryTypeDevice then this identifies the device on which the memory referred to by \p ptr physically resides. If \p ptr has memory type ::cudaMemoryTypeHost then this identifies the device which was current when the allocation was made (and if that device is deinitialized then this allocation will vanish with that device’s state).

  • \ref ::cudaPointerAttributes::devicePointer “devicePointer” is the device pointer alias through which the memory referred to by \p ptr may be accessed on the current device. If the memory referred to by \p ptr cannot be accessed directly by the current device then this is NULL.

  • \ref ::cudaPointerAttributes::hostPointer “hostPointer” is the host pointer alias through which the memory referred to by \p ptr may be accessed on the host. If the memory referred to by \p ptr cannot be accessed directly by the host then this is NULL.

\param attributes - Attributes for the specified pointer \param ptr - Pointer to get attributes for

\return ::cudaSuccess, ::cudaErrorInvalidDevice, ::cudaErrorInvalidValue \note_init_rt \note_callback

\sa ::cudaGetDeviceCount, ::cudaGetDevice, ::cudaSetDevice, ::cudaChooseDevice, ::cuPointerGetAttributes