cuda9.1下載鏈接
https://developer.nvidia.com/cuda-91-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1704&target_type=runfilelocal
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev sudo sh cuda_8.0.61_375.26_linux.run #開始安裝 #..一堆協議說明... #直接按q退出協議說明. zerozone@zerozone: accept/decline/quit: accept #接受協議 Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26? y)es/(n)o/(q)uit: n #是否顯卡驅動包,由於已經安裝顯卡驅動,選擇n Install the CUDA 8.0 Toolkit? (y)es/(n)o/(q)uit: y #是否安裝工具包,選擇y Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]: #工具包安裝地址,默認回車即可 Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: y #添加鏈接**注意這個連接,如果你之前安裝過另一個版本的cuda,除非你確定想要用這個新版本的cuda,否則這里就建議選no,因為指定該鏈接后會將cuda指向這個新的版本** Install the CUDA 8.0 Samples? (y)es/(n)o/(q)uit: y #安裝樣例 Enter CUDA Samples Location [ default is /root ]: #樣例安裝地址默認即可 # ***安裝信息*** Installing the CUDA Toolkit in /usr/local/cuda-8.0 ... Missing recommended library: libXi.so Missing recommended library: libXmu.so #注意,這里出現了Missing recommended library錯誤, #是因為博主在第一次安裝時,沒有添加最開始的那條安裝相關依賴的指令, #之后我添加了依賴后,再次安裝,就沒有Missing錯誤了 Installing the CUDA Samples in /root ... Copying samples to /root/NVIDIA_CUDA-8.0_Samples now... Finished copying samples. =========== = Summary = =========== Driver: Not Selected Toolkit: Installed in /usr/local/cuda-8.0 Samples: Installed in /root, but missing recommended libraries Please make sure that - PATH includes /usr/local/cuda-8.0/bin - LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA. ***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 8.0 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file: sudo <CudaInstaller>.run -silent -driver Logfile is /tmp/cuda_install_6388.log # ***安裝完成***
在Ubuntu18.04中安裝CUDA 9.1時,會遇到Error: unsupported compiler: 7.5.0的錯誤。其原因是Ubuntu18.04的編譯器版本過高,因此只需要安裝較低版本的gcc、g++即可。
具體解決方法是:
sudo apt install gcc-6 g++-6 sudo ln -s /usr/bin/gcc-6 /usr/local/bin/gcc sudo ln -s /usr/bin/g++-6 /usr/local/bin/g++
之后就可以安裝cuda9.1了
vim ~/.bashrc #修改配置文件(如果你用的是zsh,則需要修改 ~/.zshrc文件) #在文件結尾處添加 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64 export PATH=$PATH:/usr/local/cuda/bin export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
建立指向cuda9.1的軟鏈接
sudo ln -s /usr/local/cuda-9.1 /usr/local/cuda
查看版本是否為cuda9.1
nvcc -V