This is what I did. There might be added extra stuff that I could have probably not had to do, but I am going to include it anyways.
First get the ppa repository drivers. (I would say this is required before installing, unless you want to risk some login loop of death).
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
Then install the latest driver. I use the GUI updater for the most part called Software & Updates, in the Additional Drivers tab. As of today nvidia driver 396 is available.
Get g++-6 and gcc-6. (Required)
sudo apt install g++-6
sudo apt install gcc-6
You can try using nvidia-cuda-toolkit, but the paths to the libraries wasn't familiar to me. I didn't want to mess with it.
(I would probably skip this one, but go to it if other stuff is giving issues)
sudo apt install nvidia-cuda-toolkit
I ended up installing the 9.1 run file for Ubuntu 17.04. Download it. Mark the file as executable(I right click on the file in desktop). Go into the terminal and put. (Required)
./cuda_9.1.85_387.26_linux.run --override
It will install it using the new gcc compilers. It will ask you a bunch of questions, and it will want them answered immediately.
Answer yes to the unsupported confguration.
No to the nvidia driver.
Yes- to the toolkit
I used default install locations
After that is installed then make sure you set up your paths. The run file will give you a reminder, too. Also the nvidia documentation will tell you what to export.
echo 'export PATH=/usr/local/cuda-9.1/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64:$LD_LIBRARY_PATH' >> ~/.bash.rc
source ~/.bashrc
Finally you have to set up simlinks to gcc-6 and g++-6 or you will get a warning on compiling your own code.(Required)
sudo ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc
sudo ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++
Reboot the system. (Required)