{"id":51407,"date":"2024-10-08T18:21:18","date_gmt":"2024-10-08T10:21:18","guid":{"rendered":"https:\/\/server.hk\/cnblog\/51407\/"},"modified":"2024-11-14T10:43:23","modified_gmt":"2024-11-14T02:43:23","slug":"ubuntu-16-04-cuda-8-0-mkl-opencv-3-2-matlab-r2016b-caffe-%e5%ae%89%e8%a3%9d","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/51407\/","title":{"rendered":"Ubuntu 16.04 + CUDA 8.0 + MKL + OpenCV 3.2 + Matlab R2016b + Caffe \u5b89\u88dd"},"content":{"rendered":"<h1 id=\"ubuntu-16-04-cuda-8-0-mkl-opencv-3-2-matlab-r2016b-caffe-%e5%ae%89%e8%a3%9d%e6%8c%87%e5%8d%97-kxuVRTlPDz\">Ubuntu 16.04 + CUDA 8.0 + MKL + OpenCV 3.2 + Matlab R2016b + Caffe \u5b89\u88dd\u6307\u5357<\/h1>\n<p>\u5728\u7576\u4eca\u7684\u8a08\u7b97\u6a5f\u8996\u89ba\u548c\u6df1\u5ea6\u5b78\u7fd2\u9818\u57df\uff0c\u8a31\u591a\u958b\u767c\u8005\u548c\u7814\u7a76\u4eba\u54e1\u9078\u64c7\u4f7f\u7528 Ubuntu \u4f5c\u70ba\u4ed6\u5011\u7684\u64cd\u4f5c\u7cfb\u7d71\u3002\u9019\u7bc7\u6587\u7ae0\u5c07\u6307\u5c0e\u60a8\u5982\u4f55\u5728 Ubuntu 16.04 \u4e0a\u5b89\u88dd CUDA 8.0\u3001MKL\u3001OpenCV 3.2\u3001Matlab R2016b \u548c Caffe\uff0c\u9019\u4e9b\u5de5\u5177\u5c07\u5e6b\u52a9\u60a8\u9032\u884c\u9ad8\u6548\u7684\u6578\u64da\u8655\u7406\u548c\u6a21\u578b\u8a13\u7df4\u3002<\/p>\n<h2 id=\"%e7%b3%bb%e7%b5%b1%e8%a6%81%e6%b1%82-kxuVRTlPDz\">\u7cfb\u7d71\u8981\u6c42<\/h2>\n<ul>\n<li>\u64cd\u4f5c\u7cfb\u7d71\uff1aUbuntu 16.04<\/li>\n<li>\u986f\u793a\u5361\uff1a\u652f\u6301 CUDA \u7684 NVIDIA \u986f\u793a\u5361<\/li>\n<li>\u5167\u5b58\uff1a\u81f3\u5c11 8GB<\/li>\n<li>\u786c\u789f\u7a7a\u9593\uff1a\u81f3\u5c11 20GB \u53ef\u7528\u7a7a\u9593<\/li>\n<\/ul>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%80%ef%bc%9a%e5%ae%89%e8%a3%9d-cuda-8-0-kxuVRTlPDz\">\u6b65\u9a5f\u4e00\uff1a\u5b89\u88dd CUDA 8.0<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd NVIDIA \u7684 CUDA \u5de5\u5177\u5305\u3002\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u9032\u884c\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential\nwget https:\/\/developer.download.nvidia.com\/compute\/cuda\/8.0\/Prod\/local_installers\/cuda-repo-ubuntu1604-8-0-local_8.0.XX-1_amd64.deb\nsudo dpkg -i cuda-repo-ubuntu1604-8-0-local_8.0.XX-1_amd64.deb\nsudo apt-get update\nsudo apt-get install cuda\n<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u60a8\u9700\u8981\u5c07 CUDA \u7684\u8def\u5f91\u6dfb\u52a0\u5230\u74b0\u5883\u8b8a\u91cf\u4e2d\u3002\u7de8\u8f2f\u60a8\u7684 .bashrc \u6587\u4ef6\uff1a<\/p>\n<pre><code>nano ~\/.bashrc\n<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u672b\u5c3e\u6dfb\u52a0\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre><code>export PATH=\/usr\/local\/cuda-8.0\/bin${PATH:+:${PATH}}\nexport LD_LIBRARY_PATH=\/usr\/local\/cuda-8.0\/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}\n<\/code><\/pre>\n<p>\u4fdd\u5b58\u4e26\u9000\u51fa\uff0c\u7136\u5f8c\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>source ~\/.bashrc\n<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%ba%8c%ef%bc%9a%e5%ae%89%e8%a3%9d-mkl-kxuVRTlPDz\">\u6b65\u9a5f\u4e8c\uff1a\u5b89\u88dd MKL<\/h2>\n<p>Intel \u7684\u6578\u5b78\u6838\u5fc3\u51fd\u6578\u5eab\uff08MKL\uff09\u53ef\u4ee5\u52a0\u901f\u6578\u5b78\u8a08\u7b97\u3002\u60a8\u53ef\u4ee5\u5f9e Intel \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09 MKL\uff0c\u7136\u5f8c\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u5b89\u88dd\uff1a<\/p>\n<pre><code>wget https:\/\/anaconda.org\/intel\/mkl\/2017.0.3\/download\/linux-64\/mkl-2017.0.3-0.tar.bz2\ntar -xvjf mkl-2017.0.3-0.tar.bz2\ncd mkl-2017.0.3-0\nsudo cp -r * \/usr\/local\/mkl\n<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%89%ef%bc%9a%e5%ae%89%e8%a3%9d-opencv-3-2-kxuVRTlPDz\">\u6b65\u9a5f\u4e09\uff1a\u5b89\u88dd OpenCV 3.2<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u5b89\u88dd OpenCV\u3002\u9996\u5148\uff0c\u5b89\u88dd\u5fc5\u8981\u7684\u4f9d\u8cf4\u9805\uff1a<\/p>\n<pre><code>sudo apt-get install libopencv-dev python-opencv\n<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u60a8\u53ef\u4ee5\u5f9e OpenCV \u7684 GitHub \u5009\u5eab\u514b\u9686\u6e90\u4ee3\u78bc\u4e26\u7de8\u8b6f\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/opencv\/opencv.git\ncd opencv\ngit checkout 3.2.0\nmkdir build\ncd build\ncmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=\/usr\/local ..\nmake -j4\nsudo make install\n<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e5%9b%9b%ef%bc%9a%e5%ae%89%e8%a3%9d-matlab-r2016b-kxuVRTlPDz\">\u6b65\u9a5f\u56db\uff1a\u5b89\u88dd Matlab R2016b<\/h2>\n<p>Matlab \u7684\u5b89\u88dd\u76f8\u5c0d\u7c21\u55ae\u3002\u60a8\u9700\u8981\u5f9e MathWorks \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09 R2016b \u7684\u5b89\u88dd\u5305\uff0c\u7136\u5f8c\u904b\u884c\u5b89\u88dd\u7a0b\u5e8f\u3002\u8acb\u78ba\u4fdd\u60a8\u64c1\u6709\u6709\u6548\u7684\u6388\u6b0a\u3002<\/p>\n<pre><code>cd ~\/Downloads\ntar -xvf matlab_R2016b_glnxa64.tar.gz\ncd matlab_R2016b\nsudo .\/install\n<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%ba%94%ef%bc%9a%e5%ae%89%e8%a3%9d-caffe-kxuVRTlPDz\">\u6b65\u9a5f\u4e94\uff1a\u5b89\u88dd Caffe<\/h2>\n<p>\u6700\u5f8c\uff0c\u5b89\u88dd Caffe\u3002\u9996\u5148\uff0c\u5b89\u88dd\u5fc5\u8981\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\n<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u514b\u9686 Caffe \u7684 GitHub \u5009\u5eab\u4e26\u7de8\u8b6f\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/BVLC\/caffe.git\ncd caffe\ncp Makefile.config.example Makefile.config\nmake all -j8\nmake test -j8\nmake runtest -j8\n<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-kxuVRTlPDz\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u5728 Ubuntu 16.04 \u4e0a\u6210\u529f\u5b89\u88dd CUDA 8.0\u3001MKL\u3001OpenCV 3.2\u3001Matlab R2016b \u548c Caffe\u3002\u9019\u4e9b\u5de5\u5177\u5c07\u70ba\u60a8\u7684\u8a08\u7b97\u6a5f\u8996\u89ba\u548c\u6df1\u5ea6\u5b78\u7fd2\u9805\u76ee\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002\u5982\u679c\u60a8\u9700\u8981\u7a69\u5b9a\u7684\u74b0\u5883\u4f86\u904b\u884c\u9019\u4e9b\u61c9\u7528\u7a0b\u5e8f\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u4ee5\u7372\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Step-by-step guide for installing Ubuntu 16.04 with CUDA 8.0, MKL, OpenCV 3.2, Matlab R2016b, and Caffe for optimal performance.<\/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-51407","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51407","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=51407"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51407\/revisions"}],"predecessor-version":[{"id":51408,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51407\/revisions\/51408"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=51407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=51407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=51407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}