I have spent countless hours trying to install CUDA on my old computer with Geforce 8800 GT with Ubuntu 16.04 – and according the matching google hits, several others also have problems.
But my main conclusion is, for NVIDIA Geforce 8800 GT:
- Only works with the Nvidia 340 driver
- Does not work with higher CUDA version than 6.5
- Do NOT install OPENGL drivers on Ubunty, it will destroy your graphical boot up, and it is so much hazzle getting it to work, that you’d rather install Ubuntu again. Which I have done – like 15 times…
Of all the tutorials and forum posts I have found, this is the only one actually working:
But I had to modifiy it for my use, and that is the tutorial below.
Installing CUDA 8.0 on clean install Ubuntu 16.04 with NVIDIA Geforce 8800GT
Install build essentials and do an update.
sudo apt-get install build-essential
sudo apt-get update
sudo apt-get upgrade
Download 64-bit Ubuntu driver cuda_6.5.14_linux_64.run from NVIDIA.
Open up a terminal (CTRL+SHIFT+T) and check if the downloaded file cuda_6.5.14_linux_64.run is executable, it should be green.
If it is white, it’s not executable, and you have to run:
sudo chmod +x cuda_6.5.14_linux_64.run
sudo chmod +x NVIDIA-Linux-x86_64-340.104.run
You can now extract the separate installers via:
sudo ./cuda_6.5.14_linux_64.run -extract=~/Downloads/nvidia_installers
rm -rf NVIDIA-Linux-x86_64-340.29.run
Download NVIDIA-Linux-x86_64-340.104 instead of the default nvidia-304.29 that comes with the toolkit from here: http://www.nvidia.com/Download/driverResults.aspx/123703/en-us
Completely uninstall anything in the Ubuntu repositories with nvidia-* A purge will completely uninstall programs and configuration.
sudo apt-get --purge remove nvidia-*
No need to create an xorg.conf file. If you have one, remove it (assuming you have a fresh OS install).
sudo rm /etc/X11/xorg.conf
sudo nano /etc/modprobe.d/blacklist-nouveau.conf
Add these two lines:
options nouveau modeset=0
Reboot computer. Nothing should have changed in loading up menu. You should be taken to the login screen. Once there type: Ctrl + Alt + F1, and login to your user. Keep the next commands handy in another machine since now you are in tty.
sudo service lightdm stop
The top line is a necessary step for installing the driver. Then do
sudo ./NVIDIA-Linux-x86_64-340.104 <strong>--no-opengl-files
Direct quote from Abhijeet Kislay, and this is what makes the differense from ALL other tutorials and forum posts I have seen!
I cannot stress how important is the opengl flag in the above command. If you miss that, either you will get stuck in “login loop” or your computer would boot with a black screen at all times.
If you get a problem with the driver saying X is running, do this, and try again:
sudo rm -rf .X0-lock
Install the toolkit
Set Environment path variables in .bashrc
Verify the driver version
Answer will be something like this
NVRM version: NVIDIA UNIX x86_64 Kernel Module 340.104 Thu Sep 14 17:13:13 PDT 2017
GCC version: gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
Check CUDA driver version:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
At this point you can switch the lightdm back on again by doing:
sudo service lightdm start
Fix/break the header file that doesn’t want to let us use gcc > 4.8. All we are going to do is comment out (//) the error line that drops you out of a build.
sudo nano /usr/local/cuda/include/host_config.h
In nano press CTRL+SHIFT+_ to enter line number.
Line: 82 – comment out error //#error — unsupported GNU version! gcc 4.9 and up are not supported!
To see if we are properly done with the installation, we need to run a sample.
Something like this should show up
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce 8800 GT"
CUDA Driver Version / Runtime Version 6.5 / 6.5
CUDA Capability Major/Minor version number: 1.1
Total amount of global memory: 512 MBytes (536543232 bytes)
(14) Multiprocessors, ( 8) CUDA Cores/MP: 112 CUDA Cores
GPU Clock rate: 1500 MHz (1.50 GHz)
Memory Clock rate: 900 Mhz
Memory Bus Width: 256-bit
Maximum Texture Dimension Size (x,y,z) 1D=(8192), 2D=(65536, 32768), 3D=(2048, 2048, 2048)
Maximum Layered 1D Texture Size, (num) layers 1D=(8192), 512 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(8192, 8192), 512 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 16384 bytes
Total number of registers available per block: 8192
Warp size: 32
Maximum number of threads per multiprocessor: 768
Maximum number of threads per block: 512
Max dimension size of a thread block (x,y,z): (512, 512, 64)
Max dimension size of a grid size (x,y,z): (65535, 65535, 1)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 256 bytes
Concurrent copy and kernel execution: Yes with 1 copy engine(s)
Run time limit on kernels: Yes
Integrated GPU sharing Host Memory: No
Support host page-locked memory mapping: Yes
Alignment requirement for Surfaces: Yes
Device has ECC support: Disabled
Device supports Unified Addressing (UVA): No
Device PCI Bus ID / PCI location ID: 1 / 0
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 6.5, CUDA Runtime Version = 6.5, NumDevs = 1, Device0 = GeForce 8800 GT
Result = PASS
And now everything works perfect.