CUDA-gdb error 20

Hello,

when i try to run any code on CUDA-GDB i got “The CUDA driver failed initialization (error=20)”.
I tried to search but didn’t found anything about it.

Someone knows this error?

1 Like

I’m bumping this thread because I have this as well.
Using ubuntu 9.10.
Since I don’t know how to stop X properly I drop into a recovery shell and run telinit 3 from there, perhaps that’s related.

Try to stop gdm (GNOME Display Manager if you are using gnome)

/etc/init.d/gdm stop

This should turn off X and then try to run cuda-gdb from the console.

Try to stop gdm (GNOME Display Manager if you are using gnome)

/etc/init.d/gdm stop

This should turn off X and then try to run cuda-gdb from the console.

I met the same problem.

After I turned off gdm, cuda-gdb returns error: The CUDA driver failed initializayion (error=20)

Really appreciate if anyone can offer a clue External Image

I met the same problem.

After I turned off gdm, cuda-gdb returns error: The CUDA driver failed initializayion (error=20)

Really appreciate if anyone can offer a clue External Image

The same problem and I don’t have a clue how to override it. It happens only on my headless machine with ubuntu 10.04 server edition, with no X installed. Everything installs succesfully but my program works for 0.1 second and quits without any exit code – but it must work in infinite loop (and it works on the other machine with 10.04 with X11 installed). Cuda-gdb gives me error: The CUDA driver failed initialization (error=20).
I tried to use this article but it doesn’t work: akademic.name

Help please!

The same problem and I don’t have a clue how to override it. It happens only on my headless machine with ubuntu 10.04 server edition, with no X installed. Everything installs succesfully but my program works for 0.1 second and quits without any exit code – but it must work in infinite loop (and it works on the other machine with 10.04 with X11 installed). Cuda-gdb gives me error: The CUDA driver failed initialization (error=20).
I tried to use this article but it doesn’t work: akademic.name

Help please!

After hours of seeking I understood that the reason of the error is the absence of X11. I can not install x-server on my server, but it seems to create some files that are needed Cuda to work (/dev/nvidiactl for example). And also I noticed that it seems that in the previous versions of Cuda SDK there was some script enabling nvidia devices on headless configurations. But in the latest release notes, readme etc there is no scripts! Who knows where could I find it?

UPDATE: I THINK I FOUND THE SOLUTION!
At least it made my program work. I have modified the script for v.197 drivers a bit and it worked.

So:

  1. Create file .cudainit in your home directory.
  2. Insert in the file this script:

#!/bin/bash

modprobe nvidia

if [ “$?” -eq 0 ]; then

Count the number of NVIDIA controllers found.

N3D=lspci | grep -i NVIDIA | grep "3D controller" | wc -l
NVGA=lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l

N=expr $N3D + $NVGA - 1
for i in seq 0 $N; do
mknod -m 666 /dev/nvidia$i c 260 $i;
done

mknod -m 666 /dev/nvidiactl c 260 255

else
exit 1
fi

  1. Make it executable:
    chmod u+x ~/.cudainit

  2. Run it with superuser rights:
    sudo ~/.cudainit

  3. After this everything seems to work

After hours of seeking I understood that the reason of the error is the absence of X11. I can not install x-server on my server, but it seems to create some files that are needed Cuda to work (/dev/nvidiactl for example). And also I noticed that it seems that in the previous versions of Cuda SDK there was some script enabling nvidia devices on headless configurations. But in the latest release notes, readme etc there is no scripts! Who knows where could I find it?

UPDATE: I THINK I FOUND THE SOLUTION!
At least it made my program work. I have modified the script for v.197 drivers a bit and it worked.

So:

  1. Create file .cudainit in your home directory.
  2. Insert in the file this script:

#!/bin/bash

modprobe nvidia

if [ “$?” -eq 0 ]; then

Count the number of NVIDIA controllers found.

N3D=lspci | grep -i NVIDIA | grep "3D controller" | wc -l
NVGA=lspci | grep -i NVIDIA | grep "VGA compatible controller" | wc -l

N=expr $N3D + $NVGA - 1
for i in seq 0 $N; do
mknod -m 666 /dev/nvidia$i c 260 $i;
done

mknod -m 666 /dev/nvidiactl c 260 255

else
exit 1
fi

  1. Make it executable:
    chmod u+x ~/.cudainit

  2. Run it with superuser rights:
    sudo ~/.cudainit

  3. After this everything seems to work

Hi al_indigo,

I’ve only just now solved a similar problem for myself.

Just run

nvidia-smi

as root in order to initialize the driver.

LONG VERSION:

I run a Debian box in a server room which sometimes has a monitor and sometimes doesn’t. It seems that if a monitor was hooked up during boot (ie. if it got to the graphical login screen) the driver was initialized and the monitor could be unhooked without affecting subsequent CUDA applications. By coincidence, this seems to have been the case every time I used it until today when I had to do a remote reboot and there happened to be no screen hooked up. I wasted the whole day trying to isolate the problem because I couldn’t figure out if it was any of the code changes I had just made that were causing this problem. I finally realised what the problem was but I couldn’t find anything on google or on these forums regarding how to initialize the driver without a monitor hooked up (other than the now obsolete script you mentioned). Then I stumbled across this thread http://forums.nvidia.com/index.php?showtopic=181742 and gave it a go. It’s funny how this isn’t mentioned anywhere in the programming guide or in a sticky or something especially since they simply deleted the script from the readme without any explenation…

Hi al_indigo,

I’ve only just now solved a similar problem for myself.

Just run

nvidia-smi

as root in order to initialize the driver.

LONG VERSION:

I run a Debian box in a server room which sometimes has a monitor and sometimes doesn’t. It seems that if a monitor was hooked up during boot (ie. if it got to the graphical login screen) the driver was initialized and the monitor could be unhooked without affecting subsequent CUDA applications. By coincidence, this seems to have been the case every time I used it until today when I had to do a remote reboot and there happened to be no screen hooked up. I wasted the whole day trying to isolate the problem because I couldn’t figure out if it was any of the code changes I had just made that were causing this problem. I finally realised what the problem was but I couldn’t find anything on google or on these forums regarding how to initialize the driver without a monitor hooked up (other than the now obsolete script you mentioned). Then I stumbled across this thread The Official NVIDIA Forums | NVIDIA and gave it a go. It’s funny how this isn’t mentioned anywhere in the programming guide or in a sticky or something especially since they simply deleted the script from the readme without any explenation…

I don’t know why it was removed, but I asked several times for its return.

The script will be back in the release notes for 3.2 final.

I don’t know why it was removed, but I asked several times for its return.

The script will be back in the release notes for 3.2 final.