6

I wish to restrict access to using a GPU (in terms of reserving memory on it) for certain users on a jointly used workstation. So if a user tries to access the GPU on SSH, for example via CUDA, that request would be denied. Any ideas where to start looking for that?

Thanks in advance!

jmaxx
  • 163
  • Add a group cuda to your Ubuntu, then set 750 permissions on the /dev/nvidia* devices and change the group ownership to cuda. Add those users that are granted to use the GPU to the group cuda. There are also driver parameters that do this for you during loading the nvidia driver. ( NVreg_DeviceFileGID and NVreg_DeviceFileMode ). – Thomas Mar 16 '17 at 11:07
  • @Thomas thank you very much, that's awesome! If you convert your comment into an answer, I could accept it... :) – jmaxx Mar 20 '17 at 02:08

1 Answers1

6

Add a group cuda to your Ubuntu, then set 750 permissions on the */dev/nvidia** devices and change the group ownership to cuda.
Add those users that are granted to use the GPU to the group cuda.

There are also driver parameters that do this for you during loading the nvidia driver. ( NVreg_DeviceFileGID and NVreg_DeviceFileMode ).

Thomas
  • 6,223
  • why after change "test -c /dev/nvidia${devid} || mknod -m 750 /dev/nvidia${devid} c 195 ${devid} && chown :<group_name> /dev/nvidia${devid};" group_name come to root ? – Nikolay Baranenko Dec 02 '22 at 20:26
  • @NikolayBaranenko: I think best would be to ask a new question for this – Thomas Dec 08 '22 at 06:25
  • already) https://unix.stackexchange.com/questions/727386/change-nvidia-device-files-via-modprobe-d-nvreg-devicefilegid-not-changed – Nikolay Baranenko Dec 09 '22 at 08:45