Issues with Optimus
I've encountered the following problem on my laptop with Optimus. This first launch of the device-query container after system reboot is successful, but all subsequent launches until the next reboot produce the following error:
[ NVIDIA ] =INFO= Driver version: 352.63
[ NVIDIA ] =INFO= CUDA image version: 7.5
[ NVIDIA ] =WARN= Could not find library: nvcuvid
[ NVIDIA ] =WARN= Could not find library: nvidia-encode
[ NVIDIA ] =WARN= Could not find binary: nvidia-cuda-mps-control
[ NVIDIA ] =WARN= Could not find binary: nvidia-cuda-mps-server
WARNING: Your kernel does not support memory swappiness capabilities, memory swappiness discarded.
modprobe: ERROR: ../libkmod/libkmod.c:556 kmod_search_moddep() could not open moddep file '/lib/modules/4.2.0-1-amd64/modules.dep.bin'
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL
Here is the command that I am using to launch the container:
GPU=0 PATH=$PATH:'/sbin' optirun ./nvidia-docker run --rm=true device_query
I am using Debian Sid with 4.2.0-1 kernel. Output of uname -a is
Linux kaliburn 4.2.0-1-amd64 #1 SMP Debian 4.2.6-1 (2015-11-10) x86_64 GNU/Linux
The Optimus is managed by Bumblebee, version 3.2.1-10.
CUDA is not doing any rendering, you don't need Bumblebee to make it work.
Just check that your NVIDIA card is ON if you are using bbswitch or similar and that the driver is properly loaded: lsmod | grep nvidia && nvidia-smi
Also, looking at your error, it seems that you are missing few components. You should double check your NVIDIA driver installation and you might need to rebuild your module dependencies (see depmod)
Installation of the missed components (libnvcuvid1, libnvidia-encode1 and nvidia-cuda-mps in Debian) makes warnings disappear, but doesn't make any other differences.
If I turn the card on via /proc/acpi/bbswitch bewore using optirun, then CUDA in the Docker containers works fine, but the rendering gets messed up.
It has turned out that if I wrap the nvidia-docker in another script that calls modprobe nvidia-current-uvm before nvidia-docker, then optirun works, but that requires to run the wrapper script as root.
As I said, Bumblebee (optirun) is not needed. The only thing that needs to be done is turning on the card. nvidia-docker takes care of loading the drivers and uvm.
sudo tee /proc/acpi/bbswitch <<< ON
./nvidia-docker run [...]
Closing as it's not an issue with nvidia-docker but rather OS specific