First: I have been struggling with my stupid optimus laptop on ubuntu 15.10 for a week. So, don't "possible duplicate" me just by simply googling some keywords and without reading the whole thing plus the hyperlinks.
My laptop has a nvidia geforce 740M (optimus) and I have ubuntu 15.10 installed. I installed bumblebee with nvidia-355 driver using the instructions in this link. Now it's possible for me to switch between the graphic cards flawlessly, just with using the optirun:
$ optirun glxgears
6763 frames in 5.0 seconds = 1352.335 FPS
7156 frames in 5.0 seconds = 1431.125 FPS
7152 frames in 5.0 seconds = 1430.255 FPS
and it can be checked if the nvidia graphic card is being used:
cat /proc/acpi/bbswitch
0000:07:00.0 ON
which after closing the glxgears will be changed to :
cat /proc/acpi/bbswitch
0000:07:00.0 OFF
HOWEVER, I really need using the CUDA in ubuntu which seems impossible. I should "theoretically" be able to use optirun to run cuda examples after "make". but the result is (and no difference with using the sudo):
~/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery$ optirun ./deviceQuery
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 30
-> unknown error
Result = FAIL
So I searched again and got to post #4 in this page which is for Ubuntu 12.04. In which it's suggested to use:
$ sudo update-alternatives --config x86_64-linux-gnu_gl_conf
There are 3 choices for the alternative x86_64-linux-gnu_gl_conf (providing /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/nvidia-355/ld.so.conf 8604 auto mode
1 /usr/lib/nvidia-355-prime/ld.so.conf 8603 manual mode
2 /usr/lib/nvidia-355/ld.so.conf 8604 manual mode
* 3 /usr/lib/x86_64-linux-gnu/mesa/ld.so.conf 500 manual mode
Press <enter> to keep the current choice[*], or type selection number:
And vadammt has suggested to select the nvidia-355-prime (option number 1). I selected and I will be able to use
optirun ./deviceQuery
with no problem. HOWEVER, after running the deviceQuery, the bbswitch will not turn off the nvidia OFF automatically anymore:
$ cat /proc/acpi/bbswitch
0000:07:00.0 ON
I checked the bumblebee documentation and seems like that "nvidia-355-prime", is actually the nvidia-prime and that command is used to switch from bumblebee to nvidia-prime. So the main questions now are:
1) Is this true that selecting the "nvidia-355-prime" switches to nvidia-prime ?
2) If yes, is there anyway to actually have CUDA and Bumblebee together (without relying on nvidia-prime)? by just using the "optirun" directly, and not getting the unknown error "cudaGetDeviceCount returned 30" that I mentioned?
3) If no, is it possible to create a script to automatize the process of switching between bumblebee and nvidia prime and assign a command to it?
4) Any other comment/suggestion/recommendation/advice/proposal?
5) Thank you?
EDIT: changing to nvidia-355-prime won't also work anymore :(