我的機(jī)器是CUDA16.04的,之前裝過(guò)CUDA10.0,因?yàn)橐恍┰颍F(xiàn)在需要安轉(zhuǎn)CUDA9.0。
1.首先https://developer.nvidia.com/cuda-90-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
下載run版本的(如果之前沒(méi)裝過(guò)CUDA,可以下載deb版本的)
2.按照上面的教程
sudo chmod +x cuda_9.0.176_384.81_linux.run # 為 cuda_9.0.176_384.81_linux.run 添加可執(zhí)行權(quán)限 ./cuda_9.0.176_384.81_linux.run # 安裝 cuda_9.0.176_384.81_linux.run
3.相關(guān)參數(shù)的設(shè)置
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?(y)es/(n)o/(q)uit: n #我已經(jīng)裝過(guò)CUDA10了,所以不需要安轉(zhuǎn)9.0的顯卡驅(qū)動(dòng)Install the CUDA 9.0 Toolkit? (y)es/(n)o/(q)uit: y/usr/local/cuda-9.0 is not writable. Do you wish to run the installation with 'sudo'? (y)es/(n)o: y #使用超級(jí)用戶權(quán)限Please enter your password: Do you want to install a symbolic link at /usr/local/cuda? # 是否將安裝目錄通過(guò)軟連接的方式 link 到 /usr/local/cuda,yes or no 都可以,取決于你是否使用 /usr/local/cuda 為默認(rèn)的 cuda 目錄。 (y)es/(n)o/(q)uit: y #我目前需要使用9.0Enter Toolkit Location[ default is /usr/local/cuda-9.0 ]:#直接回車
4.安轉(zhuǎn)結(jié)束后相關(guān)環(huán)境變量的設(shè)置
Finished copying samples.============ Summary ============Driver: Not SelectedToolkit: Installed in /usr/local/cuda-9.0Samples: Installed in /usr/local/cuda-9.0/SamplesPlease make sure that - PATH includes /usr/local/cuda-9.0/bin - LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as rootTo uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/binPlease see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.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 384.00 is required for CUDA 9.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 -driverLogfile is /tmp/cuda_install_11003.log
如上,需要設(shè)置PATH和LD_LIBRARY_PATH兩個(gè)變量,在./bashrc文件中修改即可,記得要source一些./bashrc,讓其生效。
完成上面這些步驟后,就可以進(jìn)行多個(gè)版本的切換了,直接修改/usr/local/cuda即可,使其指向不同版本的CUDA。
總結(jié)
以上所述是小編給大家介紹的ubuntu16.04安裝多個(gè)版本的CUDA的方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)武林網(wǎng)網(wǎng)站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選