{"id":52111,"date":"2024-10-08T23:57:31","date_gmt":"2024-10-08T15:57:31","guid":{"rendered":"https:\/\/server.hk\/cnblog\/52111\/"},"modified":"2024-11-14T10:40:21","modified_gmt":"2024-11-14T02:40:21","slug":"ubuntu-16-04-gtx-1080-cuda-8-0-opencv-3-1-0-cudnn-v5-caffe-%e5%ae%89%e8%a3%9d%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/52111\/","title":{"rendered":"Ubuntu 16.04 + GTX 1080 + CUDA 8.0 + OpenCV 3.1.0 + cuDNN-v5 + Caffe \u5b89\u88dd\u6559\u7a0b"},"content":{"rendered":"<h1 id=\"ubuntu-16-04-gtx-1080-cuda-8-0-opencv-3-1-0-cudnn-v5-caffe-%e5%ae%89%e8%a3%9d%e6%95%99%e7%a8%8b-zyIhZirYaB\">Ubuntu 16.04 + GTX 1080 + CUDA 8.0 + OpenCV 3.1.0 + cuDNN-v5 + Caffe \u5b89\u88dd\u6559\u7a0b<\/h1>\n<p>\u5728\u6df1\u5ea6\u5b78\u7fd2\u548c\u8a08\u7b97\u6a5f\u8996\u89ba\u7684\u9818\u57df\u4e2d\uff0c\u642d\u5efa\u4e00\u500b\u9ad8\u6548\u7684\u958b\u767c\u74b0\u5883\u662f\u81f3\u95dc\u91cd\u8981\u7684\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 Ubuntu 16.04 \u7cfb\u7d71\u4e0a\u5b89\u88dd NVIDIA GTX 1080 \u986f\u793a\u5361\u7684\u9a45\u52d5\u7a0b\u5f0f\u3001CUDA 8.0\u3001cuDNN v5\u3001OpenCV 3.1.0 \u4ee5\u53ca Caffe \u6846\u67b6\u3002\u9019\u4e9b\u5de5\u5177\u7684\u7d44\u5408\u80fd\u5920\u70ba\u958b\u767c\u8005\u63d0\u4f9b\u5f37\u5927\u7684\u8a08\u7b97\u80fd\u529b\u548c\u9748\u6d3b\u7684\u5716\u50cf\u8655\u7406\u529f\u80fd\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-zyIhZirYaB\">\u524d\u671f\u6e96\u5099<\/h2>\n<ul>\n<li>\u78ba\u4fdd\u4f60\u7684\u7cfb\u7d71\u662f Ubuntu 16.04\u3002<\/li>\n<li>\u64c1\u6709 NVIDIA GTX 1080 \u986f\u793a\u5361\u3002<\/li>\n<li>\u64c1\u6709 sudo \u6b0a\u9650\u7684\u7528\u6236\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9d-nvidia-%e9%a9%85%e5%8b%95%e7%a8%8b%e5%bc%8f-zyIhZirYaB\">\u5b89\u88dd NVIDIA \u9a45\u52d5\u7a0b\u5f0f<\/h2>\n<p>\u9996\u5148\uff0c\u66f4\u65b0\u7cfb\u7d71\u4e26\u5b89\u88dd\u5fc5\u8981\u7684\u5de5\u5177\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get upgrade\nsudo apt-get install build-essential dkms<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6dfb\u52a0 NVIDIA \u7684 PPA \u4e26\u5b89\u88dd\u9a45\u52d5\u7a0b\u5f0f\uff1a<\/p>\n<pre><code>sudo add-apt-repository ppa:graphics-drivers\/ppa\nsudo apt-get update\nsudo apt-get install nvidia-384<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u91cd\u555f\u7cfb\u7d71\u4ee5\u4f7f\u9a45\u52d5\u7a0b\u5f0f\u751f\u6548\uff1a<\/p>\n<pre><code>sudo reboot<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-cuda-8-0-zyIhZirYaB\">\u5b89\u88dd CUDA 8.0<\/h2>\n<p>\u524d\u5f80 NVIDIA \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09 CUDA 8.0 \u7684\u5b89\u88dd\u5305\u3002\u9078\u64c7\u9069\u5408 Ubuntu 16.04 \u7684\u7248\u672c\uff0c\u7136\u5f8c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.XX-1_amd64.deb\nsudo apt-key add \/var\/cuda-repo-ubuntu1604-8-0-local\/7fa2af80.pub\nsudo apt-get update\nsudo apt-get install cuda<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u5c07 CUDA \u7684\u8def\u5f91\u6dfb\u52a0\u5230\u74b0\u5883\u8b8a\u91cf\u4e2d\uff1a<\/p>\n<pre><code>echo 'export PATH=\/usr\/local\/cuda-8.0\/bin:$PATH' &gt;&gt; ~\/.bashrc\necho 'export LD_LIBRARY_PATH=\/usr\/local\/cuda-8.0\/lib64:$LD_LIBRARY_PATH' &gt;&gt; ~\/.bashrc\nsource ~\/.bashrc<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-cudnn-v5-zyIhZirYaB\">\u5b89\u88dd cuDNN v5<\/h2>\n<p>\u4e0b\u8f09 cuDNN v5 \u7684\u58d3\u7e2e\u5305\uff0c\u4e26\u89e3\u58d3\u7e2e\u5f8c\u5c07\u5176\u5167\u5bb9\u8907\u88fd\u5230 CUDA \u7684\u76f8\u61c9\u76ee\u9304\u4e2d\uff1a<\/p>\n<pre><code>tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz\nsudo cp cuda\/include\/cudnn.h \/usr\/local\/cuda\/include\nsudo cp cuda\/lib64\/libcudnn* \/usr\/local\/cuda\/lib64\nsudo chmod a+r \/usr\/local\/cuda\/include\/cudnn.h \/usr\/local\/cuda\/lib64\/libcudnn*<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-opencv-3-1-0-zyIhZirYaB\">\u5b89\u88dd OpenCV 3.1.0<\/h2>\n<p>\u9996\u5148\uff0c\u5b89\u88dd OpenCV \u7684\u4f9d\u8cf4\u9805\uff1a<\/p>\n<pre><code>sudo apt-get install libopencv-dev python-opencv<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5f9e GitHub \u4e0b\u8f09 OpenCV 3.1.0 \u7684\u6e90\u78bc\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/opencv\/opencv.git\ncd opencv\ngit checkout 3.1.0\nmkdir build\ncd build\ncmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=\/usr\/local ..\nmake -j4\nsudo make install<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-caffe-%e6%a1%86%e6%9e%b6-zyIhZirYaB\">\u5b89\u88dd Caffe \u6846\u67b6<\/h2>\n<p>\u9996\u5148\uff0c\u5b89\u88dd Caffe \u7684\u4f9d\u8cf4\u9805\uff1a<\/p>\n<pre><code>sudo apt-get install libatlas-base-dev\nsudo apt-get install protobuf-compiler\nsudo apt-get install libprotobuf-dev\nsudo apt-get install libhdf5-serial-dev\nsudo apt-get install libleveldb-dev\nsudo apt-get install libsnappy-dev\nsudo apt-get install libopencv-dev\nsudo apt-get install libboost-all-dev<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u5f9e GitHub \u4e0b\u8f09 Caffe \u7684\u6e90\u78bc\u4e26\u7de8\u8b6f\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/BVLC\/caffe.git\ncd caffe\ncp Makefile.config.example Makefile.config\n# \u7de8\u8f2f Makefile.config\uff0c\u6839\u64da\u9700\u8981\u555f\u7528 GPU \u652f\u6301\nmake all -j8\nmake test -j8\nmake runtest<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-zyIhZirYaB\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u6211\u5011\u6210\u529f\u5728 Ubuntu 16.04 \u7cfb\u7d71\u4e0a\u5b89\u88dd\u4e86 NVIDIA GTX 1080 \u9a45\u52d5\u7a0b\u5f0f\u3001CUDA 8.0\u3001cuDNN v5\u3001OpenCV 3.1.0 \u548c Caffe \u6846\u67b6\u3002\u9019\u4e9b\u5de5\u5177\u7684\u7d44\u5408\u5c07\u70ba\u958b\u767c\u8005\u63d0\u4f9b\u5f37\u5927\u7684\u8a08\u7b97\u80fd\u529b\u548c\u9748\u6d3b\u7684\u5716\u50cf\u8655\u7406\u529f\u80fd\uff0c\u9069\u5408\u9032\u884c\u6df1\u5ea6\u5b78\u7fd2\u548c\u8a08\u7b97\u6a5f\u8996\u89ba\u7684\u7814\u7a76\u8207\u958b\u767c\u3002<\/p>\n<p>\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u670d\u52d9\u4f86\u652f\u6301\u60a8\u7684\u958b\u767c\u5de5\u4f5c\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u63d0\u4f9b\u9ad8\u6548\u80fd\u7684\u8a08\u7b97\u74b0\u5883\uff0c\u52a9\u60a8\u5728\u6280\u8853\u4e0a\u66f4\u4e0a\u4e00\u5c64\u6a13\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install Ubuntu 16.04 with GTX 1080, CUDA 8.0, OpenCV 3.1.0, cuDNN-v5, and Caffe in this comprehensive tutorial.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-52111","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=52111"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52111\/revisions"}],"predecessor-version":[{"id":52112,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/52111\/revisions\/52112"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=52111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=52111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=52111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}