code: def nvmlDeviceGetIndex(handle):
      r
      fn = _nvmlGetFunctionPointer("nvmlDeviceGetIndex")
      c_index = c_uint()
      ret = fn(handle, byref(c_index))
      _nvmlCheckReturn(ret)
      return bytes_to_str(c_index.value)
docs: r"""
      /**
       * Retrieves the NVML index of this device.
       *
       * For all products.
       *
       * Valid indices are derived from the \a accessibleDevices count returned by
       *   \ref nvmlDeviceGetCount(). For example, if \a 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
       *   \ref nvmlDeviceGetHandleByPciBusId() and \ref nvmlDeviceGetHandleByUUID().
       *
       * Note: The NVML index may not correlate with other APIs, such as the CUDA device index.
       *
       * @param device                               The identifier of the target device
       * @param index                                Reference in which to return the NVML index of the device
       *
       * @return
       *         - \ref NVML_SUCCESS                 if \a index has been set
       *         - \ref NVML_ERROR_UNINITIALIZED     if the library has not been successfully initialized
       *         - \ref NVML_ERROR_INVALID_ARGUMENT  if \a device is invalid, or \a index is NULL
       *         - \ref NVML_ERROR_GPU_IS_LOST       if the target GPU has fallen off the bus or is otherwise inaccessible
       *         - \ref NVML_ERROR_UNKNOWN           on any unexpected error
       *
       * @see nvmlDeviceGetHandleByIndex()
       * @see nvmlDeviceGetCount()
       */
      nvmlReturn_t DECLDIR nvmlDeviceGetIndex