1. remove cuda 7.x version (x depends on what you installed.)
rm /usr/local/cuda-7.x
2. make sure PATH and LD_LIBRARY_PATH no longer contain “/usr/local/cuda-7.x”. Possible places to look at are /etc/environment, ~/.profile, /etc/bash.bashrc, /etc/profile, ~/.bash_rc
If you really don’t know where cuda path is added to PATH or LD_LIBRARY_PATH, try to check here: https://unix.stackexchange.com/questions/813/how-to-determine-where-an-environment-variable-came-from
3. cuda 8.0 only supports Ubuntu 14.04 and 16.04. Therefore, do system upgrade if necessary. Ref: https://askubuntu.com/questions/760347/how-to-upgrade-from-14-04-lts-or-15-10-to-16-04-from-terminal
4. install cuda-8.0 toolkit. Go to here: https://developer.nvidia.com/cuda-downloads and download some file type you prefer. Perhaps .deb file can lead you to install via Software Center, which is not a bad idea.
5. to verify cuda 8.0 has been installed:
cd /usr/local/cuda-8.0/samples/ make cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery ./deviceQuery
You should see:
./deviceQuery Starting...
CUDA Device Query (Runtime API) version (CUDART static linking)
Detected 1 CUDA Capable device(s)
Device 0: "GeForce GT 640M"
CUDA Driver Version / Runtime Version 8.0 / 8.0
CUDA Capability Major/Minor version number: 3.0
Total amount of global memory: 1999 MBytes (2096300032 bytes)
( 2) Multiprocessors, (192) CUDA Cores/MP: 384 CUDA Cores
GPU Max Clock rate: 709 MHz (0.71 GHz)
Memory Clock rate: 2000 Mhz
Memory Bus Width: 128-bit
L2 Cache Size: 262144 bytes
Maximum Texture Dimension Size (x,y,z) 1D=(65536), 2D=(65536, 65536), 3D=(4096, 4096, 4096)
Maximum Layered 1D Texture Size, (num) layers 1D=(16384), 2048 layers
Maximum Layered 2D Texture Size, (num) layers 2D=(16384, 16384), 2048 layers
Total amount of constant memory: 65536 bytes
Total amount of shared memory per block: 49152 bytes
Total number of registers available per block: 65536
Warp size: 32
Maximum number of threads per multiprocessor: 2048
Maximum number of threads per block: 1024
Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
Max dimension size of a grid size (x,y,z): (2147483647, 65535, 65535)
Maximum memory pitch: 2147483647 bytes
Texture alignment: 512 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): Yes
Device PCI Domain ID / Bus ID / location ID: 0 / 1 / 0
Compute Mode:
< Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 8.0, CUDA Runtime Version = 8.0, NumDevs = 1, Device0 = GeForce GT 640M
Result = PASS
Also, you can go to `/usr/local/cuda-8.0/samples/bin` and run any generated test program you want.
(if make has “cannot find -lnvcuvid” error, follow as here: https://askubuntu.com/questions/889218/testing-cuda-in-ubuntu-16-04-usr-bin-ld-cannot-find-lnvcuvid)
ref: http://xcat-docs.readthedocs.io/en/stable/advanced/gpu/nvidia/verify_cuda_install.html
6. follow https//nb4799.neu.edu/wordpress/?p=2572 to set up LD_LIBRARY_PATH and CUDA_HOME