'nvidia-smi -L' 和 cuDeviceGetName() 之间的 ID 不一致 [英] Inconsistency of IDs between 'nvidia-smi -L' and cuDeviceGetName()

查看:28
本文介绍了'nvidia-smi -L' 和 cuDeviceGetName() 之间的 ID 不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 shell 中运行这个命令并得到:

I'm running this command into a shell and get:

C:Usersme>nvidia-smi -L    
GPU 0: Quadro K2000 (UUID: GPU-b1ac50d1-019c-58e1-3598-4877fddd3f17)    
GPU 1: Quadro 2000 (UUID: GPU-1f22a253-c329-dfb7-0db4-e005efb6a4c7)

但在我的代码中,当我运行 cuDeviceGetName(.., ID) 其中 ID 是 nvidia-smi 输出给出的 ID 时,设备已被反转: GPU 0 变为 Quadro 2000,GPU 1 变为 Quadro K2000.

But in my code, when I run cuDeviceGetName(.., ID) where ID is the ID given by the nvidia-smi output, the devices have been inverted: GPU 0 becomes Quadro 2000 and GPU 1 becomes Quadro K2000.

这是预期的行为还是错误?有谁知道让 nvidia-smi 获得 GPU 的真实"ID 的解决方法?我可以使用 UUID 通过 nvmlDeviceGetUUID() 获取正确的设备,但使用 nvml API 对于我想要实现的目标来说似乎有点太复杂了.

Is this an expected behavior or a bug ? Does anyone know a workaround to make nvidia-smi get the 'real' ID of GPUs ? I could use the UUID to get the proper device with nvmlDeviceGetUUID() but using nvml API seems a bit too complicated for what I'm trying to achieve.

这个问题讨论如何CUDA 为设备分配 ID 没有明确的结论.

This question discuss how CUDA assign IDs to devices without clear conclusion.

我正在使用 CUDA 6.5.

I am using CUDA 6.5.

我已经查看了 nvidia-smi 联机帮助页(应该早点这样做......).它指出:

I've had a look at nvidia-smi manpage (should have done that earlier...). It states:

建议需要一致性的用户使用 UUDI 或 PCI 总线 ID,因为不能保证设备枚举顺序是一致的"

"It is recommended that users desiring consistencyuse either UUDI or PCI bus ID, since device enumeration ordering is not guaranteed to be consistent"

仍在寻找杂物...

推荐答案

这是预期的行为.

nvidia-smi 按 PCI 顺序枚举.

nvidia-smi enumerates in PCI order.

默认情况下,CUDA 驱动程序和运行时 API 不支持.

By default, the CUDA driver and runtime APIs do not.

您链接的问题清楚地显示了如何关联两种编号/排序方案.

The question you linked clearly shows how to associate the two numbering/ordering schemes.

没有办法让 nvidia-smi 修改其排序方案以匹配将由 CUDA 运行时或驱动程序 API 生成的任何内容.但是,您可以通过使用 环境变量.

There is no way to cause nvidia-smi to modify its ordering scheme to match whatever will be generated by the CUDA runtime or driver APIs. However you can modify the CUDA runtime enumeration order through the use of an environment variable in CUDA 8.

这篇关于'nvidia-smi -L' 和 cuDeviceGetName() 之间的 ID 不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆