1) First, uninistall bumblebee and previously declared drivers
sudo apt-get purge bumblebee* primus libvdpau-va-gl1
2) Install the desired driver version (>331)
sudo apt-get install nvidia-331 nvidia-331-uvm nvidia-opencl-dev nvidia-modprobe nvidia-prime mesa-utils
3) [optional] For viewing of HD video with the GPU, use
sudo apt-get install vdpau-va-driver
See
http://us.download.nvidia.com/XFree86/Linux-x86_64/346.35/README/randr14.html for details about the following
4) Modify /etc/X11/xorg.conf with the following.
WARNING: don't forget to set the BusId to the one of your nvidia card
Section "ServerLayout"
Identifier "layout"
Screen 0 "nvidia"
Inactive "intel"
EndSection
Section "Device"
Identifier "nvidia"
Driver "nvidia"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "nvidia"
Device "nvidia"
Option "AllowEmptyInitialConfiguration"
EndSection
Section "Device"
Identifier "intel"
Driver "modesetting"
EndSection
Section "Screen"
Identifier "intel"
Device "intel"
EndSection
5) The X server does not automatically enable displays attached to the non-NVIDIA graphics device in this configuration. To do that, use the xrandr command line tool:
Add this to ~/.xinitrc
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto
6) Reboot
7) To check if that worked, use
$ xrandr --listproviders
Providers: number : 3
Provider 0: id: 0x2c4 cap: 0x1, Source Output crtcs: 0 outputs: 0 associated providers: 1 name:NVIDIA-0
Provider 1: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
Provider 2: id: 0x46 cap: 0x2, Sink Output crtcs: 3 outputs: 4 associated providers: 1 name:modesetting
8) Solving issues with OpenCL
If opencl application don't work (error -1001, unable to create context), here are some tips:
- make sure all the packages listed in 2) (and only those) are installed
- Check that the file /etc/OpenCL/vendors/nvidia.icd contains (the following or similar)
/usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1