CUDA “No compatible Device” error on Ubuntu 11.10/

2019-05-05 03:40发布

问题:

I have been trying to set up an Ubuntu environment on my laptop for some time now for CUDA programming. I am currently dual booting Windows 8 and Ubuntu 12.04 and want to install CUDA 5 on Ubuntu.

The laptop has a GeForce GT 640M graphics card (See below for full specs). It is an Optimus card.

Originally I was dual booting Ubuntu 11.10 and have tried tutorials on both 11.10 and 12.04.

I have tried many tutorials of all shapes and sizes, including this tutorial. The installation process shows the device driver installing and the Toolkit installing, and the Samples failing, but when I go to test a simple Vector Add CUDA program in NSight, "No compatible CUDA Device" error is thrown.

Ubuntu Details also still shows "Unknown" for Graphics

Suggestions?

Laptop Specs: Acer V3-771G Intel Core i7 2670QM nVidia GeForce GT 640M 2GB - Optimus 16GB DDR3-1600 RAM 120GB SSD + 500GB HDD + 32GB Cache SSD

回答1:

Since it is an optimus device, there are some extra steps to be able to use the nvidia GPU. While it is not necessary, I suggest that you use the bumblebee wrapper program because it is the easiest solution.

After you have installed the bumblebee wrapper you can run your programs using optirun programname or start a shell with the nvidia card activated: optirun bash --login

An added bonus is that the bumblebee daemon will disable the GPU when it is not running and will save you some battery.

If you don't care about battery life and just want CUDA to be always enabled without wrapping commands you can load the nvidia kernel module and then create the necessary device nodes manually:

mknod /dev/nvidia0 c 195 0
mknod /dev/nvidiactl c 195 255

(This advanced method lets you run cuda programs from the console without starting Xorg, for example when SSH-ing to a machine without a running X server.)

See also https://askubuntu.com/questions/131506/how-can-i-get-nvidia-cuda-or-opencl-working-on-a-laptop-with-nvidia-discrete-car for a more detailed discussion.



回答2:

Try the command sudo apt-get install mesa-utils.

See if the graphics is recognized and then try to install cuda

If does not recognized with the first command try:

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current


回答3:

First install the following libraries & Tools:

sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev

Next we will blacklist some modules(drivers), in terminal enter:

sudo gedit /etc/modprobe.d/blacklist.conf

Add the following to the end of the file(one per line like so):

blacklist amd76x_edac
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv

Save the file and close the editor. Now we want to get rid of any nvidia risiduals, in terminal:

sudo apt-get remove --purge nvidia*

Next you need to restart your machine (sudo reboot).

0) Press Ctrl+Alt+F1 at login screen(you don't have to login, we'll have to restart later anyway), then log in.

1) sudo service lightdm stop

2) cd Downloads

3) chmod +x devdriver*.run (your driver filename)

4) sudo ./devdriver*.run

You might have to run the driver-installer once, reboot(it will remove nouveau drivers) and repeat the steps again. Follow the installer instructions and it will be fine, when it asks you; yes, you do want the 32-bit libraries and you DO want it to change the xorg.conf file.

Once the installer completes, restart (sudo reboot). You're done :]

In Order to install SDK and Toolkit, use the steps 3 and 4 with the downloaded files. (.run)



回答4:

In theory, the drivers included with CUDA 5.5 should natively support Optimus (as well as single GPU debugging for non-Optimus laptops). I haven't tried it yet because I'm waiting for a compute 3.5 Optimus laptop so that it'll support kernel recursion and HyperQ. In theory the HP Envy 15t-j000 has the GK208 version of the GT 740m, but I'd really rather have an ultrabook form factor like the upcoming Acer S3-392 with GT 735m. The NVIDIA guys at GTC assured me that Optimus should be working with the CUDA 5.5 RC. I found this 'CUDA Getting Started Guide for Linux' released this month that provides some flags for getting Optimus drivers installed correctly:

http://www.google.com/url?q=http://developer.download.nvidia.com/compute/cuda/5_5/rc/docs/CUDA_Getting_Started_Linux.pdf

Also, more information about GK208 Chips and Compute 3.5 in laptops:

https://devtalk.nvidia.com/default/topic/546357/sounds-like-gk208-laptops-cards-will-support-most-sm_35-features/

Anyone have luck with CUDA 5.5 and Optimus laptops under linux?