Comment 4 for bug 1421209

Revision history for this message
Graham Inggs (ginggs) wrote :

nvidia-modprobe creates the /dev/nvidia-uvm device node and loads the nvidia_uvm module for a normal user, on demand.

Using clinfo as an example since it is in the archive, small, and wasn't compiled against anything Nvidia (it is built against ocl-icd-libopencl1). See LP: #1499996 for the relationship between ocl-icd-libopencl1 (an OpenCL ICD loader) and nvidia-opencl-icd-352 (an OpenCL ICD).

Without nvidia-modprobe installed, clinfo reports no devices:

$ ls -l /dev/nv*
crw-rw-rw- 1 root root 195, 0 Oct 12 17:41 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 12 17:41 /dev/nvidiactl

$ lsmod | grep nvidia
nvidia 10563584 41
drm 356352 3 nvidia

$ clinfo
Number of platforms 0

Without nvidia-modprobe installed, but running as root, clinfo finds the device:

$ sudo clinfo
Number of platforms 1
Platform Name NVIDIA CUDA
<snip>

$ ls -l /dev/nv*
crw-rw-rw- 1 root root 195, 0 Oct 12 17:41 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 12 17:41 /dev/nvidiactl
crw-rw-rw- 1 root root 247, 0 Oct 12 17:45 /dev/nvidia-uvm

$ lsmod | grep nvidia
nvidia_uvm 36864 0
nvidia 10563584 42 nvidia_uvm
drm 356352 3 nvidia

So the Nvidia OpenCL ICD is also capable of creating the device node and loading the nvidia_uvm module, provided it is run as root on its first run.

With nvidia-modprobe installed, it "just works" for the user:

$ ls -l /dev/nv*
crw-rw-rw- 1 root root 195, 0 Oct 12 16:59 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 12 16:59 /dev/nvidiactl

$ lsmod | grep nvidia
nvidia 10563584 41
drm 356352 3 nvidia

$ clinfo
Number of platforms 1
Platform Name NVIDIA CUDA
<snip>

$ ls -l /dev/nv*
crw-rw-rw- 1 root root 195, 0 Oct 12 16:59 /dev/nvidia0
crw-rw-rw- 1 root root 195, 255 Oct 12 16:59 /dev/nvidiactl
crw-rw-rw- 1 root root 247, 0 Oct 12 17:38 /dev/nvidia-uvm

$ lsmod | grep nvidia
nvidia_uvm 36864 0
nvidia 10563584 42 nvidia_uvm
drm 356352 3 nvidia

Running strace on clinfo shows that the Nvidia OpenCL ICD does the following:
- check if the nvidia_uvm module is loaded, if not, run '/sbin/modprobe' if we are root, otherwise run '/usr/bin/nvidia-modprobe'.
- check if /dev/nvidia-uvm exists, if it does not, try to create it, and if that fails run '/usr/bin/nvidia-modprobe' again.

The same is true of CUDA applications that are linked to libcuda or libcudart.