5.5. Device Management

This section describes the device management functions of the low-level CUDA driver application programming interface.

Functions

CUresult cuDeviceGet ( CUdevice* device, int  ordinal )
Returns a handle to a compute device.
CUresult cuDeviceGetAttribute ( int* pi, CUdevice_attribute attrib, CUdevice dev )
Returns information about the device.
CUresult cuDeviceGetCount ( int* count )
Returns the number of compute-capable devices.
CUresult cuDeviceGetLuid ( char* luid, unsigned int* deviceNodeMask, CUdevice dev )
Return an LUID and device node mask for the device.
CUresult cuDeviceGetName ( char* name, int  len, CUdevice dev )
Returns an identifer string for the device.
CUresult cuDeviceGetNvSciSyncAttributes ( void* nvSciSyncAttrList, CUdevice dev, int  flags )
Return NvSciSync attributes that this device can support.
CUresult cuDeviceGetTexture1DLinearMaxWidth ( size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev )
Returns the maximum number of elements allocatable in a 1D linear texture for a given texture element size.
CUresult cuDeviceGetUuid ( CUuuid* uuid, CUdevice dev )
Return an UUID for the device.
CUresult cuDeviceTotalMem ( size_t* bytes, CUdevice dev )
Returns the total amount of memory on the device.

Functions

CUresult cuDeviceGet ( CUdevice* device, int  ordinal )
Returns a handle to a compute device.
Parameters
device
- Returned device handle
ordinal
- Device number to get handle for
Description

Returns in *device a device handle given an ordinal in the range [0, cuDeviceGetCount()-1].

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetCount, cuDeviceGetName, cuDeviceGetUuid, cuDeviceGetLuid, cuDeviceTotalMem

CUresult cuDeviceGetAttribute ( int* pi, CUdevice_attribute attrib, CUdevice dev )
Returns information about the device.
Parameters
pi
- Returned device attribute value
attrib
- Device attribute to query
dev
- Device handle
Description

Returns in *pi the integer value of the attribute attrib on device dev. The supported attributes are:

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetCount, cuDeviceGetName, cuDeviceGetUuid, cuDeviceGet, cuDeviceTotalMem, cudaDeviceGetAttribute, cudaGetDeviceProperties

CUresult cuDeviceGetCount ( int* count )
Returns the number of compute-capable devices.
Parameters
count
- Returned number of compute-capable devices
Description

Returns in *count the number of devices with compute capability greater than or equal to 2.0 that are available for execution. If there is no such device, cuDeviceGetCount() returns 0.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetName, cuDeviceGetUuid, cuDeviceGetLuid, cuDeviceGet, cuDeviceTotalMem, cudaGetDeviceCount

CUresult cuDeviceGetLuid ( char* luid, unsigned int* deviceNodeMask, CUdevice dev )
Return an LUID and device node mask for the device.
Parameters
luid
- Returned LUID
deviceNodeMask
- Returned device node mask
dev
- Device to get identifier string for
Description

Return identifying information (luid and deviceNodeMask) to allow matching device with graphics APIs.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetCount, cuDeviceGetName, cuDeviceGet, cuDeviceTotalMem, cudaGetDeviceProperties

CUresult cuDeviceGetName ( char* name, int  len, CUdevice dev )
Returns an identifer string for the device.
Parameters
name
- Returned identifier string for the device
len
- Maximum length of string to store in name
dev
- Device to get identifier string for
Description

Returns an ASCII string identifying the device dev in the NULL-terminated string pointed to by name. len specifies the maximum length of the string that may be returned.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetUuid, cuDeviceGetLuid, cuDeviceGetCount, cuDeviceGet, cuDeviceTotalMem, cudaGetDeviceProperties

CUresult cuDeviceGetNvSciSyncAttributes ( void* nvSciSyncAttrList, CUdevice dev, int  flags )
Return NvSciSync attributes that this device can support.
Parameters
nvSciSyncAttrList
- Return NvSciSync attributes supported.
dev
- Valid Cuda Device to get NvSciSync attributes for.
flags
- flags describing NvSciSync usage.
Description

Returns in nvSciSyncAttrList, the properties of NvSciSync that this CUDA device, dev can support. The returned nvSciSyncAttrList can be used to create an NvSciSync object that matches this device's capabilities.

If NvSciSyncAttrKey_RequiredPerm field in nvSciSyncAttrList is already set this API will return CUDA_ERROR_INVALID_VALUE.

The applications should set nvSciSyncAttrList to a valid NvSciSyncAttrList failing which this API will return CUDA_ERROR_INVALID_HANDLE.

The flags controls how applications intends to use the NvSciSync created from the nvSciSyncAttrList. The valid flags are:

At least one of these flags must be set, failing which the API returns CUDA_ERROR_INVALID_VALUE. Both the flags are orthogonal to one another: a developer may set both these flags that allows to set both wait and signal specific attributes in the same nvSciSyncAttrList.

CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_VALUE, CUDA_ERROR_INVALID_HANDLE, CUDA_ERROR_INVALID_DEVICE, CUDA_ERROR_NOT_SUPPORTED, CUDA_ERROR_OUT_OF_MEMORY

See also:

cuImportExternalSemaphore, cuDestroyExternalSemaphore, cuSignalExternalSemaphoresAsync, cuWaitExternalSemaphoresAsync

CUresult cuDeviceGetTexture1DLinearMaxWidth ( size_t* maxWidthInElements, CUarray_format format, unsigned numChannels, CUdevice dev )
Returns the maximum number of elements allocatable in a 1D linear texture for a given texture element size.
Parameters
maxWidthInElements
- Returned maximum number of texture elements allocatable for given format and numChannels.
format
- Texture format.
numChannels
- Number of channels per texture element.
dev
- Device handle.
Description

Returns in maxWidthInElements the maximum number of texture elements allocatable in a 1D linear texture for given format and numChannels.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetCount, cuDeviceGetName, cuDeviceGetUuid, cuDeviceGet, cudaMemGetInfocuDeviceTotalMem

CUresult cuDeviceGetUuid ( CUuuid* uuid, CUdevice dev )
Return an UUID for the device.
Parameters
uuid
- Returned UUID
dev
- Device to get identifier string for
Description

Returns 16-octets identifing the device dev in the structure pointed by the uuid.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetCount, cuDeviceGetName, cuDeviceGetLuid, cuDeviceGet, cuDeviceTotalMem, cudaGetDeviceProperties

CUresult cuDeviceTotalMem ( size_t* bytes, CUdevice dev )
Returns the total amount of memory on the device.
Parameters
bytes
- Returned memory available on device in bytes
dev
- Device handle
Description

Returns in *bytes the total amount of memory available on the device dev in bytes.

Note:

Note that this function may also return error codes from previous, asynchronous launches.

See also:

cuDeviceGetAttribute, cuDeviceGetCount, cuDeviceGetName, cuDeviceGetUuid, cuDeviceGet, cudaMemGetInfo