CUDA Driver API (PDF) - CUDA Toolkit v5.5 (older) - Last updated May 11, 2013 - Send Feedback

2.4. 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 cuDeviceGetName ( char* name, int  len, CUdevice dev )
Returns an identifer string 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. 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, cuDeviceTotalMem

Parameters
device
- Returned device handle
ordinal
- Device number to get handle for
CUresult cuDeviceGetAttribute ( int* pi, CUdevice_attribute attrib, CUdevice dev )

Returns information about the device. 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, cuDeviceGet, cuDeviceTotalMem

Parameters
pi
- Returned device attribute value
attrib
- Device attribute to query
dev
- Device handle
CUresult cuDeviceGetCount ( int* count )

Returns the number of compute-capable devices. Returns in *count the number of devices with compute capability greater than or equal to 1.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, cuDeviceGet, cuDeviceTotalMem

Parameters
count
- Returned number of compute-capable devices
CUresult cuDeviceGetName ( char* name, int  len, CUdevice dev )

Returns an identifer string for the device. 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, cuDeviceGetCount, cuDeviceGet, cuDeviceTotalMem

Parameters
name
- Returned identifier string for the device
len
- Maximum length of string to store in name
dev
- Device to get identifier string for
CUresult cuDeviceTotalMem ( size_t* bytes, CUdevice dev )

Returns the total amount of memory on the device. 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, cuDeviceGet,

Parameters
bytes
- Returned memory available on device in bytes
dev
- Device handle

CUDA Driver API (PDF) - CUDA Toolkit v5.5 (older) - Last updated May 11, 2013 - Send Feedback