Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using some software that uses CUDA to run some stuff on the GPU.

If I am using ssh to connect to the box, or vnc even, and I try to run the program I get an error that no CUDA device is enabled. I have to go over to the machine and physically log in, and type "startx" to get it to detect the device. It can also be another use on the box using an X session, but one has to be started soemwhere on the box to get CUDA working. Is there a way to "startx" over an SSH session so that this will work and I dont have to go over and log in?

Thanks

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

If you have root access to the box running CUDA or can get someone who does to make this change, you can configure it such that X is not necessary to use CUDA.

To do so, create a file called 85-cuda.rules in /etc/udev/rules.d with the following contents:

SUBSYSTEM=="module", KERNEL=="nvidia", RUN+="/lib/udev/cuda.sh"

Then, create a file called cuda.sh in /lib/udev with the following contents:

#!/bin/sh

mknod -m 660 /dev/nvidia1 c 195 1
chown root:video /dev/nvidia1
mknod -m 660 /dev/nvidiactl c 195 255
chown root:video /dev/nvidiactl

If the machine has multiple GPUs, repeat the first two lines, changing nvidia1 to nvidia2 on both lines and changing the last 1 of the first line to 2. Repeat this for each reamining card in the machine. Once you save that, you need to make it executable:

chmod +x /lib/udev/cuda.sh

Finally, run /lib/udev/cuda.sh once to get it working without having to reboot.

share|improve this answer
    
Alteratively, you could just run something CUDAish (like nvidia-smi -a) as root. It will automagically create all necessary device nodes. –  aland Sep 8 '11 at 21:15
add comment

X (xorg) by design is a client-server model. By SSH'ing in... your default "x-server" is NOT the remote machine's x-session. It will try & connect to an x-session running through the tunnel. In many x-based applications you have the option to specify which x-server to display on, and as-such you might be able to tell your application to start on the remote machine's x-server. http://www.x.org/archive/X11R6.8.0/doc/Xorg.1.html

As far as VNC goes, it all depends on how it is configured. Most of the time, vnc will create a new session when you connect that is not using a gpu-enabled x server. As such, it will also not allow you to start gpu-enabled applications under the non-gpu enabled x-server. I honestly don't use VNC, so I am not the guy to ask how to re-configure it to work with the gpu-enabled x-server.

share|improve this answer
    
That's true for AMD/ATI cards, but nvidia does not need X-server to work with GPUs –  aland Sep 8 '11 at 21:07
add comment

When using ssh, include the -X option. This will enable graphical apps to run over SSH. Just start a program from the command-line like usual and you should see it open.

ssh -X user@host

This will make it so you don't have to start an entire session just to run an app or two.

Otherwise, could you start x as a background process? (Using & at the end).

share|improve this answer
    
The problem is not getting the app to show up. I need to load the modules or something that the X server starts, because apparently CUDA needs them to detect that I have a GPU in the system –  Derek Apr 18 '11 at 18:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.