{"id":18187,"date":"2024-11-18T14:25:48","date_gmt":"2024-11-18T06:25:48","guid":{"rendered":"https:\/\/fwq.ai\/blog\/18187\/"},"modified":"2024-11-18T14:25:48","modified_gmt":"2024-11-18T06:25:48","slug":"%e6%80%8e%e4%b9%88%e7%9c%8blinux%e7%9a%84pytorch%e7%8e%af%e5%a2%83","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/18187\/","title":{"rendered":"\u600e\u4e48\u770blinux\u7684pytorch\u73af\u5883"},"content":{"rendered":"<blockquote><p>\n  \u8981\u67e5\u770b linux \u4e0a\u7684 pytorch \u73af\u5883\uff0c\u53ef\u4ee5\u4f9d\u6b21\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u68c0\u67e5 pytorch \u7248\u672c\u67e5\u770b\u5df2\u5b89\u88c5\u7684 pytorch \u5305\u548c\u7248\u672c\u68c0\u67e5 cuda \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\u67e5\u770b cudnn \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\u68c0\u67e5 openmp \u652f\u6301\u68c0\u67e5 gpu \u53ef\u7528\u6027\u67e5\u770b\u73af\u5883\u53d8\u91cf\u68c0\u67e5 python \u7248\u672c\u68c0\u67e5 pip \u7248\u672c\u68c0\u67e5\u7cfb\u7edf\u4fe1\u606f\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/04\/2024060412391836423.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u770blinux\u7684pytorch\u73af\u5883\u63d2\u56fe\" alt=\"\u600e\u4e48\u770blinux\u7684pytorch\u73af\u5883\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b Linux \u4e0a\u7684 PyTorch \u73af\u5883\uff1f<\/strong><\/p>\n<p>\u8981\u5728 Linux \u4e0a\u67e5\u770b PyTorch \u73af\u5883\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n<p><strong>1. \u68c0\u67e5 PyTorch \u7248\u672c\uff08\u53ef\u9009\uff09\uff1a<\/strong><\/p>\n<pre>python -c \"import torch; print(torch.__version__)\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u67e5\u770b\u5df2\u5b89\u88c5\u7684 PyTorch \u5305\u548c\u7248\u672c\uff1a<\/strong><\/p>\n<pre>pip list | grep torch<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u68c0\u67e5 CUDA \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\uff1a<\/strong><\/p>\n<pre>nvcc --version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u67e5\u770b cuDNN \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\uff1a<\/strong><\/p>\n<pre>cat \/usr\/local\/cuda\/include\/cudnn.h | grep CUDNN_MAJOR<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u68c0\u67e5 OpenMP \u652f\u6301\uff1a<\/strong><\/p>\n<pre>python -c \"import torch; print(torch.backends.openmp.is_available())\"<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u68c0\u67e5 GPU \u53ef\u7528\u6027\uff1a<\/strong><\/p>\n<pre>nvidia-smi<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>7. \u67e5\u770b\u73af\u5883\u53d8\u91cf\uff1a<\/strong><\/p>\n<pre>env | grep CUDA\nenv | grep CUDNN<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>8. \u68c0\u67e5 Python \u7248\u672c\uff1a<\/strong><\/p>\n<pre>python --version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>9. \u68c0\u67e5 pip \u7248\u672c\uff1a<\/strong><\/p>\n<pre>pip --version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>10. \u68c0\u67e5\u7cfb\u7edf\u4fe1\u606f\uff1a<\/strong><\/p>\n<pre>uname -a\ncat \/etc\/os-release<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u770b\u7684pytorch\u73af\u5883\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8981\u67e5\u770b linux \u4e0a\u7684 pytorch \u73af\u5883\uff0c\u53ef\u4ee5\u4f9d\u6b21\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u68c0\u67e5 pytorch \u7248\u672c\u67e5\u770b\u5df2\u5b89\u88c5\u7684 pytorch \u5305\u548c\u7248\u672c\u68c0\u67e5 cuda \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\u67e5\u770b cudnn \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\u68c0\u67e5 openmp \u652f\u6301\u68c0\u67e5 gpu \u53ef\u7528\u6027\u67e5\u770b\u73af\u5883\u53d8\u91cf\u68c0\u67e5 python \u7248\u672c\u68c0\u67e5 pip \u7248\u672c\u68c0\u67e5\u7cfb\u7edf\u4fe1\u606f \u5982\u4f55\u67e5\u770b Linux \u4e0a\u7684 PyTorch \u73af\u5883\uff1f \u8981\u5728 Linux \u4e0a\u67e5\u770b PyTorch \u73af\u5883\uff0c\u8bf7\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u64cd\u4f5c\uff1a 1. \u68c0\u67e5 PyTorch \u7248\u672c\uff08\u53ef\u9009\uff09\uff1a python -c &#8220;import torch; print(torch.__version__)&#8221; \u767b\u5f55\u540e\u590d\u5236 2. \u67e5\u770b\u5df2\u5b89\u88c5\u7684 PyTorch \u5305\u548c\u7248\u672c\uff1a pip list | grep torch \u767b\u5f55\u540e\u590d\u5236 3. \u68c0\u67e5 CUDA \u7248\u672c\uff08\u5982\u679c\u5df2\u5b89\u88c5\uff09\uff1a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-18187","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18187","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=18187"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/18187\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=18187"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=18187"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=18187"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}