ubuntu 18.04 安装cuda 10.1

相关网址:

  1. Installation Instructions:
    https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

  2. Deep Learning SDK Documentation
    https://docs.nvidia.com/deeplearning/sdk/
    https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

step 1.

下载CUDA Toolkit 10.1
网址: https://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1804&target_type=deblocal

指令如下:

$ wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
$ sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
$ wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
$ sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
$ sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub
$ sudo apt-get update
$ sudo apt-get -y install cuda

step 2.

安装完毕之后,将以下两条加入.bashrc文件中.

$ sudo gedit ~/.bashrc
添加如下代码:

export PATH=/usr/local/cuda-10.1/bin${PATH:+:$PATH}}      #注意,根据自己的版本, 修改10.1...
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} #注意,根据自己的版本,修改10.1...

step 3.

下载 cudnn-10.1-linux-x64-v7.6.3.30.tgz, 网址为: https://developer.nvidia.com/rdp/cudnn-download

先解压,然后将其中的内容复制到CUDA安装文件夹里面. 如下步骤:

$ sudo cp cuda/include/cudnn.h    /usr/local/cuda/include   注意,解压后的文件夹名称为cuda ,将对应文件复制到 /usr/local中的cuda内
$ sudo cp cuda/lib64/libcudnn*    /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h   /usr/local/cuda/lib64/libcudnn*

step 4.

Verifying
To verify that cuDNN is installed and is running properly, compile the mnistCUDNN sample located in the /usr/src/cudnn_samples_v7 directory in the debian file.

$ cp -r /usr/src/cudnn_samples_v7/ $HOME			# Copy the cuDNN sample to a writable path.
$ cd  $HOME/cudnn_samples_v7/mnistCUDNN	# Go to the writable path.
$ make clean && make	# Compile the mnistCUDNN sample.
$ ./mnistCUDNN				# Run the mnistCUDNN sample.

If cuDNN is properly installed and running on your Linux system, you will see a message similar to the following:
Test passed!

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值