{"id":235625,"date":"2022-02-20T09:03:30","date_gmt":"2022-02-20T01:03:30","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=235625"},"modified":"2022-02-15T13:25:11","modified_gmt":"2022-02-15T05:25:11","slug":"ubuntu-setup-cuda","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-setup-cuda.html","title":{"rendered":"\u5206\u4eab\u5982\u4f55\u5728Ubuntu 16.04\u4e0bCUDA8.0"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5206\u4eab\u4e00\u7bc7\u5728Ubuntu 16.04\u4e0bCUDA8.0\u7684\u5b89\u88c5\u8fc7\u7a0b\u7684\u8bb0\u5f55\u7b14\u8bb0\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
1.\u5b89\u88c5\u9a71\u52a8<\/strong><\/div>\n

\u6700\u7b80\u5355\u7684\u5b89\u88c5\u65b9\u5f0f\u662f\u76f4\u63a5\u5728\u201c\u7cfb\u7edf\u8bbe\u7f6e->\u8f6f\u4ef6\u548c\u66f4\u65b0->\u9644\u52a0\u9a71\u52a8\u201d\u4e2d\u5b89\u88c5<\/p>\n

\"\"
\n\"\"<\/p>\n

\u8fd9\u6837\u7684\u8bdd\uff0c\u9a71\u52a8\u5c31\u6309\u88c5\u597d\u4e86\u3002<\/p>\n

\u5728terminal\u91cc\u9762\u8f93\u5165\u547d\u4ee4nvidia-smi\uff0c\u770b\u5230\u5982\u4e0b\u7684\u8f93\u51fa\uff0c\u5c31\u662f\u6b63\u786e\u4e86\u3002<\/p>\n

\"\"<\/p>\n

2.\u4e0b\u8f7dCuda<\/strong><\/div>\n

\u9996\u5148\u5728\u5b98\u7f51\u4e0b\u8f7dCUDA8.0\u3002<\/p>\n

\"\"<\/p>\n

\u5efa\u8bae\u4e0b\u8f7drunfile\u7684\u6587\u4ef6\u3002<\/p>\n

<\/strong><\/div>\n

3.\u5b89\u88c5cuda8.0<\/p>\n

\u6253\u5f00terminal\uff0c\u8fdb\u5165cuda\u6240\u5728\u7684\u4e0b\u8f7d\u6587\u4ef6\u5939\uff0c\u8f93\u5165<\/p>\n

sudo sh cuda_8.0.61_375.26_linux.run1<\/pre>\n

\u5982\u679c\u5b89\u88c5\u6210\u529f\uff0c\u6700\u7ec8\u4f1a\u51fa\u73b03\u4e2ainstalled\u3002\u4f46\u6211\u5b89\u88c5\u7684\u8fc7\u7a0b\u4e2d\uff0c\u51fa\u73b0\u4e86\u95ee\u9898\uff0c\u51fa\u73b0\u4e86\u4ee5\u4e0b\u7684\u9519\u8bef\u63d0\u793a\u3002<\/p>\n

It appears that an X server is running. Please exit X before installation.<\/pre>\n

\u8fd9\u4e2a\u65f6\u5019\u5c31\u4e0d\u80fd\u5b89\u88c5\u4e86\uff0c\u8981\u5173\u95edX server\u3002
\n\u76f4\u63a5\u6309ctrl+alt+F1\uff0c\u8fdb\u53bb\u4e00\u4e2a\u9ed1\u5c4f\u754c\u9762\uff0c\u63d0\u793a\u4f60\u8981Login\uff0c\u767b\u5f55\u3002\u9996\u5148\u8f93\u5165\u81ea\u5df1\u7684\u8d26\u6237\u540d\u79f0\u548c\u5bc6\u7801\u3002\u6210\u529f\u767b\u5f55\u540e\uff0c\u8f93\u5165<\/p>\n

sudo service lightdm stop1<\/pre>\n

\u8fd9\u65f6\u5019\u6309ctrl+alt+F7\u662f\u56de\u4e0d\u5230\u56fe\u5f62\u5316\u754c\u9762\u4e86\uff0c\u8bf4\u660e\u5df2\u7ecf\u5173\u95ed\u4e86X server\u3002
\n\u5c31\u53ef\u4ee5\u5f00\u59cb\u5b89\u88c5Cuda8.0\u4e86\u3002\u8ddf\u4e0a\u9762\u7684\u6b65\u9aa4\u4e00\u6837\uff0c<\/p>\n

sudo sh cuda_8.0.61_375.26_linux.run<\/pre>\n

\u9996\u5148\u4f1a\u51fa\u73b0\u4e00\u4e2a\u8bf4\u660e\u4e66\uff0c\u6309\u7a7a\u683c\u952e\u53ef\u4ee5\u5feb\u901f\u6d4f\u89c8\uff0c\u6216\u8005\u76f4\u63a5\u6309Q\u9000\u51fa\u3002
\n\u63a5\u4e0b\u6765\u7684\u6b65\u9aa4\u5982\u4e0b:
\n1\u3002accept
\n2\u3002graphics driver yes\/no <\/p>\n

\u8fd9\u91cc\u6211\u9009\u4e86yes\uff0c\u867d\u7136\u5b89\u88c5\u4e0a\u4e86\uff0c\u4f46\u662f\u540e\u9762\u4e5f\u9047\u5230\u95ee\u9898\u4e86\u3002\u5982\u679c\u9009\u4e86yes\uff0c\u5b89\u88c5\u597dcuda8.0\u540e\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u91cd\u542f\u4e4b\u540e\uff0c\u8fdb\u5165ubuntu\u65f6\u5019\uff0c\u8f93\u5165\u5bc6\u7801\u767b\u5f55\u4e0d\u4e86\uff0c\u4e00\u76f4\u5728\u767b\u5f55\u754c\u9762\u3002\u8fd9\u662f\u56e0\u4e3a\u9a71\u52a8\u95ee\u9898\u3002\u8fdb\u5165ctrl+alt+F1\uff0c\u8f93\u5165<\/p>\n

sudo apt-get remove --purge nvidia*\r\nsudo service lightdm start123<\/pre>\n

\u518d\u91cd\u542f\uff0c\u91cd\u65b0\u8fdb\u7cfb\u7edf\u8bbe\u7f6e\u5b89\u88c5\u66f4\u65b0\uff0c\u91cd\u542f\u5373\u53ef\u3002
\n\u67e5\u4e86\u4e0b\uff0c\u4e0d\u5b89\u88c5\u9a71\u52a8\u4e5f\u884c\uff0c\u56e0\u4e3a\u7b2c\u4e00\u6b65\u5df2\u7ecf\u5b89\u88c5\u597d\u4e86\u9a71\u52a8\u3002\u53ef\u4ee5\u76f4\u63a5\u9009no<\/p>\n

opengl lib \u8fd9\u91cc\u9009no
\n\u5176\u4ed6\u90fd\u9009yes\u6216\u8005enter\u3002
\n\u6700\u540e\u5b89\u88c5\u6210\u529f\u4f1a\u51fa\u73b03\u4e2ainstalled\u3002\u5982\u679c\u7b2c\u4e00\u6b65\u5b89\u88c5\u9a71\u52a8\u65f6\u9009\u4e86no\uff0c\u6700\u540e\u53ea\u6709\u4e24\u4e2ainstalled\uff0c\u4f46\u6ca1\u6709\u5f71\u54cd\u3002<\/p>\n

3.\u4fee\u6539\u914d\u7f6e<\/p>\n

sudo geit ~\/.bashrc<\/pre>\n

\u5728\u6587\u4ef6\u6700\u540e\u6dfb\u52a0<\/p>\n

export PATH=\/usr\/local\/cuda-8.0\/bin:$PATH
\nexport LD_LIBRARY_PATH=\/usr\/local\/cuda-8.0\/lib64:$LD_LIBRARY_PATH12<\/p>\n

\u4fdd\u5b58\u597d\u4e4b\u540e\uff0c\u8f93\u5165<\/p>\n

source .bashrc1<\/pre>\n

4.\u68c0\u67e5\u662f\u5426\u5b89\u88c5\u6210\u529f<\/p>\n

\u8f93\u5165<\/p>\n

nvcc -V1<\/pre>\n

\"\"<\/p>\n

Sample\u6d4b\u8bd5\uff1a<\/p>\n

cd \/usr\/local\/cuda\/samples\r\ncd 1_Utilities\/deviceQuery\r\nmake\r\n.\/deviceQuery1234<\/pre>\n

\u5982\u679c\u6700\u540e\u51fa\u73b0\u4e86pass\uff0c\u5373\u5b89\u88c5\u6210\u529f\u3002
\ncudnn\u8ddftensorflow\u7684\u5b89\u88c5\u90fd\u6bd4\u8f83\u7b80\u5355\uff0c\u67e5\u5230\u7684\u65b9\u6cd5\u57fa\u672c\u4e00\u81f4\uff0c\u4e0d\u9700\u8981\u8bb0\u5f55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u6700\u7b80\u5355\u7684\u5b89\u88c5\u65b9\u5f0f\u662f\u76f4\u63a5\u5728\u201c\u7cfb\u7edf\u8bbe\u7f6e->\u8f6f\u4ef6\u548c\u66f4\u65b0->\u9644\u52a0\u9a71\u52a8\u201d\u4e2d\u5b89\u88c5 \u8fd9\u6837\u7684\u8bdd\uff0c\u9a71\u52a8\u5c31\u6309\u88c5\u597d\u4e86\u3002 \u5728termi […]<\/p>\n","protected":false},"author":310,"featured_media":235638,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-235625","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/235625","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/310"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=235625"}],"version-history":[{"count":9,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/235625\/revisions"}],"predecessor-version":[{"id":235832,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/235625\/revisions\/235832"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/235638"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=235625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=235625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=235625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}