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.


Quick and easy solution that worked for me (cuda 5.5, Lubuntu 14.04 64-bit):

Make sure you're using nvidia's propietary driver (331.38 for me) from Start menu-> Preferences->Software & Updates.

Download the .deb package for your Ubuntu release from Nvidia's site.

Add repo:

sudo dpkg -i cuda-repo-ubuntu1304_6.0-37_amd64.deb
sudo apt-get update

Get dependencies:

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

Get the toolkit:

sudo apt-get install nvidia-cuda-toolkit

(Optional) Get nsight IDE:

sudo apt-get install nvidia-nsight

And you're ready to go!


I got the cuda 6 release installed and the samples to work on ubuntu 14.04. First I installed the nvidia driver 334.21 (NVIDIA-Linux-x86_64-334.21.run), then just used the cuda_6.0.37_linux_64.run script.

First I downloaded NVIDIA-Linux-x86_64-334.21.run from nvidia, then logged out of the ubuntu desktop to the login screen. Then logged in remotely over ssh from my laptop and shutdown lightdm sudo service lightdm stop to stop X running, then ran the install script sudo ./NVIDIA-Linux-x86_64-334.21.run, then restarted lightdm sudo service lightdm start. Then rebooted. Verified that hardware acceleration was working by running the UrbanTerror game (not suitable for young children!! but now running at 90+ fps instead of 20fps). I also installed libXi and libXmu packages through synaptic.

Then to installed cuda 6: I downloaded cuda_6.0.37_linux_64.run from nvidia, and installed it using sudo cuda_6.0.37_linux_64.run --override otherwise it complained about not supporting the environment. I think I had to tell it not to overwrite the 334 driver during the install, otherwise accepted defaults. To compile examples I did cd ~/NVIDIA_CUDA-6.0_Samples and make. The examples appeared under bin, a few needed to be run as eg LD_LIBRARY_PATH=/usr/local/cuda-6.0/lib64 ./MersenneTwisterGP11213 otherwise they couldn't find the libcurand.so.6.0 library, but no other problems I noticed.

I don't know if installing using --override is risky, but so far so good for my install.

my system: ubuntu 14.04, AMD FX-8350 CPU, nvidia GTX750 GPU (Maxwell architecture)

I've got the build-essentials package installed, but not nvidia-cuda-toolkit