为什么会出现“ pycuda._driver.LogicError:cuInit失败:设备序号无效”的情况?

时间:2018-07-10 12:15:08

标签: python-3.x cuda pycuda

我有两个GPU,CUDA和TensorFlow正常工作,nvidia-smi结果

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 396.24.02              Driver Version: 396.24.02                 |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX TIT...  Off  | 00000000:01:00.0  On |                  N/A |
| 29%   46C    P8    16W / 250W |    113MiB /  6080MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+
|   1  P104-100            Off  | 00000000:04:00.0 Off |                  N/A |
| 37%   43C    P8     8W / 180W |      0MiB /  4042MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

但是即使在简单的情况下,我在使用PyCuda时也会遇到一些麻烦

from pycuda import driver as drv
drv.init()

我收到一个错误pycuda._driver.LogicError: cuInit failed: invalid device ordinal。 谁能帮我-这可能是什么问题?

0 个答案:

没有答案