天天看点

The installment of CUDA on Ubuntu18.04

Download mateched CUDA pattern on official website.

https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=runfilelocal

check whether it is a right pattern

md5sum cuda_10.0.130_410.48_linux.run
           

First Step:

#install depent package

# 依赖库安装
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
           

Second Step:

downgradw the gcc and g++ pattern.

sudo apt-get install gcc-5
sudo apt-get install g++-5
           

go in to the item of /usr/bin:

cd /usr/bin
ls -l gcc*
           

change the link of gcc-7.0 to gcc-5

sudo mv gcc gcc.bak #copy
sudo ln -s gcc-5.0 gcc #link again
           

and then check and change g++ link pattern

ls -l g++*
           

change the g++ link into g+±5.0:

sudo mv g++ g++.bak
sudo ln -s g++-5 g++
           

check g++ and gcc pattern

gcc -v
g++ -v
           

authorize the run file and install CUDA package

sudo chmod +x cuda_10.0.130_410.48_linux.run
sudo ./cuda_10.0.130_410.48_linux.run
           

And then answer y at every end of question except for install NVIDIA drive.

sudo gedit ~/.bashrc
           

add the condition variables at the end of diologue frame. click the save button at up right cornor of frame.

export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}  
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
           

At last implement the order mentioned blow

source ~/.bashrc
           
nvcc -V
           

继续阅读