Ubuntu 18.04瀹夎 CUDA 10.1 銆乧uDNN 7.6.5

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 18.04瀹夎 CUDA 10.1 銆乧uDNN 7.6.5相关的知识,希望对你有一定的参考价值。

鏍囩锛?a href='http://www.mamicode.com/so/1/include' title='include'>include   骞冲彴   cal   col   http   util   linu   dia   uid   

 

 

杞浇璇锋敞鏄庡嚭澶?nbsp; BooTurbo https://www.cnblogs.com/booturbo/p/11834661.html

 

瀹夎骞冲彴鍙婄幆澧?/span>

CPU锛歩9-9900k妗岄潰绾?/span>

GPU锛歊TX 2080绉诲姩鐗?/span>

绯荤粺锛歎buntu 18.04.3 LTS

1銆佸湪瀹夎CUDA涔嬪墠纭繚鐜婊¤冻瀹夎鏉′欢

2銆佽繘鍏VIDIA瀹樼綉涓嬭浇閫傚悎鑷繁鏈哄櫒鐨凜UDA鐗堟湰锛?a style="cursor: pointer;" title="瀹樼綉涓嬭浇" onclick="window.open(鈥榟ttps://developer.nvidia.com/cuda-toolkit-archive?spm=a2c4e.10696291.0.0.7b5819a4F6rq7s鈥?鈥樷€?鈥樷€?;return false;" href="https://developer.nvidia.com/cuda-toolkit-archive?spm=a2c4e.10696291.0.0.7b5819a4F6rq7s">瀹樼綉涓嬭浇锛屽鍥炬墍绀猴紝鎸夌収 Installation Instructions 鏉ヨ繘琛岋紝

 

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

鎶€鏈浘鐗? src=

 

鎶€鏈浘鐗? src=

3銆佸畨瑁呭畬鎴愬悗锛屾坊鍔犵幆澧冨彉閲忥紝鎵撳紑 bashrc 鏂囦欢锛?/span>

鍛戒护琛岃緭鍏ワ細 sudo gedit ~/.bashrc 锛岀劧鍚庡湪鏂囦欢鏈€鍚庢坊鍔犱笅闈?琛岋紝淇濆瓨

 

export CUDA_HOME=/usr/local/cuda

export PATH=$PATH:$CUDA_HOME/bin

export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} 

 

鎶€鏈浘鐗? src=

 

鐒跺悗鍒锋柊涓嬬幆澧冨彉閲忥紝

杈撳叆锛?strong>source ~/.bashrc

4銆佹祴璇曚笅CUDA鏄惁瀹夎鎴愬姛锛?/span>

鏂规硶1锛氳緭鍏?nvcc -V 锛屾樉绀哄涓嬶紝璇存槑娌¢棶棰?/span>

鎶€鏈浘鐗? src=

鏂规硶2锛氳緭鍏ュ涓嬶紝鏄剧ず濡傚浘璇存槑瀹夎鎴愬姛

cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery

 

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

 

5銆佸畨瑁卌uDNN 7.6.5鐗堟湰锛岃浆鍒?a style="cursor: pointer;" title="瀹樼綉涓嬭浇" onclick="window.open(鈥榟ttps://developer.nvidia.com/rdp/cudnn-download?spm=a2c4e.10696291.0.0.1df819a4HJWSTe鈥?鈥樷€?鈥樷€?;return false;" href="https://developer.nvidia.com/rdp/cudnn-download?spm=a2c4e.10696291.0.0.1df819a4HJWSTe">瀹樼綉涓嬭浇锛屼笅杞藉墠鍏堟敞鍐屼竴涓嬶紝濉釜璋冩煡闂嵎锛屾牴鎹嚜宸辩殑鐜鍜屾灦鏋勯€夋嫨鍖咃紝涓嬭浇鍒版湰鍦?/span>

鎶€鏈浘鐗? src=

鍒囨崲鍒颁笅杞界洰褰?cd Downloads 锛岀劧鍚庢寜鐓т互涓嬫搷浣滆繘琛岋紝

瑙e帇 cuDNN Library for Linux锛岃緭鍏ワ細  tar -zxvf cudnn-10.1-linux-x64-v7.6.5.32.tgz 

灏嗚В鍘嬪嚭鏉ョ殑鏂囦欢澶嶅埗鍒板畨瑁呯殑CUDA鐜涓紝杈撳叆锛?nbsp;sudo cp cuda/include/cudnn.h /usr/local/cuda/inlude 

                                                                                                             sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64  

鏇存敼鏉冮檺锛岃緭鍏ワ細 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*  

瀹夎 Deb 鍖咃紝cuDNN Runtime Library for Ubuntu18.04(Deb)锛宑uDNN Developer Library for Ubuntu18.04(Deb)锛宑uDNN Code Samples and User Guide for Ubuntu18.04(Deb)

鍒嗗埆杈撳叆锛?  sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb 

                       sudo dpkg -i libcudnn7-dev_7.6.5.32-1+cuda10.1_amd64.deb  

                       sudo dpkg -i libcudnn7-doc_7.6.5.32-1+cuda10.1_amd64.deb  

瀹夎缁撴潫鍚庯紝娴嬭瘯涓€涓嬶紝

鏂规硶1锛岃緭鍏ワ細 cp -r /usr/src/cudnn_samples_v7/ ~ 

                           cd ~/cudnn_samples_v7/mnistCUDNN 

                           make clean && make 

                           ./mnistCUDNN 

 

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

鍑虹幇Test passed锛佹病鏈夋姤閿欏嵆瀹夎鎴愬姛

鏂规硶2锛岃緭鍏ワ細 cd /usr/local/cuda/samples/1_Utilities/deviceQuery 

                           sudo make 

                           ./deviceQuery

鎶€鏈浘鐗? src=

鎶€鏈浘鐗? src=

鍑虹幇PASS缁撴灉锛岃鏄庡畨瑁呮垚鍔熴€?/span>

 

 

 

以上是关于Ubuntu 18.04瀹夎 CUDA 10.1 銆乧uDNN 7.6.5的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Tensorflow V.2.4 RTX 2070 Super Ubuntu 18.04 安装 Cuda 10.1

ubuntu18.04 安装 cuda8 并多版本共存

ubuntu20.04系统+cuda10.1+opencv4.1.0+dense_flow的编译与安装,吐血总结!!!

Tensorflow 1.12 是不是与 CUDA 10.1 兼容?

Ubuntu18.04 配置TensorRT6.0爬坑记录

Ubantu18.04安装NVIDIA驱动+cuda10.1+cuDNN+Tensorflow2.1(成功)