How can I install cuda successfully on my optimus laptop

Hello, everyone.

My laptop has a NVIDIA GeForce GT650M GPU and a Intel HD 4000 GPU, and uses the optimus technology so I can’t disable the intergrated graphic. My OS is ubuntu 11.10, I try to install cuda5.0 on my laptop.

First of all, I blacklisted the nouveau by
'~$ gedit /etc/modprobe.d/blacklist-nouveau.conf
blacklist nvidiafb
blacklist nvidiafb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist vga16fb
options nouveau modeset=0

then I rebooted, and install g++,freeglut3,libxi,libxmu,mpi.
Does the blacklist-nouveau.conf really work?

Then, I followed the instruction in the ‘CUDA Getting Started Guide For linux’ step by step, so I used the command :
‘~$ sudo sh cuda_5.0.35_linux_32_ubuntu11.10-1.run’ --optimus
to install cudatoolkit.

During the installation process I didn’t meet any problems and I got this :
‘Driver : Installed
Toolkit?Installed in /usr/local/cuda-5.0
Samples: Installed in …(ignored)’
Is this mean that I install cuda successfully?
After this, I add PATH and LD_LIARARY_PATH to my environment.

The I make all the samples and run deviceQuery as a root but I got this :
‘no cuda-capable device was detected’

Then I created a startup script just as the guide’s said.
after that I can find nvidia0 nvidiaac1 in /dev .

So I ran deviceQuery again but I got this :
‘Invaild device ordinal’.
Is this mean I didn’t install driver successfully? I couldn’t figure out what was wrong.How I can solve this problem? Please, help me!

Regards,
Lee

Install bumblebee and the nvidia driver in the instructions and then run cuda programs with optimus ./cuda.program

Thanks for helping.

Excuse me, did you mean “optirun ./cuda.program” not “optimus ./cuda.program”? I once installed bumblebee before, but I failed to run cuda program by using ‘optirun’, cause the bumblebee guide said.

Besides, can I install cuda without bumblebee?
I’m expecting your help!

The command is optirun. There might be a way to run cuda without bumblebee, but I do not know it. I use bumblebee because it is easy to setup.

Lee,

While your first approach might work, it’s quite convoluted to get it working correctly. I’d also suggest the bumblebee approach. Clean off any previous drivers and start from scratch.

That being said, if you’d like to another convoluted approach, here is what I did a while back on an optimus laptop when bumblebee was either in its infancy/unreliable or altogether non-existent:

http://forums.accelereyes.com/forums/viewtopic.php?f=7&t=2045#p6680
(You can ignore any references to Jacket/matlab – the post was referencing a CUDA add-on toolbox for matlab) basically steps 2-5 is what you’d want.

Thanks for helping! I’ll try what you told me later.
The reason why I do not try bumblebee is that I tried before, but I failed to get it woring correctly.

Okey, thank you, anyway.

Okey, I see, you installed CUDA Toolkit before NVIDIA driver. Does it make difference if I install CUDA driver before CUDA Toolkit? As I said before, I installed CUDA-5.0 which has toolkit, driver, SDK together. and the installation process was ‘drive -> toolkit -> SDK’.
thank you, vacaloca

Please let me know how it works. A friend is using Ubuntu 12.10 and he was not able to install the bumblebee. I would be useful top be able to run some cuda programs without bumblebee.

I’d still insist to try bumblebee from a fresh start (ideally a clean re-install if possible to avoid any driver conflicts that might be left over). Only if that doesn’t work, then try the option below:

For the older CUDA 4.x version it didn’t matter if you installed the toolkit without having a driver installed already… for that matter I don’t think the new 5.0 SDK version is any different except for the fact that it INCLUDES a driver by default, which you should skip installing, and instead download the usual Linux driver .run package, and install it the usual way, but without doing any changes to the xorg.conf file – otherwise you will not be able to start the X GUI.

Okey. I installed bumblebee as the website’s guide, I typed below command in the command line:
‘~ lspci | -i vga ' (which I can't remember clearly) then I got: '......(ignored)NVIDIA GT 650M [rev ff]' which mean the NVIDIA GPU was shut off as the bumblebee guide told. Then I ran the test command '~ optirun glear’ as a usual user, then I got
‘cannot find NVIDIA GPU’ or something which means NVDIA GPU wasn’t detected.
Then I typed ‘~$ lspci | -i vga’ and got :
‘…(ignored)NVIDIA GT 650M [rev a1]’

So, that’s what I meet when I installed bumblebee.

You said you had some experience running CUDA programs without bumblebee, you know, that’s what I really care about. Could you please tell me in detail?

Okey, I tried to install CUDA on a non-optimus desktop(ubuntu12.10) which wasn’t installed NVIDIA driver beforea, and I used 3in1 installation toolkit. Then I met no problem and I can run cuda program. So, I guess, although the driver in the 3in1 is not newest, it still can ran cuda. Besides, if I skipped installing driver and installed toolkit, there is a problem:
‘cannot detect NVIDIA driver, installation failed’.
So, could you tell me what the last option means ?

Yes, the 3-in-one will work on a system with no optimus… just fine.

The alternative that I mentioned instead of bumblebee on an optimus laptop is to:

  1. install CUDA toolkit w/o driver
  2. install NVIDIA driver w/o modifying xorg.conf
  3. modprobe NVIDIA driver
  4. run your CUDA code

I only tested this with the 4.x CUDA toolkit, I think the 5.x toolkit checks for the presence of a driver… which it doesn’t really need to because it’s just extracting files… but NVIDIA thought that that might be a better idea to do that and bark at you saying to install the driver… so in that case you can probably reverse steps (2) and (1) above to get it working (maybe) with 5.x toolkit.

If you’re having issues with bumblebee on your particular laptop, by all means post in their support group with exact errors and I’m sure someone can help. Bumblebee has an option of doing powersaving features (turning card on-off). Sometimes those scripts do not work perfectly and/or can cause kernel panics… so that could be one possible issue… I know it was for me on one particular laptop.

Did you tried to google the error you got from bumblebee? Did you install the nvidia drivers from the x-swap repository? How did you install bumblebee? Were the nouveau drivers installed before on the laptop? What do you mean by something here “optirun glear’ as a usual user, then I got
‘cannot find NVIDIA GPU’ or something”?

Sorry, let me explain.

  1. When I re-installed ubuntu, I installed bumblebee immediately, following the bumblebee website.
    ‘~ sudo add-apt-repository ppa:bumblebee/stable' '~ sudo add-apt-repository ppa:ubuntu-x-swat/x-updates’
    ‘~ sudo apt-get update' '~ sudo apt-get install bumblebee bumblebee-nvidia linux-headers-generic’
    ‘~$ sudo reboot’

  2. I googled the error, and one explaination was that my lenovo laptop(Y480) couldn’t install bumblebee even though using the hack-solution.

  3. I have a question, what does ‘x-swap repository’ mean?

  4. ‘optirun glear’ is a testing command I found in some firum, it can check whether the NVIDIA driver really work. ‘as a usual user’ means that ‘not a root user’ which I don’t know how to express correctly.

  5. So, when I ran ‘optirun glear’, I got this problem ‘cannot find the command ‘optirun’’ I remembered, not ‘cannot find NVIDIA GPU’.

Thank you!

OK, I’ll have a try, thanks a lot!

Hello,

Yes that is the explanation. On some laptops the bumblebee does not work. I tried to do it on a older lenovo and got the same errors. Should have started with the name of the laptop and save some searches. The only working fix I found was a a archlinux forum.
Please take a look at this page https://wiki.archlinux.org/index.php/Bumblebee It suggests you could still use cuda, but there is also some fix for installing bumblebee: https://github.com/Bumblebee-Project/bbswitch/tree/hack-lenovo . This blog suggets bumblebee works now with 12.10 http://linux-hybrid-graphics.blogspot.de/2011/12/bumblee-on-lenovo-ideapad-y570.html , so mayabe will work with yours as well since I suspect the problem is similar.

Here is another one http://askubuntu.com/questions/172784/has-anyone-used-the-lenovo-y480-with-ubuntu

Good luck.