{"id":51463,"date":"2024-10-08T18:51:14","date_gmt":"2024-10-08T10:51:14","guid":{"rendered":"https:\/\/server.hk\/cnblog\/51463\/"},"modified":"2024-11-14T10:43:08","modified_gmt":"2024-11-14T02:43:08","slug":"ubuntu-16-04-%e4%b8%8b%e5%ae%89%e8%a3%9d-cuda-8-0-caffe-tensorflow-gpu-pycharm-%e9%81%8e%e7%a8%8b%ef%bc%88simple%ef%bc%89","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/51463\/","title":{"rendered":"Ubuntu 16.04 \u4e0b\u5b89\u88dd CUDA 8.0 + Caffe + TensorFlow-GPU + Pycharm \u904e\u7a0b\uff08Simple\uff09"},"content":{"rendered":"<h1 id=\"ubuntu-16-04-%e4%b8%8b%e5%ae%89%e8%a3%9d-cuda-8-0-caffe-tensorflow-gpu-pycharm-%e9%81%8e%e7%a8%8b%ef%bc%88simple%ef%bc%89-gHhfqGMKbC\">Ubuntu 16.04 \u4e0b\u5b89\u88dd CUDA 8.0 + Caffe + TensorFlow-GPU + Pycharm \u904e\u7a0b\uff08Simple\uff09<\/h1>\n<p>\u5728\u6df1\u5ea6\u5b78\u7fd2\u7684\u9818\u57df\u4e2d\uff0cCUDA\u3001Caffe \u548c TensorFlow \u662f\u975e\u5e38\u91cd\u8981\u7684\u5de5\u5177\u3002\u9019\u7bc7\u6587\u7ae0\u5c07\u6307\u5c0e\u60a8\u5728 Ubuntu 16.04 \u7cfb\u7d71\u4e0a\u5b89\u88dd CUDA 8.0\u3001Caffe\u3001TensorFlow-GPU \u4ee5\u53ca Pycharm \u7684\u904e\u7a0b\u3002\u9019\u4e9b\u5de5\u5177\u7684\u7d44\u5408\u80fd\u5920\u5e6b\u52a9\u958b\u767c\u8005\u66f4\u9ad8\u6548\u5730\u9032\u884c\u6df1\u5ea6\u5b78\u7fd2\u7684\u7814\u7a76\u548c\u958b\u767c\u3002<\/p>\n<h2 id=\"%e5%89%8d%e6%9c%9f%e6%ba%96%e5%82%99-gHhfqGMKbC\">\u524d\u671f\u6e96\u5099<\/h2>\n<p>\u5728\u958b\u59cb\u5b89\u88dd\u4e4b\u524d\uff0c\u8acb\u78ba\u4fdd\u60a8\u7684\u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\u5230\u6700\u65b0\u7248\u672c\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4f86\u66f4\u65b0\u7cfb\u7d71\uff1a<\/p>\n<pre><code>sudo apt-get update\nsudo apt-get upgrade<\/code><\/pre>\n<p>\u6b64\u5916\uff0c\u60a8\u9700\u8981\u78ba\u4fdd\u60a8\u7684\u986f\u793a\u5361\u652f\u6301 CUDA\u3002NVIDIA \u7684\u986f\u793a\u5361\u901a\u5e38\u662f\u6700\u5e38\u7528\u7684\u9078\u64c7\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u4ee5\u4e0b\u547d\u4ee4\u6aa2\u67e5\u986f\u793a\u5361\u4fe1\u606f\uff1a<\/p>\n<pre><code>lspci | grep -i nvidia<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-cuda-8-0-gHhfqGMKbC\">\u5b89\u88dd CUDA 8.0<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u4e0b\u8f09 CUDA 8.0 \u7684\u5b89\u88dd\u5305\u3002\u53ef\u4ee5\u5f9e NVIDIA \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09\u76f8\u61c9\u7684\u7248\u672c\u3002\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd\uff1a<\/p>\n<pre><code>sudo sh cuda_8.0.XX_linux.run<\/code><\/pre>\n<p>\u5728\u5b89\u88dd\u904e\u7a0b\u4e2d\uff0c\u60a8\u53ef\u4ee5\u9078\u64c7\u5b89\u88dd\u9a45\u52d5\u7a0b\u5e8f\u6216\u4e0d\u5b89\u88dd\uff0c\u6839\u64da\u60a8\u7684\u9700\u6c42\u9032\u884c\u9078\u64c7\u3002\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 ~\/.bashrc \u6587\u4ef6\uff0c\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}}<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u57f7\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u6539\u52d5\u751f\u6548\uff1a<\/p>\n<pre><code>source ~\/.bashrc<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-caffe-gHhfqGMKbC\">\u5b89\u88dd Caffe<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u6211\u5011\u5c07\u5b89\u88dd Caffe\u3002\u9996\u5148\uff0c\u60a8\u9700\u8981\u5b89\u88dd\u4e00\u4e9b\u4f9d\u8cf4\u9805\uff1a<\/p>\n<pre><code>sudo apt-get install build-essential cmake git libatlas-base-dev libboost-all-dev libhdf5-serial-dev protobuf-compiler python-dev python-numpy python-pytest python-scipy<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u514b\u9686 Caffe \u7684 GitHub \u5009\u5eab\uff1a<\/p>\n<pre><code>git clone https:\/\/github.com\/BVLC\/caffe.git\ncd caffe\ncp Makefile.config.example Makefile.config<\/code><\/pre>\n<p>\u6839\u64da\u60a8\u7684\u9700\u6c42\u7de8\u8f2f Makefile.config\uff0c\u7136\u5f8c\u7de8\u8b6f Caffe\uff1a<\/p>\n<pre><code>make all\nmake test\nmake runtest<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-tensorflow-gpu-gHhfqGMKbC\">\u5b89\u88dd TensorFlow-GPU<\/h2>\n<p>\u5b89\u88dd TensorFlow-GPU \u9700\u8981\u4f7f\u7528 pip\u3002\u9996\u5148\uff0c\u78ba\u4fdd\u60a8\u5df2\u7d93\u5b89\u88dd\u4e86 pip\uff1a<\/p>\n<pre><code>sudo apt-get install python-pip<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88dd TensorFlow-GPU\uff1a<\/p>\n<pre><code>pip install tensorflow-gpu==1.12.0<\/code><\/pre>\n<h2 id=\"%e5%ae%89%e8%a3%9d-pycharm-gHhfqGMKbC\">\u5b89\u88dd Pycharm<\/h2>\n<p>\u6700\u5f8c\uff0c\u6211\u5011\u4f86\u5b89\u88dd Pycharm\u3002\u60a8\u53ef\u4ee5\u5f9e JetBrains \u7684\u5b98\u65b9\u7db2\u7ad9\u4e0b\u8f09 Pycharm \u7684\u5b89\u88dd\u5305\u3002\u4e0b\u8f09\u5b8c\u6210\u5f8c\uff0c\u89e3\u58d3\u4e26\u904b\u884c\uff1a<\/p>\n<pre><code>tar -xzf pycharm-*.tar.gz\ncd pycharm-*\/bin\n.\/pycharm.sh<\/code><\/pre>\n<h2 id=\"%e7%b8%bd%e7%b5%90-gHhfqGMKbC\">\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\u3001Caffe\u3001TensorFlow-GPU \u548c Pycharm\u3002\u9019\u4e9b\u5de5\u5177\u5c07\u70ba\u60a8\u7684\u6df1\u5ea6\u5b78\u7fd2\u9805\u76ee\u63d0\u4f9b\u5f37\u5927\u7684\u652f\u6301\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u8a08\u7b97\u8cc7\u6e90\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u4f86\u904b\u884c\u60a8\u7684\u6df1\u5ea6\u5b78\u7fd2\u6a21\u578b\uff0c\u9019\u6a23\u80fd\u5920\u7372\u5f97\u66f4\u597d\u7684\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to install CUDA 8.0, Caffe, TensorFlow-GPU, and PyCharm on Ubuntu 16.04 with this simple step-by-step guide.<\/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-51463","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51463","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=51463"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51463\/revisions"}],"predecessor-version":[{"id":51464,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/51463\/revisions\/51464"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=51463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=51463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=51463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}