EDIT: I found a way!
sudo apt-get -y install gcc g++ build-essential automake linux-headers-$(uname -r) git gawk libcurl4-openssl-dev libjansson-dev xorg libc++-dev libgmp-dev python-dev
Install the nvidia display driver
Get the appropriate driver download here. Let's say the latest version is
sudo chmod +x NVIDIA-Linux-x86_64-352.41.run
sudo ./NVIDIA-Linux-x86_64-352.41.run --accept-license --no-questions --disable-nouveau --no-install-compat32-libs
sudo echo 'GRUB_CMDLINE_LINUX="nomodeset"' >> /etc/default/grub
sudo nvidia-xconfig -a --cool-bits=28 --allow-empty-initial-configuration # flags enable OC and fan controls.
cd && wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_6.5-14_amd64.deb
sudo apt-get update
sudo apt-get -y install cuda-toolkit-6-5 # skip reading the entire agreement by pressing ctrl+c
sudo usermod -a -G video $USER
echo "" >> ~/.bashrc
echo "export PATH=/usr/local/cuda-6.5/bin:$PATH" >> ~/.bashrc
echo "export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:$LD_LIBRARY_PATH" >> ~/.bashrc
Reboot and test everything works
Make the deviceQuery sample. This is used to verify cuda works
cd /usr/local/cuda/samples/1_Utilities/deviceQuery && sudo make
If you see all of your cards listed, and the last line says "Result = PASS" you're good to go.
I just spent a few hours trying to figure this out myself. I finally got it installed, but now I constantly get variations of this error:
In file included from /usr/local/cuda-6.5/include/cuda_runtime.h:59:0,
/usr/local/cuda-6.5/include/host_config.h:82:2: error: #error -- unsupported GNU version! gcc 4.9 and up are not supported!
I've Google'd around and there are hacks to kinda make it work a little, but eventually you run into a brick wall. I'm giving up and getting a video card that supports the latest CUDA. Simply put, Nvidia just doesn't support Ubuntu 16.04+ with CUDA 6.5 >:C
If you won't heed my warning and are determined to install CUDA 6.5 on Ubuntu 16.04, here are some of the references I used: