How to install CUDA
I am using an Optimus compatible laptop. Optimus is a tool to switch between Intel and Nvidia graphics cards. Unfortunately Optimus is not available under Linux; however, there are two main alternatives: Bumblebee and Prime Indicator. Here I will use the Prime Indicator.
To get Prime Indicator you have to add the following PPA. sudo add-apt-repository ppa:nilarimogard/webupd8 sudo apt-get update
Now install the driver. sudo apt-get purge bumblebee* nvidia* sudo apt-get install nvidia-prime prime-indicator sudo apt-get install libcuda1-331-updates
Note that the driver version 331 does not support CUDA 6.0 only CUDA 5.5.
After installation I got the error: sh: 1: glxinfo: not found which was solved by installing sudo apt-get install mesa-utils