How to install CUDA from Ubuntu repositories

The Ubuntu repositories now host CUDA packages. These may not be latest and greatest, but I find them to work well with the NVIDIA drivers from the same place. Also, they are very easy to install compared to the packages from the NVIDIA website.

  • First, install the latest NVIDIA driver available from the repositories. NVIDIA driver package is named as nvidia-xyz, where xyz is the version. Pick the largest number version that is available from the repositories. For example:
$ sudo apt install nvidia-331

The installation process compiles the driver for your particular Linux kernel and deploys that module. Restart the computer once the install is done.

You must be able to see a NVIDIA module when you list the kernel modules. For example, on my computer:

$ dkms status
nvidia-331, 331.38, 3.13.0-24-generic, x86_64: installed
  • Now you are ready to install CUDA. This is really easy since installing the package nvidia-cuda-toolkit will pull in all the hundred other CUDA packages and tools that are needed:
$ sudo apt install nvidia-cuda-toolkit

That is it, enjoy your CUDA programming!🙂

Tried with: Linux kernel 3.13.0-24-generic, CUDA 5.5, NVIDIA driver 331, NVIDIA GTX Titan and Ubuntu 14.04

2 thoughts on “How to install CUDA from Ubuntu repositories”

  1. After spending days trying to get my system working with CUDA, this super simple solution finally did the trick, even with my nVidia Optimus configuration. Thanks!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s