remotely startx over ssh

12,226

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:
12,226

Related videos on Youtube

Derek
Author by

Derek

Updated on September 18, 2022

Comments

  • Derek
    Derek over 1 year

    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

  • aland
    aland over 12 years
    That's true for AMD/ATI cards, but nvidia does not need X-server to work with GPUs
  • aland
    aland over 12 years
    Alteratively, you could just run something CUDAish (like nvidia-smi -a) as root. It will automagically create all necessary device nodes.
  • Piotr Dobrogost
    Piotr Dobrogost almost 7 years
    you might be able to tell your application to start on the remote machine's x-server. The question is clearly about starting X server remotely not about making local application use remote X server for display.