First verify that you have an NVIDIA graphics card (Http://developer.nvidia.com/cuda-gpus this site to see if you have a graphics card that supports GPU):
$ LSPCI | Grep-i nvidia
See your Linux distributions (mostly 64-bit or 32-bit):
$ uname-m && cat/etc/*release
Look at the version of GCC:
$ gcc--version
First download the NVIDIA Cuda Warehouse installation package (my Ubuntu 14.04 64 bit, so the download is ubuntu14.04 installation package, if you are 32-bit can refer to the specific address, the specific address is https:// Developer.nvidia.com/cuda-downloads)
wget Http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
After the download is complete, you can install it using the following command, note that the filename is modified to Cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo dpkg-i cuda-repo-<distro>_<version>_<architecture>.deb
Once the warehouse is installed, you can update your local warehouse.
sudo apt-get update
Finally began to install Cuda and graphics driver (installation of CUDA will be the same time the graphics driver installed all, this is really very convenient. But the download time is a bit long. )
sudo apt-get install Cuda
It is important to note that the installation method I offer here is different from the various installation methods on the network, and their methods are often complex
Mainly because: (1) Some tutorials are manual installation of video card driver, manual shielding system of the default open source drive
(2) The installation of Cuda is also done manually
When using this method, you must pay attention to several problems:
(1) cuda6.5 has not supported the old graphics card, so sm11 and so on must be deleted. I can refer to another article about compiling opencv3.0.
(2) ubuntu14.04 is 64-bit, and do not update the system at the beginning of what, because the system has been updated, then install the graphics driver will not be able to enter the graphical interface, I checked the relevant log found to be stuck in the Dbus yonder. So, I recommend that you do not update the system patches as soon as you install Ubuntu 14.04.
After installation you need to set the environment variables:
$ export Path=/usr/local/cuda-6.5/bin: $PATH
$ export ld_library_path=/usr/local/cuda-6.5/lib64: $LD _library_ PATH
After setting up, you can also choose whether to install Cuda with the sample code (<dir> indicate the location you want to install, you can replace the <dir> to ~):
$ cuda-install-samples-6.5.sh <dir>
Next, do some validation work:
To view the driver version of the video card
Cat/proc/driver/nvidia/version
To view the version of the NVCC compiler
Nvcc-v I
Sample code for compiling Cuda:
CD ~/nvidia_cuda-6.5_samples
Then make the compilation code.
Go to the bin path to run Devicequery
CD ~/nvidia_cuda-6.5_samples/bin
./Devicequery
The specific installation process can be referred to in English.
Http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux/index.html
It must be emphasized here that if the new ubuntu14.04 should not be updated before installing the graphics driver, otherwise it will not be able to access the desktop, this problem has been bothering me for a long time. The system has been installed more than 10 times.
This guide is just a few discrete installation steps and a reminder to Up-and for some of Cuda's pits.
Of course, if you are willing to manually install graphics drivers and so on, you can refer to: https://ouxinyu.github.io/Blogs/20140723001.html
However, please refer to the Official document.
Here I do a unified answer, comments in which someone asked the virtual machine can use Cuda, I answer is not can, it's a common sense question ..... ......... ....... ................ ........
The virtual machine's video card is fictitious, first not Nvidia's graphics card, but a software graphics card.
Performance is not comparable to the actual video card. Besides, Cuda can not use GPU calculation even if installed.