{"id":57219,"date":"2025-08-15T09:19:37","date_gmt":"2025-08-15T01:19:37","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/57219.html"},"modified":"2025-08-15T09:19:37","modified_gmt":"2025-08-15T01:19:37","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8b%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%9c%89%e5%87%a0%e5%bc%a0gpu","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/57219.html","title":{"rendered":"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU"},"content":{"rendered":"<h2>\u8981\u67e5\u770b\u670d\u52a1\u5668\u4e0a\u6709\u591a\u5c11\u5f20 GPU&#xff0c;\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5&#xff1a;<\/h2>\n<h3>1.1 \u4f7f\u7528 nvidia-smi\u5de5\u5177&#xff08;\u9488\u5bf9 NVIDIA GPU&#xff09;&#xff1a;<\/h3>\n<p>\u5982\u679c\u4f60\u7684\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86 NVIDIA GPU \u9a71\u52a8\u7a0b\u5e8f&#xff0c;\u90a3\u4e48\u53ef\u4ee5\u4f7f\u7528 nvidia-smi \u547d\u4ee4\u67e5\u770b\u8be6\u7ec6\u7684 GPU \u4fe1\u606f\u3002<\/p>\n<p>nvidia-smi<\/p>\n<p>\u8be5\u547d\u4ee4\u5c06\u663e\u793a\u670d\u52a1\u5668\u4e0a\u6240\u6709\u7684 NVIDIA GPU \u53ca\u5176\u8be6\u7ec6\u4fe1\u606f&#xff0c;\u5305\u62ec\u9a71\u52a8\u7248\u672c\u3001\u6bcf\u4e2a GPU \u7684\u4f7f\u7528\u60c5\u51b5\u3001\u5185\u5b58\u4f7f\u7528\u3001\u6e29\u5ea6\u7b49\u3002<\/p>\n<h3>1.2 \u4f7f\u7528 lspci \u547d\u4ee4&#xff1a;<\/h3>\n<p>\u8fd9\u4e2a\u547d\u4ee4\u53ef\u4ee5\u7528\u4e8e\u5217\u51fa\u6240\u6709\u7684 PCI \u8bbe\u5907&#xff0c;\u5305\u62ec GPU\u3002\u5728\u547d\u4ee4\u8f93\u51fa\u4e2d&#xff0c;\u4f60\u53ef\u4ee5\u8fc7\u6ee4\u51fa\u4e0e\u663e\u5361\u76f8\u5173\u7684\u4fe1\u606f\u3002<\/p>\n<p>lspci <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token parameter variable\">-i<\/span> <span class=\"token parameter variable\">&#8211;color<\/span> <span class=\"token string\">&#039;vga\\\\|3d\\\\|2d&#039;<\/span><\/p>\n<p>\u8fd9\u5c06\u663e\u793a\u6240\u6709\u4e0e\u56fe\u5f62\u76f8\u5173\u7684\u8bbe\u5907&#xff0c;\u4e0d\u8fc7\u5b83\u53ef\u80fd\u4e0d\u4f1a\u663e\u793a GPU \u7684\u5177\u4f53\u578b\u53f7\u548c\u8be6\u7ec6\u4fe1\u606f\u3002<\/p>\n<h3>1.3 \u4f7f\u7528 lshw \u5de5\u5177&#xff1a;<\/h3>\n<p>lshw \u662f\u4e00\u4e2a\u53ef\u4ee5\u5217\u51fa\u786c\u4ef6\u7684\u8be6\u7ec6\u4fe1\u606f\u7684\u5de5\u5177\u3002\u4f60\u53ef\u4ee5\u7528\u5b83\u6765\u5217\u51fa\u6240\u6709\u56fe\u5f62\u8bbe\u5907\u3002<\/p>\n<p><span class=\"token function\">sudo<\/span> lshw <span class=\"token parameter variable\">-C<\/span> display<\/p>\n<p>\u8fd9\u5c06\u63d0\u4f9b\u663e\u793a\u63a7\u5236\u5668\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u663e\u793a\u51fa GPU \u578b\u53f7&#xff0c;\u786e\u4fdd lshw \u5df2\u6b63\u786e\u5b89\u88c5&#xff0c;\u5e76\u4ee5 sudo \u6743\u9650\u8fd0\u884c\u3002<\/p>\n<h3>1.4 \u4f7f\u7528 glxinfo \u5de5\u5177&#xff1a;<\/h3>\n<p>glxinfo \u662f\u4e00\u4e2a\u7528\u4e8e\u663e\u793a OpenGL \u548c\u56fe\u5f62\u76f8\u5173\u4fe1\u606f\u7684\u5de5\u5177\u3002<\/p>\n<p>glxinfo <span class=\"token operator\">|<\/span> <span class=\"token function\">grep<\/span> <span class=\"token string\">&#034;OpenGL renderer&#034;<\/span><\/p>\n<p>\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u63d0\u4f9b\u5f53\u524d\u673a\u5668\u4e0a\u53ef\u7528\u7684 GPU \u4fe1\u606f&#xff0c;\u4f46\u5176\u4e3b\u8981\u7528\u4e8e\u56fe\u5f62\u754c\u9762\u7684\u73af\u5883\u3002<\/p>\n<h3>1.5 Python \u811a\u672c&#xff08;\u5982\u679c\u5df2\u5b89\u88c5 PyCUDA \u6216 TensorFlow&#xff09;&#xff1a;<\/h3>\n<p>\u5728 Python \u4e2d&#xff0c;\u4f7f\u7528 PyCUDA \u5e93&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> pycuda<span class=\"token punctuation\">.<\/span>driver <span class=\"token keyword\">as<\/span> cuda<br \/>\ncuda<span class=\"token punctuation\">.<\/span>init<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Detected <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>cuda<span class=\"token punctuation\">.<\/span>Device<span class=\"token punctuation\">.<\/span>count<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> CUDA-capable device(s)&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u4f7f\u7528 TensorFlow&#xff08;\u5982\u679c TensorFlow \u548c CUDA \u5df2\u6b63\u786e\u5b89\u88c5&#xff09;&#xff1a;<\/p>\n<p><span class=\"token keyword\">import<\/span> tensorflow <span class=\"token keyword\">as<\/span> tf<br \/>\ngpus <span class=\"token operator\">&#061;<\/span> tf<span class=\"token punctuation\">.<\/span>config<span class=\"token punctuation\">.<\/span>list_physical_devices<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#039;GPU&#039;<\/span><span class=\"token punctuation\">)<\/span><br \/>\n<span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;Available GPU(s): <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span><span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>gpus<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>\u901a\u8fc7\u8fd9\u4e9b\u65b9\u6cd5&#xff0c;\u4f60\u5e94\u8be5\u80fd\u591f\u786e\u5b9a\u670d\u52a1\u5668\u4e0a\u5b89\u88c5\u4e86\u591a\u5c11 GPU&#xff0c;\u5e76\u83b7\u53d6\u4e00\u4e9b\u57fa\u672c\u7684\u4fe1\u606f\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528\u7684\u662f\u5176\u4ed6\u54c1\u724c\u7684 GPU&#xff08;\u6bd4\u5982 AMD&#xff09;&#xff0c;\u5219\u9700\u8981\u76f8\u5e94\u7684\u5de5\u5177\u6765\u83b7\u53d6\u4fe1\u606f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb649\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU\uff0c\u8981\u67e5\u770b\u670d\u52a1\u5668\u4e0a\u6709\u591a\u5c11\u5f20 GPU\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a_\u670d\u52a1\u5668\u7684gpu\u600e\u4e48\u67e5\u770b<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3435,43,44],"topic":[],"class_list":["post-57219","post","type-post","status-publish","format-standard","hentry","category-server","tag-3435","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/57219.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb649\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU\uff0c\u8981\u67e5\u770b\u670d\u52a1\u5668\u4e0a\u6709\u591a\u5c11\u5f20 GPU\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a_\u670d\u52a1\u5668\u7684gpu\u600e\u4e48\u67e5\u770b\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/57219.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-15T01:19:37+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57219.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/57219.html\",\"name\":\"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-15T01:19:37+00:00\",\"dateModified\":\"2025-08-15T01:19:37+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/57219.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/57219.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57219.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/57219.html","og_locale":"zh_CN","og_type":"article","og_title":"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb649\u6b21\uff0c\u70b9\u8d5e8\u6b21\uff0c\u6536\u85cf3\u6b21\u3002\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU\uff0c\u8981\u67e5\u770b\u670d\u52a1\u5668\u4e0a\u6709\u591a\u5c11\u5f20 GPU\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u51e0\u79cd\u65b9\u6cd5\uff1a_\u670d\u52a1\u5668\u7684gpu\u600e\u4e48\u67e5\u770b","og_url":"https:\/\/www.wsisp.com\/helps\/57219.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-15T01:19:37+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/57219.html","url":"https:\/\/www.wsisp.com\/helps\/57219.html","name":"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-15T01:19:37+00:00","dateModified":"2025-08-15T01:19:37+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/57219.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/57219.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/57219.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u5982\u4f55\u67e5\u770b\u670d\u52a1\u5668\u6709\u51e0\u5f20GPU"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=57219"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57219\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=57219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=57219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=57219"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=57219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}