Ubuntu16.04+GTX1060mq(驱动版本430.64)安装CUDA10.0
CUDA下载
cuda最新版本下载地址(可在该页面进入历史版本下载):
https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
cuda10.0下载地址:
https://developer.nvidia.com/cuda-10.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1604&target_type=runfilelocal
选择相应的版本配置,点击Download下载,并将下载文件复制到Home文件夹下
CUDA版本选择
根据驱动版本不同,需要选择不同的cuda版本,cuda版本越高需要的驱动版本越高,具体在以下网址可以查看,其中CUDA10.0要求nvidai驱动版本高于410.48,网上教程说用418驱动没问题,本篇实测430驱动也没问题。
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
CUDA安装
sudo chmod a+x cuda_10.0.130_410.48_linux.run //给文件权限aiudo
./cuda_10.0.130_410.48_linux.run //安装(在cuda.run文件在home文件夹前提下,如果在其他文件夹下需要更改相应路径
运行后会显示0%,正式nvidia的安装协议,一直按向下就可以,然后按照以下输入:
Do you accept the previously read EULA?
accept/decline/quit: accept //接受协议
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: no //一定选择no,不安装推荐的驱动,因为我们已经安装好了显卡驱动,这里安装推荐的驱动可能会出现驱动问题
Install the CUDA 10.0 Toolkit?
(y)es/(n)o/(q)uit: yes //确定安装
Enter Toolkit Location
[ default is /usr/local/cuda-10.0 ]: //直接按回车选择默认安装路径
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: yes //确认安装
Install the CUDA 10.0 Samples?
(y)es/(n)o/(q)uit: yes //确认安装
Enter CUDA Samples Location
[ default is /home/zhangman ]: //直接按回车选择默认安装路径
Installing the CUDA Toolkit in /usr/local/cuda-10.0 ...
Installing the CUDA Samples in /home/zhangman ...
Copying samples to /home/zhangman/NVIDIA_CUDA-10.0_Samples now...
Finished copying samples.
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-10.0
Samples: Installed in /home/zhangman
Please make sure that
- PATH includes /usr/local/cuda-10.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-10.0/lib64, or, add /usr/local/cuda-10.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-10.0/bin
//cuda卸载方式
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.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 10.0 functionality to work.
//这个警告是因为我们没安装cuda推荐的驱动,因为我们已经安装好可驱动,忽略即可
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_23401.log
此时一般nvcc还没有加入全局环境
sudo gedit ~/.bashrc //打开sudo gedit ~/.bashrc添加环境
在.bashrc最后添加:
export PATH=$PATH:/usr/local/cuda/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/bin/lib64:$LD_LIBRARY_PATH
重新source一下
source ~/.bashrc
验证安装
zhangman@zhangman-G3-3579:~$ nvcc --version //输入验证命令
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130//表示成功安装CUDA10.0
最后通过一个cuda程序验证一下,下载地址:
https://github.com/Yannnnnnnnnnnn/cuda_cmakelists
也可从以下csdn分享下载:
https://download.csdn.net/download/qq_42138662/12326279
下载后解压,运行以下命令
make install会报错 make: *** No rule to make target `install’. Stop. 待解决,应该是程序本身问题
cd cuda_cmakelists-master
mkdir build && cd build
cmake ..
make install
运行成功则正确安装