Checking system capability
First of all, you need to check whether your GPU is CUDA-capable. You can see whether your GPU is listed in CUDA GPUs at https://developer.nvidia.com/cuda-gpus.
Download
Download the CUDA Toolkit from, https://developer.nvidia.com/cuda-downloadsYou need to download the RUN installer for Ubuntu 14.04.
Installing background
Before installing CUDA toolkit, you need to first install nvidia proprietery driver in Ubuntu. You can install this using Additional Drivers in Ubuntu.
Then you need to exit the ubuntu graphics session and go to CLI. For this, press ctrl+alt+f1 and run the following command to stop lightdm display manager.
Then you need to exit the ubuntu graphics session and go to CLI. For this, press ctrl+alt+f1 and run the following command to stop lightdm display manager.
sudo service lightdm stop
Once the lightdm is stopped, you can proceed to next steps.
Installing Prerequisites
If your system does not include necessary dependencies, you might encounter following error when installing CUDA toolkit.
Missing recommended library: libGLU.so Missing recommended library: libXi.so Missing recommended library: libXmu.so Missing recommended library: libGL.so
You need to install additional libraries which installs above dependencies as follows:
sudo apt-get install libglu1-mesa libxi-dev libxmu-dev
Installing CUDA toolkit and samples
Once dependencies are installed, go to where the CUDA toolkit is downloaded, and run the following command to start the installation.
If everything went well, your installation will complete successfully. After installation, you can enable Nvidia C Compiler (nvcc) by including following lines at the end of ~/.bashrc file.
For 32 bit include following two lines at the end of bashrc file
Thank you.
sudo chmod a+x cuda_6.5.14_linux_64.run sudo ./cuda_6.5.14_linux_64.run
If you get an error saying,
Unsupported compiler 4.*.*. Use --override to override this check
it says that your gcc compiler is incompatible with the installation. To prevent this error, you need to change the installation step as,
sudo ./cuda_6.5.14_linux_64.run --override compiler
You can then accept the EULA, and at the next step, do not install nvidia accellerated graphics driver(select no to when asking to install the driver), since we already have installed a proprietery driver.
If everything went well, your installation will complete successfully. After installation, you can enable Nvidia C Compiler (nvcc) by including following lines at the end of ~/.bashrc file.
For 32 bit include following two lines at the end of bashrc file
export PATH=$PATH:/usr/local/cuda-6.5/bin export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib
For 64 bit include following two lines at the end of bashrc file
export PATH=$PATH:/usr/local/cuda-6.5/bin export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:/lib
When it is done, you can check you ncc by running the command,
nvcc --version
You can then go back to your graphics session by running,
sudo service lightdm start
These steps worked for me. Feel free to put a comment below if you encounter an error during installation.
Thank you.