📅 2015-Feb-24 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cuda, error, pycuda ⬩ 📚 Archive
After installing PyCUDA, I tried to run a sample PyCUDA program and got this error:
$ python hello_cuda.py Traceback (most recent call last): File "hello_cuda.py", line 1, in <module> import pycuda.autoinit File "/usr/local/lib/python2.7/dist-packages/pycuda/autoinit.py", line 4, in <module> cuda.init() pycuda._driver.Error: cuInit failed: unknown
The error refers to line 4 in
/usr/local/lib/python2.7/dist-packages/pycuda/autoinit.py. The lines relevant to that error in the file are:
import pycuda.driver as cuda cuda.init()
So, CUDA initialization is failing for some reason. After a bit of Googling, I found that this means that the necessary (CUDA? NVIDIA?) modules were not being loaded into the kernel. NVIDIA provides a
modprobe package that can auto-load modules into the kernel as needed.
I installed this package:
$ sudo apt-get install nvidia-modprobe
CUDA was able to initialized immediately after this package was installed, no reboot was needed.
Tried with: PyCUDA 2014.1, CUDA 5.5, NVIDIA 331 drivers, GTX Titan and Ubuntu 14.04