Installing and testing CUDA in Ubuntu 14.04

I got Cuda6 working on Lubuntu 14.04. This already had build-essentials installed, so if you're using a fresh install, you should probably install it:

apt-get install build-essential

Download the cuda6 run package (6.0.37 at the current time of writing) to ~/Downloads:

Open up a terminal and extract the separate installers via:

mkdir ~/Downloads/nvidia_installers;
cd ~/Downloads
./cuda_6.0.37_linux_64.run -extract=~/Downloads/nvidia_installers;

(I tried running the .run file directly, but it kept screwing up my Xorg install and would never let X run. I believe it is a config issue between driver versions: those installed by apt-get nvidia-331-updates and the cuda*.run driver.)

Completely uninstall anything in the Ubuntu repositories with nvidia-*. I used synaptic and did a purge, AKA completely uninstall programs and configuration.

sudo apt-get --purge remove "nvidia-*"

Have these instructions handy as we need to kill X install the driver. Press CTL + ALT + F1 to drop to the physical terminal and log in.

cd ~/Downloads/nvidia_installers;
sudo service lightdm stop
sudo killall Xorg
sudo ./NVIDIA-Linux-x86_64-331.62.run 

Accept the EULA and install the driver. I would recommend letting it update Xorg config files.

After that installer finishes, turn on the nvidia module and install CUDA.

sudo modprobe nvidia
sudo ./cuda-linux64-rel-6.0.37-18176142.run
sudo ./cuda-samples-linux-6.0.37-18176142.run

test if the drivers are working by going to your sample directory

cd /usr/local/cuda/samples
sudo chown -R <username>:<usergroup> .
cd 1_Utilities/deviceQuery
make .
./deviceQuery    

Worked for me at this point. Now restart X

sudo service lightdm start

You should be able to do

lsmod | grep nv

and see a line with nvidia listed. Don't forget to log back out of your physical terminal if it all worked.

APPENDIX

In my case it was necessary to add the folder that contains the executable to your $PATH.

One way of doing it is to edit the ~/.bashrc file in your Home folder. Add a line to your .bashrc (modify the location if you changed the default CUDA installation folder)

export PATH=/usr/local/cuda-6.0/bin:$PATH

Save the file and then source your .bashrc by typing

source .bashrc

when in your home folder.


For CUDA-6.5 I followed this simple tutorial:

Download the .deb here then

sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo apt-get update
sudo apt-get install cuda
echo 'export PATH=/usr/local/cuda-6.5/bin:$PATH   #CUDA' >> ~/.bashrc

That's everything I needed to start coding on a fresh 14.04.1 install with my GTX 750ti. It installs the nvidia-340 driver. deviceQuery and all of the other samples ran properly after I compiled them.


I have installed the nvidia-cuda-toolkit package this morning on a fresh 14.04. I also installed the nvidia driver (version 331.38 marked as tested) from the additional driver interface.

sudo apt-get install nvidia-cuda-toolkit

Up to now everything seems to work well (nvcc is here, display is correct). You need to restart to use the new driver.

As you mentioned this is CUDA 5.5 but in my case it's not a problem.