{"id":21760,"date":"2021-12-12T17:36:11","date_gmt":"2021-12-12T09:36:11","guid":{"rendered":"https:\/\/aqzt.com\/21760.html"},"modified":"2021-12-12T17:36:11","modified_gmt":"2021-12-12T09:36:11","slug":"%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e7%bc%96%e7%a8%8b%e7%8e%af%e5%a2%83%e6%a6%82%e5%bf%b5%ef%bc%88gpu-tensorflow-docker-cuda-cpu-cudnn-keras-anaconda-pytorch%e4%bb%8b%e7%bb%8d%ef%bc%89","status":"publish","type":"post","link":"https:\/\/aqzt.com\/21760.html","title":{"rendered":"\u6df1\u5ea6\u5b66\u4e60\u7f16\u7a0b\u73af\u5883\u6982\u5ff5\uff08GPU, Tensorflow, Docker, CUDA, CPU, CUDNN, Keras, Anaconda, PyTorch\u4ecb\u7ecd\uff09"},"content":{"rendered":"<h1>\u7b80\u4ecb<\/h1>\n<p>\u5728\u6df1\u5ea6\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u7ecf\u5e38\u4f1a\u9047\u5230GPU, Tensorflow, Docker, CUDA, CPU, CUDNN, Keras, Anaconda, PyTorch\u7b49\u540d\u6b21\u6982\u5ff5\uff0c\u4e5f\u4e00\u76f4\u7406\u4e0d\u6e05\u8fd9\u4e9b\u7f16\u7a0b\u73af\u5883\u7684\u5c42\u6b21\uff0c\u6240\u4ee5\u505a\u4e00\u4e2a\u603b\u7ed3<\/p>\n<\/p>\n<h1>\u603b\u89c8<\/h1>\n<p><img decoding=\"async\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/20220211013239-66.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n<!-- -->\u8d8a\u5f80\u4e0b\u8d8a\u5e95\u5c42<\/p>\n<h3>\u89e3\u91ca<\/h3>\n<h3>CPU<\/h3>\n<p>\u4e2d\u592e\u5904\u7406\u5668\uff08CPU\uff0ccentral processing unit\uff09\u4f5c\u4e3a\u8ba1\u7b97\u673a\u7cfb\u7edf\u7684\u8fd0\u7b97\u548c\u63a7\u5236\u6838\u5fc3\uff0c\u662f\u4fe1\u606f\u5904\u7406\u3001\u7a0b\u5e8f\u8fd0\u884c\u7684\u6700\u7ec8\u6267\u884c\u5355\u5143\u3002<\/p>\n<h3>GPU<\/h3>\n<p>\u56fe\u5f62\u5904\u7406\u5668\uff08\u82f1\u8bed\uff1aGraphics Processing Unit\uff0c\u7f29\u5199\uff1aGPU\uff09\u3002GPU\u4f7f\u663e\u5361\u51cf\u5c11\u4e86\u5bf9CPU\u7684\u4f9d\u8d56\uff0c\u5e76\u8fdb\u884c\u90e8\u5206\u539f\u672cCPU\u7684\u5de5\u4f5c<\/p>\n<h3>OS<\/h3>\n<p>\u64cd\u4f5c\u7cfb\u7edf\uff08Operating System)\u662f\u7ba1\u7406\u8ba1\u7b97\u673a\u786c\u4ef6\u4e0e\u8f6f\u4ef6\u8d44\u6e90\u7684\u8ba1\u7b97\u673a\u7a0b\u5e8f\uff0c\u540c\u65f6\u4e5f\u662f\u8ba1\u7b97\u673a\u7cfb\u7edf\u7684\u5185\u6838\u4e0e\u57fa\u77f3\u3002<\/p>\n<h3>CUDA<\/h3>\n<p>\u5168\u79f0Compute Unified Device Architecture\uff0c\u662f\u4e00\u4e2a\u5e76\u884c\u8ba1\u7b97\u5e73\u53f0\uff0c\u540c\u65f6\u4e5f\u662f\u4e00\u4e2aAPI\u6a21\u578b\uff0c\u652f\u6301C\uff0cC++\u548cFortarn\u3002CUDA\u5b9a\u4e49\u4e86GPU\u7684\u865a\u62df\u6307\u4ee4\u96c6\uff0c\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u76f4\u63a5\u63a7\u5236GPU\u7684\u5e76\u884c\u8ba1\u7b97\u5355\u5143\uff0c\u7f16\u5199\u9ad8\u6548\u7684\u5e76\u884c\u7a0b\u5e8f\u3002<\/p>\n<h3>cuDNN<\/h3>\n<p>\u5168\u79f0CUDA Deep Neural Network library\uff0c\u57fa\u4e8eCUDA\u63d0\u4f9b\u9ad8\u5ea6\u8c03\u4f18\u7684\u795e\u7ecf\u7f51\u7edc\u5e95\u5c42\u5b9e\u73b0\uff0c\u4f8b\u5982\u5377\u79ef\u3001\u6c60\u5316\u3001\u5f52\u4e00\u5316\u548c\u6fc0\u6d3b\u51fd\u6570\u3002\u652f\u6301TensorFlow\u548cPyTorch\u7b49\u591a\u79cd\u6846\u67b6\u3002<\/p>\n<p><strong>\u7b80\u5355\u6765\u8bf4\uff0cCPU\u9002\u5408\u4e32\u884c\u8ba1\u7b97\uff0c\u64c5\u957f\u903b\u8f91\u63a7\u5236\u3002GPU\u64c5\u957f\u5e76\u884c\u9ad8\u5f3a\u5ea6\u5e76\u884c\u8ba1\u7b97\uff0c\u9002\u7528\u4e8eAI\u7b97\u6cd5\u7684\u8bad\u7ec3\u5b66\u4e60<br \/>\n<!-- -->CUDA \u662fNVIDIA\u4e13\u95e8\u8d1f\u8d23\u7ba1\u7406\u5206\u914d\u8fd0\u7b97\u5355\u5143\u7684\u6846\u67b6<br \/>\n<!-- -->cuDNN\u662f\u7528\u4e8e\u6df1\u5c42\u795e\u7ecf\u7f51\u7edc\u7684gpu\u52a0\u901f\u5e93<\/strong><\/p>\n<h1>conda<\/h1>\n<p>Conda\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u8f6f\u4ef6\u5305\u7ba1\u7406\u7cfb\u7edf\u548c\u73af\u5883\u7ba1\u7406\u7cfb\u7edf\uff0c\u7528\u4e8e\u5b89\u88c5\u591a\u4e2a\u7248\u672c\u7684\u8f6f\u4ef6\u5305\u53ca\u5176\u4f9d\u8d56\u5173\u7cfb\uff0c\u5e76\u5728\u5b83\u4eec\u4e4b\u95f4\u8f7b\u677e\u5207\u6362\uff1b<br \/>\n<!-- -->\u2022 Conda \u662f\u4e3a Python \u7a0b\u5e8f\u521b\u5efa\u7684\uff0c\u7528\u4e8e\u7ba1\u7406\u7248\u672c\u548cPython\u73af\u5883\uff1b<br \/>\n<!-- -->\u2022 \u76ee\u524d\u4e3b\u6d41\u7684Conda\u8f6f\u4ef6\u662f\uff1aAnaconda \u548cMiniconda\uff1b<br \/>\n<!-- -->\u2022 Conda\u7684\u4e24\u4e2a\u91cd\u8981\u529f\u80fd\uff1a(1)\u73af\u5883\u7ba1\u7406 (2)Python\u5305\u7ba1\u7406\uff1b<\/p>\n<h3>anaconda\u4e0eminiconda<\/h3>\n<p>Anaconda \u662f \u4e00 \u4e2a \u5f00 \u6e90 \u7684Python\u53d1\u884c\u7248\u672c\uff0c\u5176\u5305\u542b\u4e86Conda \u3001 Python \u3001 Numpy \u3001Pandas\u7b49180\u591a\u4e2a\u79d1\u5b66\u5305\u53ca\u5176\u4f9d\u8d56\u9879\u3002<br \/>\n<!-- -->Miniconda \u662f Anaconda \u7684\u8f7b\u91cf\u7ea7\u66ff\u4ee3\uff0c\u9ed8\u8ba4\u53ea\u5305\u542b\u4e86Python \u548c Conda\uff0c\u4f46\u662f\u53ef\u4ee5\u901a\u8fc7 Pip \u548c Conda \u6307\u4ee4\u6765\u5b89\u88c5\u6240\u9700\u8981\u7684\u5305\u3002<br \/>\n<strong>\u5c31\u662f\u8bf4miniconda\u662f\u7b80\u7ea6\u578banaconda<\/strong><\/p>\n<h3>conda\u529f\u80fd<\/h3>\n<p><strong>\u91cd\u8981\u529f\u80fd\u4e00\uff1a\u73af\u5883\u7ba1\u7406<\/strong><br \/>\n<!-- -->\u2013 \u521b\u5efa\u73af\u5883\uff1aconda create \u2026<br \/>\n<!-- -->\u2013 \u6fc0\u6d3b\u73af\u5883\uff1aactivate \u2026<br \/>\n<!-- -->\u2013 \u8fd4\u56de\u4e3b\u73af\u5883\uff1adeactivate \u2026<br \/>\n<!-- -->\u2013 \u5220\u9664\u73af\u5883\uff1aconda remove \u2026<br \/>\n<!-- -->\u2013 \u67e5\u770b\u7cfb\u7edf\u4e2d\u7684\u6240\u6709\u73af\u5883\uff1aconda info \u2013e<\/p>\n<p><strong>\u91cd\u8981\u529f\u80fd\u4e8c\uff1a\u5305\u7ba1\u7406<\/strong><br \/>\n<!-- -->\u2013 \u5b89\u88c5\u5e93\uff1aconda install \u2026<br \/>\n<!-- -->\u2013 \u67e5\u770b\u5df2\u7ecf\u5b89\u88c5\u7684\u5e93\uff1aconda list<br \/>\n<!-- -->\u2013 \u67e5 \u770b \u67d0 \u4e2a \u73af \u5883 \u7684 \u5df2 \u5b89 \u88c5 \u5305 \uff1aconda list \u2013n\u2026<br \/>\n<!-- -->\u2013 \u641c \u7d22 package \u7684 \u4fe1 \u606f \uff1a conda search \u2026<\/p>\n<h3>conda\u548cpip<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/20220211013240-9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><br \/>\n<!-- -->\u603b\u4e4b\uff0c\u5efa\u8bae\u5c06Conda \u4e0ePip \u7ed3\u5408\u8d77\u6765\u4ee5\u521b\u5efa\u6570\u636e\u79d1\u5b66\u73af\u5883<\/p>\n<h1>docker<\/h1>\n<h3>\u5bb9\u5668<\/h3>\n<p>\u4f20\u7edf\u7684\u865a\u62df\u5316\u65b9\u5f0f(\u865a\u62df\u673a)\u5360\u7528\u8d44\u6e90\u591a\u3001\u542f\u52a8\u65f6\u95f4\u957f\u3002\u9488\u5bf9\u8fd9\u4e2a\u95ee\u9898Linux\u4e2d\u53d1\u5c55\u51fa\u4e86\u8f7b\u91cf\u7ea7\u865a\u62df\u5316\u6280\u672f\u2014\u2014Linux\u5bb9\u5668\uff08Linux Container\uff0c LXC\uff09\u3002LXC\u4e0d\u6a21\u62df\u5b8c\u6574\u7684\u7269\u7406\u673a\u7cfb\u7edf\uff0c\u800c\u662f\u901a\u8fc7\u5bf9\u8fdb\u7a0b\u9694\u79bb\u5b9e\u73b0\u865a\u62df\u5316\u3002<\/p>\n<h3>Docker<\/h3>\n<p>Docker\u662fLinux\u5bb9\u5668\u7684\u4e00\u79cd\u5c01\u88c5\u3002Docker\u5c06\u5e94\u7528\u7a0b\u5e8f\u548c\u9700\u8981\u7684\u6240\u6709\u4f9d\u8d56\u6253\u5305\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc\uff08\u955c\u50cf\uff09\u3002Docker\u52a0\u8f7d\u955c\u50cf\u53ef\u4ee5\u521b\u5efaContainer\uff08\u955c\u50cf\u7684\u5b9e\u4f8b\uff09\uff0c\u8fd0\u884cContainer\u540e\uff0c\u53ef\u4ee5\u63d0\u4f9b\u540c\u6837\u7684\u5e94\u7528\u4f53\u9a8c\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/20220211013241-57.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h1>TensorFlow<\/h1>\n<p><strong>\u4e00\u4e2a\u7aef\u5230\u7aef\u7684\u5f00\u6e90\u673a\u5668\u5b66\u4e60\u5e73\u53f0<\/strong><br \/>\n<strong>\u7aef\u5230\u7aef<\/strong>\uff1a\u8be5\u6846\u67b6\u53ef\u4ee5\u5b8c\u6210\u673a\u5668\u5b66\u4e60\u6a21\u578b\u7684\u5168\u90e8\u6d41\u7a0b\uff0c\u4f7f\u5f97\u8bad\u7ec3\u65f6\u53ef\u4ee5\u540c\u65f6\u4f18\u5316\u6574\u4e2a\u6a21\u578b \u3002<br \/>\n<strong>Tensor<\/strong>\uff08\u5f20\u91cf\uff09\u610f\u5473\u7740N\u7ef4\u6570\u7ec4\uff0cFlow\uff08\u6d41\uff09\u610f\u5473\u7740\u57fa\u4e8e\u6570\u636e\u6d41\u56fe\u7684\u8ba1\u7b97\u3002\u5b83\u53ef\u770b\u4f5c\u4e00\u4e2a\u81ea\u52a8\u6c42\u5bfc\u5de5\u5177\uff0c\u5728\u6b64\u57fa\u7840\u4e0a\u8be5\u5e73\u53f0\u5b9e\u73b0\u4e86\u8bb8\u591a\u6df1\u5ea6\u5b66\u4e60\u7684\u57fa\u672c\u51fd\u6570\u548c\u6a21\u578b\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/20220211013242-79.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h1>Keras<\/h1>\n<p>\u4e00\u4e2a\u9ad8\u5c42\u7684\u795e\u7ecf\u7f51\u7edcAPI\uff0c\u7528python\u5b9e\u73b0\u5e76\u4e14\u80fd\u5728TensorFlow\u3001CNTK\u6216\u8005Theano\u6846\u67b6\u4e0a\u8fd0\u884c\u3002 Keras \u7684\u5f00\u53d1\u91cd\u70b9\u662f\u652f\u6301\u5feb\u901f\u7684\u6df1\u5ea6\u5b66\u4e60\u5b9e\u9a8c\u3002<\/p>\n<p><em>\u9700\u8981\u6ce8\u610fKeras 2.2.5. \u4ee5\u540e\u7684\u7248\u672c\u4ec5\u652f\u6301TensorFlow \uff0c\u5e76\u4e14\u88ab\u5c01\u88c5\u4e3aTensorFlow\u7684\u4e00\u4e2a\u6a21\u5757 tf.keras<\/em><\/p>\n<h1>pytorch<\/h1>\n<h3>\u7279\u70b9<\/h3>\n<p>\u2022 \u7b80\u6d01\uff1aPytorch\u7684\u8bbe\u8ba1\u8ffd\u6c42\u6700\u5c11\u7684\u5c01\u88c5\uff0c\u5c3d\u91cf\u907f\u514d\u91cd\u590d\u9020\u8f6e\u5b50\uff1b<br \/>\n<!-- -->\u2022 \u9ad8\u901f\uff1aPytorch\u7684\u7075\u6d3b\u6027\u4e0d\u4ee5\u901f\u5ea6\u4e3a\u5f85\u89c1\uff0c\u5728\u8bc4\u6d4b\u4e2d\u6709\u826f\u597d\u8868\u73b0\uff1b<br \/>\n<!-- -->\u2022 \u6613\u7528\uff1aPytorch\u7684\u8bbe\u8ba1\u9075\u5faa\u201c\u6240\u601d\u5373\u6240\u5f97\u201d\u7684\u7406\u5ff5\uff1b<br \/>\n<!-- -->\u2022 \u6269\u5c55\u6027\u597d\uff1aPytorch\u80fd\u65e0\u7f1d\u63a5\u5165 Python \u751f\u6001\u5708\uff1b<br \/>\n<!-- -->\u2022 \u6d3b\u8dc3\u7684\u793e\u533a\uff1aPytorch\u6709\u5b8c\u6574\u7684\u4f7f\u7528\u6587\u6863\uff0cFacebook\u4eba\u5de5\u667a\u80fd\u7814\u7a76\u9662\u5bf9Pytorch\u63d0\u4f9b\u4e86\u5f3a\u529b\u7684\u652f\u6301\u3002<br \/>\n<!-- -->Pytorch\u7684\u8bbe\u8ba1\u9075\u5faa\u201ctensor -&gt; variable(autograd) -&gt; nn.Module\u201d\u8fd9\u4e09\u4e2a\u7531\u4f4e\u5230\u9ad8\u7684\u62bd\u8c61\u5c42\u6b21\uff0c\u5206\u522b\u4ee3\u8868\u9ad8\u7ef4\u6570\u7ec4\uff08\u5f20\u91cf\uff09\uff0c\u81ea\u52a8\u6c42\u5bfc\uff08\u53d8\u91cf\uff09\u548c\u795e\u7ecf\u7f51\u7edc\uff08\u5c42\/\u6a21\u5757\uff09\uff1a<\/p>\n<p><em>\u2013 \u5f20\u91cf\uff08tensor\uff09\uff1a\u7c7b\u4f3c\u4e8eNumpy\u7684ndarray\uff0c\u53ef\u4ee5\u5728GPU\u4e0a\u4f7f\u7528\u6765\u52a0\u901f\u8ba1\u7b97\uff1b<br \/>\n<!-- -->\u2013 \u81ea\u52a8\u6c42\u5bfc\uff08 autograd \uff09\uff1a\u4e3a\u5f20\u91cf\u4e0a\u7684\u6240\u6709\u64cd\u4f5c\u63d0\u4f9b\u4e86\u81ea\u52a8\u6c42\u5bfc\u673a\u5236\uff0c\u5b83\u662f\u4e00\u4e2a\u5728\u8fd0\u884c\u65f6\u5b9a<br \/>\n<!-- -->\u4e49\uff08define-by-run\uff09\u7684\u6846\u67b6\uff1b<br \/>\n<!-- -->\u2013 \u795e\u7ecf\u7f51\u7edc\uff08nn.Module\uff09\uff1a\u4f9d\u8d56\u4e8eautograd\u5305\u6765\u5b9a\u4e49\u6a21\u578b\u5e76\u5bf9\u5b83\u4eec\u8fdb\u884c\u6c42\u5bfc\u3002<\/em><br \/>\n<img decoding=\"async\" src=\"https:\/\/aqzt.com\/wp-content\/uploads\/20220211013243-100.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7b80\u4ecb \u5728\u6df1\u5ea6\u5b66\u4e60\u8fc7\u7a0b\u4e2d\u7ecf\u5e38\u4f1a\u9047\u5230GPU, Tensorflow, Docker, CUDA, CPU, CUDNN, Keras, Anaconda, PyTorch\u7b49\u540d\u6b21\u6982\u5ff5\uff0c\u4e5f\u4e00\u76f4\u7406\u4e0d\u6e05\u8fd9\u4e9b\u7f16\u7a0b\u73af\u5883\u7684\u5c42\u6b21\uff0c\u6240\u4ee5\u505a\u4e00\u4e2a\u603b\u7ed3 \u603b\u89c8 \u8d8a\u5f80\u4e0b\u8d8a\u5e95\u5c42 \u89e3\u91ca CPU \u4e2d\u592e\u5904\u7406\u5668\uff08CPU\uff0ccentral processing unit\uff09\u4f5c\u4e3a\u8ba1\u7b97\u673a\u7cfb\u7edf\u7684\u8fd0\u7b97\u548c\u63a7\u5236\u6838\u5fc3\uff0c\u662f\u4fe1\u606f\u5904\u7406\u3001\u7a0b\u5e8f\u8fd0\u884c\u7684\u6700\u7ec8\u6267\u884c\u5355\u5143\u3002 GPU \u56fe\u5f62\u5904\u7406\u5668\uff08\u82f1\u8bed\uff1aGraphics Processing Unit\uff0c\u7f29\u5199\uff1aGPU\uff09\u3002GPU\u4f7f\u663e\u5361\u51cf\u5c11\u4e86\u5bf9CPU\u7684\u4f9d<\/p>\n","protected":false},"author":1,"featured_media":21748,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[5],"tags":[292,104,393,51,26,25,178,498,21,57,500,135,445],"collection":[],"_links":{"self":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/21760"}],"collection":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/comments?post=21760"}],"version-history":[{"count":0,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/posts\/21760\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media\/21748"}],"wp:attachment":[{"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/media?parent=21760"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/categories?post=21760"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/tags?post=21760"},{"taxonomy":"collection","embeddable":true,"href":"https:\/\/aqzt.com\/wp-json\/wp\/v2\/collection?post=21760"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}