I am using GeForce 8400M GS on Ubuntu 10.04 and I am learning CUDA programming. I am writing and running few basic programs. I was using cudaMalloc, and it kept giving me an error until I ran the code as root. However, I had to run the code as root only once. After that, even if I run the code as normal user, I do not get an error on malloc. What’s going on?
Share
This is probably due to your GPU not being properly initialized at boot. I’ve come across this problem when using Ubuntu Server and other installations where an X server isn’t being started automatically. Try the following to fix it:
Create a directory for a script to initialize your GPUs. I usually use
/root/bin. In this directory, create a file calledcudainit.shwith the following code in it (this script came from the Nvidia forums).Now we need to make this script run automatically at boot. Edit
/etc/rc.localto look like the following.Reboot your computer and try to run your CUDA program as a regular user. If I’m right about what the problem is, then it should be fixed.