cuda.bindings.nvml.device_get_index#

cuda.bindings.nvml.device_get_index(intptr_t device) unsigned int#

Retrieves the NVML index of this device.

For all products. Valid indices are derived from the accessibleDevices count returned by device_get_count_v2(). For example, if accessibleDevices is 2 the valid indices are 0 and 1, corresponding to GPU 0 and GPU 1. The order in which NVML enumerates devices has no guarantees of consistency between reboots. For that reason it is recommended that devices be looked up by their PCI ids or GPU UUID. See device_get_handle_by_pci_bus_id_v2() and device_get_handle_by_uuid(). When used with MIG device handles this API returns indices that can be passed to nvmlDeviceGetMigDeviceHandleByIndex to retrieve an identical handle. MIG device indices are unique within a device. Note: The NVML index may not correlate with other APIs, such as the CUDA device index.

Parameters:

device (intptr_t) – The identifier of the target device.

Returns:

Reference in which to return the NVML index of the

device.

Return type:

unsigned int

See also

nvmlDeviceGetIndex