[英]How to remove cuInit failed: unknown error in CUDA (PyCuda)
I have CUDA installed then I tried the following:我安装了 CUDA 然后我尝试了以下操作:
In [1]: import pycuda.driver as cuda
In [2]: cuda.init()
---------------------------------------------------------------------------
Error Traceback (most recent call last)
<ipython-input-2-2845c9c0ab3c> in <module>()
----> 1 cuda.init()
Error: cuInit failed: unknown error
How can resolve the error?如何解决错误?
I already have this installed:我已经安装了这个:
$ which nvidia-modprobe
/usr/bin/nvidia-modprobe
My other info:我的其他信息:
$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
And this:和这个:
$ uname -a
Linux foobar1 4.10.0-28-generic #32~16.04.2-Ubuntu SMP Thu Jul 20 10:19:48 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
And this is the information for the nvidia-smi这是 nvidia-smi 的信息
$ nvidia-smi
Mon Nov 19 15:56:43 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.48 Driver Version: 410.48 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 Quadro P400 Off | 00000000:AF:00.0 Off | N/A |
| 34% 45C P0 N/A / N/A | 0MiB / 1999MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
cuInit failed: unknown error
is often the result of nvidia-uvm kernel module not being loaded. cuInit failed: unknown error
通常是由于未加载 nvidia-uvm 内核模块造成的。 I've been periodically running into this issue on Ubuntu.我经常在 Ubuntu 上遇到这个问题。
sudo nvidia-modprobe -u
should fix the problem. sudo nvidia-modprobe -u
应该可以解决这个问题。 That is, until you reboot.也就是说,直到您重新启动。 Then you will need to do it again.
然后你需要再做一次。
Another workaround is to run your failing application as root once .另一种解决方法是以 root 身份运行失败的应用程序一次。 AFAICT it in this case CUDA runtime will attempt to load the missing module (and will most likely succeed at that, because we're running as root).
AFAICT 在这种情况下,CUDA 运行时将尝试加载丢失的模块(并且很可能会成功,因为我们以 root 身份运行)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.