{"id":239455,"date":"2022-04-06T10:55:01","date_gmt":"2022-04-06T02:55:01","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=239455"},"modified":"2022-04-02T12:10:28","modified_gmt":"2022-04-02T04:10:28","slug":"centos7-a100-gpu","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/centos7-a100-gpu.html","title":{"rendered":"Centos 7.8 \u4e2d\u5b89\u88c5Nvidia A100 GPU\u9a71\u52a8"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Centos 7.8 \u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7981\u7528nouveau\u9a71\u52a8\uff0c\u5e76\u5b89\u88c5Nvidia Tesla A100\u578b\u53f7GPU\u7684\u9a71\u52a8\uff0c\u5e76\u5b89\u88c5CUDA11.6\u548ccuDNN\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u7cfb\u7edf\u4e2d\u67e5\u770bGPU\u4fe1\u606f<\/strong><\/div>\n

\u7cfb\u7edf\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u8fdb\u5165\u7cfb\u7edf\uff0c\u4f7f\u7528lspci \u547d\u4ee4\u67e5\u8be2\u4e00\u4e0bGPU\u662f\u5426\u5b58\u5728\u3001\u578b\u53f7\u4fe1\u606f\u662f\u4ec0\u4e48\u3002<\/p>\n

\r\n[root@node01 ~]# lspci | grep -i nvidia\r\n<\/pre>\n
\u4e0b\u8f7dNVIDIA Tesla A100\u9a71\u52a8<\/strong><\/div>\n

\u901a\u8fc7lspci\u67e5\u8be2\u5230GPU\u7684\u578b\u53f7\u4e4b\u540e\uff0c\u8bbf\u95ee\u5b98\u7f51nvidia.com<\/code>\u4e0b\u8f7d\u9a71\u52a8\u7a0b\u5e8f\u53ef\u4ee5\u6309\u7167\u5982\u4e0b\u9009\u62e9\uff0c\u9009\u62e9\u4ea7\u54c1\u7c7b\u578b\u3001\u7cfb\u5217\u3001\u578b\u53f7\u3001\u7136\u540e\u6839\u636e\u81ea\u5df1\u7684\u64cd\u4f5c\u7cfb\u7edf\u6765\u9009\u62e9\u3002
\n\u6ce8\u610f\uff1a\u5982\u679c\u64cd\u4f5c\u7cfb\u7edf\u662fLinux\uff0c\u5c3d\u91cf\u9009\u62e9Linux 32-bit\/Linux 64-bit\uff0c\u4e0d\u9700\u8981\u9009\u62e9\u8be6\u7ec6\u7684Linux\u53d1\u884c\u7248\u672c\u3002\u6d4b\u8bd5\u662f\u53d1\u73b0\u9009\u62e9\u8be6\u7ec6\u7684Linux\u53d1\u884c\u7248\u672c\uff0c\u5b89\u88c5\u9a71\u52a8\u4e4b\u540e\uff0c\u627e\u4e0d\u5230nvidia-smi\u547d\u4ee4\u3002
\n\"\"
\n\"\"<\/p>\n

\u5b89\u88c5gcc\u7b49\u4f9d\u8d56\u5305<\/strong><\/div>\n

\u5f53\u5b89\u88c5GPU\u9a71\u52a8\u65f6\uff0c\u63d0\u793a\u7f3a\u5c11\u76f8\u5173\u7684\u4f9d\u8d56\u5305\uff0c\u5728\u6b64\uff0c\u6211\u4eec\u9700\u8981\u63d0\u524d\u5b89\u88c5\u76f8\u5173\u7684\u4f9d\u8d56\u5305\uff0c\u76ee\u524d\u9700\u8981\u7528\u5230\u7684\u662fgcc , g++ , make \uff1a<\/p>\n

\r\n[root@localhost ~]# yum -y install gcc gcc-c++ kernel-devel make\r\n<\/pre>\n
\u5c4f\u853dnouveau\u5f00\u6e90\u7248\u672c\u7684GPU\u9a71\u52a8<\/strong><\/div>\n

\u5f53\u7cfb\u7edf\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u4f1a\u5b89\u88c5\u7cfb\u7edf\u5f00\u6e90\u7684NVIDIA\u9a71\u52a8\u7248\u672c\uff0c\u540d\u79f0\u4e3anouveau\u3002\u67e5\u770bnouveau\u9a71\u52a8\u662f\u5426\u52a0\u8f7d\u3002<\/p>\n

\r\n[root@localhost ~]# lsmod |grep -i nouveau\r\n<\/pre>\n

\"\"
\n\u4e0b\u9762\u5c06\u5c4f\u853d\u8be5\u9a71\u52a8\u3002\u7f16\u8f91\/etc\/default\/grub<\/code>\u6587\u4ef6\uff0c\u4fee\u6539GRUB_CMDLINE_LINUX<\/code>\u4e00\u884c\uff1a<\/p>\n

\r\n[root@localhost ~]# cat \/etc\/default\/grub\r\n<\/pre>\n

\"\"
\n\u4fdd\u5b58\u9000\u51fa\uff0c\u66f4\u65b0grub:<\/p>\n

\r\n[root@localhost ~]# grub2-mkconfig -o \/boot\/grub2\/grub.cfg\r\nGenerating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.10.0-1160.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-1160.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-91fd57f1c90a4a2da20ef93ed7f886c6\r\nFound initrd image: \/boot\/initramfs-0-rescue-91fd57f1c90a4a2da20ef93ed7f886c6.img\r\ndone\r\n[root@localhost ~]# grub2-mkconfig -o \/boot\/grub2\/grub.efi.cfg\r\nGenerating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.10.0-1160.el7.x86_64\r\nFound initrd image: \/boot\/initramfs-3.10.0-1160.el7.x86_64.img\r\nFound linux image: \/boot\/vmlinuz-0-rescue-91fd57f1c90a4a2da20ef93ed7f886c6\r\nFound initrd image: \/boot\/initramfs-0-rescue-91fd57f1c90a4a2da20ef93ed7f886c6.img\r\n<\/pre>\n

\"\"
\n\u7f16\u8f91\/lib\/modprobe.d\/dist-blacklist.conf<\/code>\uff0c\u628a blacklist nvidiafb \u6539\u6210 #blacklist nvidiafb\uff0c\u7136\u540e\u5728\u6700\u4e0b\u9762\u6dfb\u52a0blacklist nouveau<\/code>\u548c\u3002<\/p>\n

\r\n[root@localhost ~]# vim \/lib\/modprobe.d\/dist-blacklist.conf\r\n# blacklist nvidiafb\r\nblacklist nouveau\r\noptions nouveau modeset=0\r\n<\/pre>\n

\"\"
\n\"\"
\n\u5907\u4efdinitrams\u5e76\u4f7f\u7528dracut\u91cd\u65b0\u5efa\u7acbinitramfs\u5e76\u91cd\u542f\u7cfb\u7edf\uff1a<\/p>\n

\r\n[root@localhost ~]# mv \/boot\/initramfs-$(uname -r).img \/boot\/initramfs-$(uname -r).img.bak\r\n[root@localhost ~]# dracut -v \/boot\/initramfs-$(uname -r).img $(uname -r)\r\n[root@localhost ~]#  reboot\r\n<\/pre>\n

\u67e5\u770bnouveau\u6a21\u5757\u662f\u5426\u52a0\u8f7d\uff0c\u4e0d\u663e\u793a\u7684\u8bdd\u5c31\u8868\u793a\u5df2\u7ecf\u7981\u7528\uff1a<\/p>\n

\r\n# lsmod | grep nouveau\r\n<\/pre>\n

\"\"<\/p>\n

\u5b89\u88c5NVIDIA GPU\u9a71\u52a8<\/strong><\/div>\n

\u5b89\u88c5\u4e0b\u8f7d\u7684GPU\u9a71\u52a8\uff1aNVIDIA-Linux-x86_64-510.47.03.run \uff0c\u76ee\u524d\u9a71\u52a8\u7248\u672c\u4e3a\uff1a510.47.03\uff0c\u5982\u4e0b\u6267\u884c\u8be5\u9a71\u52a8\u6587\u4ef6\uff0c\u5373\u53ef\u5b89\u88c5\u3002<\/p>\n

\r\n[root@localhost ~]# .\/NVIDIA-Linux-x86_64-346.47.run\r\n<\/pre>\n

\"\"
\n\"\"
\n\u8f93\u5165nvidia-smi<\/code>\u6765\u67e5\u770b\u662f\u5426\u53ef\u4ee5\u770b\u5230GPU\u4fe1\u606f\uff1a<\/p>\n

\r\n[root@localhost ~]# nvidia-smi\r\n<\/pre>\n

\"\"
\n\u81f3\u6b64\u5b89\u88c5\u5b8c\u6210\u3002<\/p>\n

\u5b89\u88c5CUDA 11.6<\/strong><\/div>\n

\u8bbf\u95eenvidia\u5b98\u7f51\uff0c\u4e0b\u8f7dCUDA\uff0ccuda\u7684\u94fe\u63a5\u4e3a\uff1ahttps:\/\/developer.nvidia.com\/cuda-downloads
\n\u9009\u62e9runfile\u6587\u4ef6\u6765\u5b89\u88c5\u3002
\n\"\"<\/p>\n

\r\n[root@localhost ~]# wget https:\/\/developer.download.nvidia.com\/compute\/cuda\/11.6.0\/local_installers\/cuda_11.6.0_510.39.01_linux.run\r\n[root@localhost ~]# sudo sh cuda_11.6.0_510.39.01_linux.run\r\n<\/pre>\n

\u5982\u4e0b\u56fe\uff0cDriver\u9009\u9879\u4e0d\u8981\u52fe\u9009\u4e86\uff0c\u524d\u9762\u5df2\u7ecf\u5b89\u88c5GPU\u9a71\u52a8\u4e86\u3002
\n\"\"
\n\u521b\u5efa\u73af\u5883\u53d8\u91cf\uff0c\u7f16\u8f91~\/.bashrc<\/code>\u6587\u4ef6\uff1a<\/p>\n

\r\n[root@localhost ~]# vim ~\/.bashrc\r\n<\/pre>\n

\u5c06\u4e0b\u9762\u547d\u4ee4\u8ffd\u52a0\u5230\u6587\u4ef6\u6700\u540e\u9762\uff1a<\/p>\n

\r\nexport CUDA_HOME=\/usr\/local\/cuda\r\nexport PATH=$PATH:$CUDA_HOME\/bin\r\nexport LD_LIBRARY_PATH=\/usr\/local\/cuda-11.6\/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}\r\n <\/pre>\n

\u4e3anvcc<\/code>\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u8f6f\u8fde\u63a5\u5230\/usr\/bin\u76ee\u5f55\uff1a<\/p>\n

\r\n[root@localhost ~]# sudo ln -s \/usr\/local\/cuda\/bin\/nvcc \/usr\/bin\/nvcc\r\n<\/pre>\n

\u4f7f\u7528nvcc\u547d\u4ee4\u67e5\u770bcuda\u7684\u7248\u672c\uff1a<\/p>\n

\r\n[root@localhost ~]# nvcc --version\r\n<\/pre>\n

<\/options><\/p>\n","protected":false},"excerpt":{"rendered":"

\u7cfb\u7edf\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u8fdb\u5165\u7cfb\u7edf\uff0c\u4f7f\u7528lspci \u547d\u4ee4\u67e5\u8be2\u4e00\u4e0bGPU\u662f\u5426\u5b58\u5728\u3001\u578b\u53f7\u4fe1\u606f\u662f\u4ec0\u4e48\u3002 [root@node […]<\/p>\n","protected":false},"author":309,"featured_media":239456,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-239455","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\/239455","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\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=239455"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239455\/revisions"}],"predecessor-version":[{"id":239471,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239455\/revisions\/239471"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/239456"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=239455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=239455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=239455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}