{"id":479,"date":"2020-12-26T15:47:46","date_gmt":"2020-12-26T07:47:46","guid":{"rendered":"https:\/\/www.wangliguang.cn\/?p=479"},"modified":"2020-12-26T15:47:46","modified_gmt":"2020-12-26T07:47:46","slug":"%e3%80%902021%e6%96%b0%e6%95%99%e7%a8%8b%e3%80%91tensorflow-gpu%e7%89%88%e6%9c%ac%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85%ef%bc%9fwin10%e5%a6%82%e4%bd%95%e5%ae%89%e8%a3%85tensorflow-gpu%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/wangliguang.cn\/?p=479","title":{"rendered":"\u30102021\u65b0\u6559\u7a0b\u3011tensorflow-gpu\u7248\u672c\u5982\u4f55\u5b89\u88c5\uff1fwin10\u5982\u4f55\u5b89\u88c5tensorflow-gpu\u7248\u672c\uff1f"},"content":{"rendered":"<h2>\u80cc\u666f<\/h2>\n<p>\u6700\u8fd1\u60f3\u7ed9\u7b14\u8bb0\u672c\u5b89\u88c5tensorflow-gpu\uff0c\u7136\u800c\u7f51\u4e0a\u7684\u6559\u7a0b\u90fd\u975e\u5e38\u8001\u65e7\uff0c\u5f88\u591a2018\u30012019\u5e74\u7684\u6587\u7ae0\u90fd\u6253\u7740\u6700\u65b0\u7684\u65d7\u53f7\uff0c\u63cf\u8ff0\u5341\u5206\u6df7\u4e71\u3002\u672c\u6559\u7a0b\u529b\u6c42\u7ed9\u51fa\u6700\u65b0\u53ef\u7528\u7684tensorflow-gpu\u5b89\u88c5\u6559\u7a0b\uff0c\u672c\u6587\u57fa\u4e8eWindows 10\u548ctensorflow2.3\u3002<\/p>\n<h2>\u672c\u6587\u53ef\u89e3\u51b3\u7684\u95ee\u9898<\/h2>\n<p>win10\u5982\u4f55\u5b89\u88c5tensorflow-gpu\u7248\u672c\uff1f<br \/>\ntensorflow-gpu\u7248\u672c\u5982\u4f55\u5b89\u88c5\uff1f<br \/>\ntensorflow2.3.0\u5982\u4f55\u5b89\u88c5\uff1f<br \/>\nMX450\u663e\u5361\u5982\u4f55\u5b89\u88c5tensorflow-gpu?<\/p>\n<h2>\u76ee\u6807<\/h2>\n<p>\u5b89\u88c5anaconda<br \/>\n\u5b89\u88c5cudatoolkit<br \/>\n\u5b89\u88c5cudnn<br \/>\n\u5b89\u88c5tensorflow2.3.0\uff0c\u63d0\u4f9bGPU\u652f\u6301\u3002<br \/>\n\u53ef\u6839\u636e\u9700\u8981\u9009\u62e9\u6027\u9605\u8bfb\u3002<\/p>\n<h2>0 \u51c6\u5907\u5de5\u4f5c<\/h2>\n<p><strong>1\u3001\u8981\u60f3\u6210\u529f\u5b89\u88c5tensorflow\u5e76\u63d0\u4f9bGPU\u652f\u6301\uff0c\u5fc5\u987b\u4fdd\u8bc1tensorflow\u3001cudatoolkit\u3001cudnn\u7248\u672c\u5bf9\u5e94\u3002\u672c\u6587\u63cf\u8ff0\u7684\u7248\u672c\u53ef\u4ee5\u4fdd\u8bc1\u5bf9\u5e94\uff0c\u5efa\u8bae\u6309\u7167\u672c\u6587\u5efa\u8bae\u5b89\u88c5\uff01<\/strong><br \/>\n2\u3001\u68c0\u67e5\u786c\u4ef6\u652f\u6301\u3002<br \/>\n\u70b9\u51fb\u5982\u56fe\u6240\u793a\u7684\u56fe\u6807\u6253\u5f00nvidia\u63a7\u5236\u9762\u677f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/2949556790.png\" alt=\"\u6253\u5f00nvidia\u63a7\u5236\u9762\u677f\" \/><br \/>\n\u7136\u540e\u70b9\u51fb\u7cfb\u7edf\u4fe1\u606f\uff0c\u67e5\u770b\u652f\u6301\u7684cuda\u7248\u672c\uff0c<strong>\u5982\u679c\u9ad8\u4e8e10.1\uff0c\u5219\u53ef\u7ee7\u7eed\u9605\u8bfb\u672c\u6587\u3002\u5982\u679c\u5c0f\u4e8e10.1\uff0c\u5219\u672c\u6587\u4e0d\u9002\u5408\u60a8\u7684\u673a\u5668\uff0c\u8bf7\u53c2\u8003\u5176\u4ed6\u8d44\u6599\u3002<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/879289861.png\" alt=\"\u67e5\u770b\u7cfb\u7edf\u4fe1\u606f\" \/><br \/>\n3\u3001\u68c0\u67e5\u8f6f\u4ef6\u652f\u6301\u3002\u7531\u4e8e\u6211\u4eec\u60f3\u8981\u5b89\u88c5tensorflow2.3\uff0c\u4ece\u5b98\u7f51\u5f97\u77e5\uff0ctensorflow2.3\u9700\u8981cuda 10.1\uff0ccudnn7.6\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u63d0\u524d\u4e0b\u8f7d\u4e0b\u8fd9\u4e9b\u7248\u672c\u7684\u8f6f\u4ef6\u3002\u5b98\u7f51\u7ed9\u51fa\u7684\u8f6f\u4ef6\u8981\u6c42\u5982\u56fe\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u5c06\u4e00\u4e00\u89e3\u51b3\u8f6f\u4ef6\u95ee\u9898\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/2830685195.png\" alt=\"\u8f6f\u4ef6\u8981\u6c42\" \/><\/p>\n<h2>\u4e00\u3001\u5b89\u88c5anaconda<\/h2>\n<p>\u8bf7<a href=\"https:\/\/liguang.wang\/index.php\/archives\/37\/\">\u70b9\u51fb\u9605\u8bfb\u672c\u6587\u7ae0\u2014\u2014anaconda\u5b89\u88c5\u6307\u5bfc\uff08\u4f7f\u7528\u56fd\u5185\u6e90\u52a0\u901f\uff09<\/a><\/p>\n<h2>\u4e8c\u3001\u5b89\u88c5cudatoolkit 10.1<\/h2>\n<p>1\u3001\u8bbf\u95eehttps:\/\/developer.nvidia.com\/cuda-toolkit-archive\uff0c\u4e0b\u8f7dcudatoolkit 10.1\u3002\u8bf7\u70b9\u51fb\u56fe\u7247\u6240\u793a\u7684\u4f4d\u7f6e\u8fdb\u884c\u4e0b\u8f7d\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/1425670715.png\" alt=\"\u4e0b\u8f7dcudatoolkit\" \/><br \/>\n2\u3001\u53cc\u51fb\u4e0b\u8f7d\u597d\u7684\u6587\u4ef6\uff0c\u4f1a\u63d0\u793a\u9009\u62e9\u76ee\u5f55\u91ca\u653e\u4e34\u65f6\u6587\u4ef6\uff0c\u76f4\u63a5\u70b9\u51fb\u4e0b\u4e00\u6b65\u5373\u53ef\u3002<br \/>\n3\u3001\u7136\u540e\u8fdb\u884c\u517c\u5bb9\u6027\u68c0\u67e5\uff0c\u8fdb\u884c\u517c\u5bb9\u6027\u68c0\u67e5\u5b8c\u6210\u540e\uff0c\u4f1a\u8ba9\u4f60\u9009\u62e9\u5b89\u88c5\u65b9\u5f0f\uff0c\u6211\u4eec\u6b64\u5904\u9009\u62e9\u81ea\u5b9a\u4e49\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/1126617486.png\" alt=\"\u9009\u62e9\u5b89\u88c5\u65b9\u5f0f\" \/><br \/>\n4\u3001\u7136\u540e\u4f1a\u8ba9\u6211\u4eec\u9009\u62e9\u60f3\u8981\u5b89\u88c5\u7684\u5185\u5bb9\u3002\u6309\u56fe\u7247\u6240\u793a\u5c55\u5f00\u540e\u4e24\u9879\uff0c\u8fd9\u91cc\u65b0\u7248\u672c\u6307\u5c06\u8981\u5b89\u88c5\u7684\u7248\u672c\uff0c\u5f53\u524d\u7248\u672c\u662f\u6307\u673a\u5668\u4e0a\u5df2\u7ecf\u6709\u7684\u7248\u672c\u3002\u5982\u679c<strong>\u65b0\u7248\u672c\u6bd4\u5f53\u524d\u7248\u672c\u65b0\uff0c\u5c31\u5b89\u88c5<\/strong>\uff0c<strong>\u5426\u5219\u5c31\u628a\u5bf9\u52fe\u7ed9\u53bb\u6389\uff0c\u4fdd\u7559\u5f53\u524d\u7248\u672c\u3002<\/strong>\u8fd9\u91cc\u6211\u7684\u5f53\u524d\u7248\u672c\u6bd4\u65b0\u7248\u672c\u66f4\u65b0\uff0c\u6240\u4ee5\u6211\u4eec\u628a\u5bf9\u52fe\u53bb\u6389\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/581645529.png\" alt=\"\u9009\u62e9\u5b89\u88c5\u5185\u5bb9\" \/><br \/>\n5\u3001\u4e00\u76f4\u4e0b\u4e00\u6b65\uff0c\u7b49\u5f85\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n<h2>\u4e09\u3001\u5b89\u88c5cudnn 7.6.5<\/h2>\n<p>1\u3001\u4e0b\u8f7dcudnn 7.6.5\u3002\u6309\u56fe\u7247\u6240\u793a\u64cd\u4f5c\u5373\u53ef\u3002<strong>\u6ce8\u610f\uff0c\u53ef\u80fd\u4f1a\u8981\u6c42\u9700\u8981\u6ce8\u518c\u8d26\u53f7\u3002<\/strong><br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/1668470422.png\" alt=\"cudnn\u6b65\u9aa4\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/3295521473.png\" alt=\"cudnn\u6b65\u9aa4\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/3957357041.png\" alt=\"cudnn\u6b65\u9aa4\" \/><br \/>\n<img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/342126065.png\" alt=\"cudnn\u6b65\u9aa4\" \/><br \/>\n2\u3001\u5c06\u4e0b\u8f7d\u4e0b\u6765\u7684\u5305\u89e3\u538b\uff0c\u7136\u540e\u5c06\u4e0b\u8868\u4e2d\u7684\u6587\u4ef6\u653e\u5230C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\u76f8\u5e94\u76ee\u5f55\u4e0b\u3002\u5bf9\u5e94\u5173\u7cfb\u5982\u4e0b\u8868\u6240\u793a\u3002<strong>\u6ce8\u610f\uff0c\u662f\u628a\u6587\u4ef6\u653e\u5230\u76f8\u5e94\u76ee\u5f55\u4e0b\uff0c\u4e0d\u662f\u76f4\u63a5\u66ff\u6362\u76ee\u5f55\uff01\u4e0d\u662f\u76f4\u63a5\u66ff\u6362\u76ee\u5f55\uff01\u4e0d\u662f\u76f4\u63a5\u66ff\u6362\u76ee\u5f55\uff01\u8bf7\u4e25\u683c\u6309\u4e0b\u8868\u64cd\u4f5c\uff01<\/strong><\/p>\n<table>\n<thead>\n<tr>\n<th>\u89e3\u538b\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6<\/th>\n<th>\u8981\u653e\u5230\u7684\u4f4d\u7f6e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>bin\\cudnn64_7.dll\u6587\u4ef6<\/td>\n<td>C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\bin\u4e0b\u9762<\/td>\n<\/tr>\n<tr>\n<td>include\\cudnn.h\u6587\u4ef6<\/td>\n<td>C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\include\u4e0b\u9762<\/td>\n<\/tr>\n<tr>\n<td>lib\\x64\\cudnn.lib\u6587\u4ef6<\/td>\n<td>C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v10.1\\lib\\x64\u4e0b\u9762<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>\u56db\u3001\u5b89\u88c5tensorflow 2.3<\/h2>\n<p>1\u3001\u5207\u6362opentuna\u7684pip\u955c\u50cf\u6e90\u3002\uff08\u4e3a\u4e86\u52a0\u901f\uff09<\/p>\n<pre><code>pip config set global.index-url https:\/\/opentuna.cn\/pypi\/web\/simple<\/code><\/pre>\n<p>2\u3001\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n<pre><code>conda create -n tensorflow2 python=3.7<\/code><\/pre>\n<p>3\u3001\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u3002<\/p>\n<pre><code>conda activate tensorflow2<\/code><\/pre>\n<p>4\u3001\u5b89\u88c5tensorflow2.3\u3002\u6211\u4eec\u4f7f\u7528pip\u6765\u5b89\u88c5\uff0cpip\u5b89\u88c5\u540e\u81ea\u5e26gpu\u652f\u6301\uff0c\u4e0d\u9700\u8981\u989d\u5916\u5b89\u88c5gpu\u7248\u672c\u3002<strong>\u6211\u4eec\u6b64\u5904\u4f7f\u7528pip\u800c\u4e0d\u91c7\u7528conda\uff0c\u662f\u56e0\u4e3aconda\u4e2d\u7248\u672c\u53ef\u80fd\u8f83\u65e7\u800c\u4e14\u4f5c\u8005\u4f7f\u7528conda\u540e\u5b89\u88c5\u5931\u8d25\u3002\u5982\u6b64\u5904\u81ea\u884c\u4f7f\u7528conda\u540e\u5b89\u88c5\u5931\u8d25\u5e76\u4e0d\u8868\u793a\u672c\u6559\u7a0b\u6709\u95ee\u9898\uff01\u7279\u6b64\u63d0\u524d\u8bf4\u660e\uff01\u5f3a\u70c8\u5efa\u8bae\u60a8\u5728\u6b64\u5904\u6839\u636e\u4f5c\u8005\u5efa\u8bae\u4f7f\u7528pip\uff01<\/strong><\/p>\n<pre><code>pip install tensorflow==2.3<\/code><\/pre>\n<p>5\u3001\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\u3002\u8f93\u5165\u4ee5\u4e0b\u8bed\u53e5\uff0c\u5982\u679c\u5982\u56fe\u6240\u793a\u8f93\u51fa\u4e86\u81ea\u5df1\u7684GPU\uff0c\u5219\u8868\u793a\u5b89\u88c5\u6210\u529f\uff01\u5426\u5219\u5b89\u88c5\u5931\u8d25\uff0c\u8bf7\u68c0\u67e5\u6b65\u9aa4\u540e\u91cd\u8bd5\u6216\u5411\u4f5c\u8005\u63d0\u95ee\u3002<\/p>\n<pre><code>python\nimport tensorflow as tf\ntf.config.list_physical_devices(&amp;#039;GPU&amp;#039;)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/liguang.wang\/usr\/uploads\/2020\/12\/1234254993.png\" alt=\"\u5b89\u88c5\u6210\u529f\" \/><\/p>\n<h2>\u652f\u6301\u4f5c\u8005\u548c\u7591\u95ee\u89e3\u7b54<\/h2>\n<p>\u672c\u6587\u9996\u53d1\u4e8e<a href=\"https:\/\/liguang.wang\">\u6211\u7684\u5b66\u4e60\u4e4b\u8def\uff08liguang.wang\uff09<\/a>\uff0c\u6b22\u8fce\u8bbf\u95ee\uff01<br \/>\n\u5199\u6587\u7ae0\u4e0d\u6613\uff0c\u5982\u679c\u8fd9\u7bc7\u6587\u7ae0\u6709\u5e2e\u5230\u4f60\uff0c\u5e0c\u671b\u4f60\u80fd\u7ed9\u4e88\u4e00\u5b9a\u8d5e\u8d4f\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u5f53\u524d\u7f51\u7ad9\u6216App\u7684\u8d5e\u8d4f\u6e20\u9053\u652f\u6301\uff0c\u6216\u8005<a href=\"https:\/\/www.wangliguang.cn\/?page_id=25\" title=\"\u70b9\u51fb\u6b64\u5904\u652f\u6301\u4f5c\u8005\">\u70b9\u51fb\u6b64\u5904\u652f\u6301\u4f5c\u8005<\/a>\uff01<br \/>\n\u5982\u679c\u5bf9\u4e8e\u672c\u6587\u5185\u5bb9\u6709\u7591\u95ee\uff0c\u53ef\u4ee5<a href=\"https:\/\/liguang.wang\/index.php\/about-author.html\" title=\"\u70b9\u51fb\u6b64\u5904\u8054\u7cfb\u4f5c\u8005\">\u70b9\u51fb\u6b64\u5904\u8054\u7cfb\u4f5c\u8005<\/a>\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u6700\u8fd1\u60f3\u7ed9\u7b14\u8bb0\u672c\u5b89\u88c5tensorflow-gpu\uff0c\u7136\u800c\u7f51\u4e0a\u7684\u6559\u7a0b\u90fd\u975e\u5e38\u8001\u65e7\uff0c\u5f88\u591a2018\u30012019\u5e74\u7684\u6587\u7ae0&hellip; <a href=\"https:\/\/wangliguang.cn\/?p=479\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u30102021\u65b0\u6559\u7a0b\u3011tensorflow-gpu\u7248\u672c\u5982\u4f55\u5b89\u88c5\uff1fwin10\u5982\u4f55\u5b89\u88c5tensorflow-gpu\u7248\u672c\uff1f<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,15,19],"tags":[],"class_list":["post-479","post","type-post","status-publish","format-standard","hentry","category-python","category-15","category-19"],"_links":{"self":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/479","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=479"}],"version-history":[{"count":0,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=\/wp\/v2\/posts\/479\/revisions"}],"wp:attachment":[{"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=479"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=479"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wangliguang.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=479"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}