The system is Ubuntu 18.04, the nvidia-460 driver has been installed, and now I plan to install cuda-9.0
I downloaded the Ubuntu16.04 version of cuda-9.0 on the official website, and the required gcc version is 5.
Article Directory
Install cuda-9.0
After downloading the installation package, --override
you can skip the gcc version check
sudo sh cuda_9.0.176_384.81_linux.run --override
Ctrl + C
,then
Do you accept the previously read EULA?
accept/decline/quit: accept
You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: y
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n
Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Simples Location
[ default is /home/hjl ]:
Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
After the installation is complete displays, Samples missing some of the dependencies, but it does not matter, only the role Samples of acquiring CUDA_ARCH
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.0
Samples: Installed in /home/hjl, but missing recommended libraries
Add environment variables
sudo vim ~/.bashrc
Add the following at the end of the file.
# cuda
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Reload the .bashrc file
source ~/.bashrc
test
nvcc -V
Downgrade gcc
View the current gcc version
gcc -v
g++ -v
View the soft link under usr/bin
ls -l /usr/bin | grep gcc
ls -l /usr/bin | grep g++
Install gcc-5 and g++-5
sudo apt-get install gcc-5
sudo apt-get install g++-5
Modify soft link
cd /usr/bin
sudo ln -fs gcc-5* gcc
sudo ln -fs gcc-5* x86_64-linux-gnu-gcc
Check whether the modification is successful
gcc -v