{"id":239417,"date":"2022-04-05T08:11:40","date_gmt":"2022-04-05T00:11:40","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=239417"},"modified":"2022-04-02T12:10:10","modified_gmt":"2022-04-02T04:10:10","slug":"ubuntu-nvidia-v100-gpu","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ubuntu-nvidia-v100-gpu.html","title":{"rendered":"\u5728Ubuntu 20.04\u4e2d\u5b89\u88c5Nvidia V100 GPU\u9a71\u52a8"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u672c\u6587\u4ecb\u7ecd\u5982\u4f55\u5728Ubuntu 20.04 \u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7981\u7528nouveau\u9a71\u52a8\uff0c\u5e76\u5b89\u88c5Nvidia Tesla V100\u578b\u53f7GPU\u7684\u9a71\u52a8\uff0c\u5e76\u5b89\u88c5CUDA11.6\u548ccuDNN\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5b89\u88c5Ubuntu 20.04.3 LTS\u7248\u672c<\/strong><\/div>\n

\u5b89\u88c5Ubuntu 20.04\u6309\u7167\u5b89\u88c5\u63d0\u793a\uff0c\u4ed4\u7ec6\u9009\u62e9\u6bcf\u4e00\u9879\uff0c\u57fa\u672c\u9ed8\u8ba4\u5373\u53ef\u3002
\n\"\"<\/p>\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\nbpang@bobpang:~$ sudo lspci |grep -i nvidia\r\n2f:00.0 3D controller: NVIDIA Corporation GV100GL [Tesla V100 PCIe 16GB] (rev a1)\r\n86:00.0 3D controller: NVIDIA Corporation GV100GL [Tesla V100 PCIe 16GB] (rev a1)\r\n<\/pre>\n
\u4e0b\u8f7dNVIDIA Tesla V100\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\"\"<\/p>\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\nbpang@bobpang:~$ sudo apt install gcc g++ 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\u4e0b\u9762\u5c06\u5c4f\u853d\u8be5\u9a71\u52a8\u3002
\n\u9996\u5148\uff0c\u521b\u5efa\/etc\/modprobe.d\/blacklist-nouveau.conf\u6587\u4ef6\uff0c<\/p>\n

\r\nbpang@bobpang:~$ sudo vim \/etc\/modprobe.d\/blacklist-nouveau.conf\r\n<\/pre>\n

\u5c06\u4e0b\u9762\u5185\u5bb9\u6dfb\u52a0\u8fdb\u53bb\uff1a<\/p>\n

\r\nblacklist nouveau\r\nblacklist lbm-nouveau\r\noptions nouveau modeset=0\r\nalias nouveau off\r\nalias lbm-nouveau off\r\n<\/pre>\n

\u521b\u5efa\/etc\/modprobe.d\/nouveau-kms.conf\u6587\u4ef6\uff0c\u5c06options nouveau mdeset=0\u6dfb\u52a0\u8fdb\u53bb\uff1a<\/p>\n

\r\nbpang@bobpang:~$ echo options nouveau modeset=0 | sudo tee -a \/etc\/modprobe.d\/nouveau-kms.conf\r\n<\/pre>\n

\u66f4\u65b0\u4e00\u4e0binitramfs\uff1a<\/p>\n

\r\nbpang@bobpang:~$ sudo update-initramfs -u\r\n<\/pre>\n

\u91cd\u542f\u670d\u52a1\u5668\uff1a<\/p>\n

\r\nbpang@bobpang:~$ sudo 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\nbpang@bobpang:~$ sudo 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\nbpang@bobpang:~$ .\/ NVIDIA-Linux-x86_64-510.47.03.run\r\n<\/pre>\n

\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528lspci\u770b\u5230GPU\u7684\u9a71\u52a8\u4fe1\u606f\uff1a
\n\"\"
\n\u4f7f\u7528nvidia-smi\u547d\u4ee4\u67e5\u770bGPU\u7684\u4fe1\u606f<\/p>\n

\r\nbpang@bobpang:~$  nvidia-smi\r\n<\/pre>\n

\"\"<\/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\nbpang@bobpang:~$  wget https:\/\/developer.download.nvidia.com\/compute\/cuda\/11.6.0\/local_installers\/cuda_11.6.0_510.39.01_linux.run\r\nbpang@bobpang:~$  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\"\"
\n\u521b\u5efa\u73af\u5883\u53d8\u91cf\uff0c\u7f16\u8f91~\/.bashrc<\/code>\u6587\u4ef6\uff1a<\/p>\n

\r\nbpang@bobpang:\/data\/cuda$ 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

bpang@bobpang:\/data\/cuda$ sudo ln -s \/usr\/local\/cuda\/bin\/nvcc \/usr\/bin\/nvcc<\/pre>\n

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

\r\nbpang@bobpang:\/data\/cuda$ nvcc --version\r\n<\/pre>\n

\"\"<\/p>\n

\u9a8c\u8bc1CUDA\u662f\u5426\u5b89\u88c5\u6210\u529f<\/strong><\/div>\n

\u4e0b\u8f7dCUD\u5b9e\u4f8b\u6587\u4ef6\u3002\u56e0\u4e3aCUDA 11.6\u7248\u672c\u4e2d \/usr\/local\/cuda\/samples\u91cc\u9762\u6ca1\u6709\u5b9e\u4f8b\u6587\u4ef6\uff0c\u53ea\u6709\u4e00\u4e2aREADME\u6587\u4ef6\uff0c\u5185\u5bb9\u4e2d\u544a\u8bc9\u4f60\u9700\u8981\u4ecegithub\u4e0b\u8f7d\uff0c\u56e0\u4e3agithub\u592a\u6162\uff0c\u6240\u4ee5\u4ecegitee\u4e2d\u4e0b\u8f7d\u5b9e\u4f8b\u6587\u4ef6\uff1a<\/p>\n

\r\nbpang@bobpang:~$ git clone https:\/\/gitee.com\/liwuhaoooo\/cuda-samples.git\r\nbpang@bobpang:~$ mv cuda-samples\/Samples\/* \/usr\/local\/cuda\/samples\/*\r\nbpang@bobpang:~$ cd \/usr\/local\/cuda\/samples\/1_Utilities\/deviceQuery\r\n$ sudo make\r\n$ .\/deviceQuery\r\n<\/pre>\n

\"\"
\n\"\"<\/p>\n

\u5b89\u88c5cuDNN<\/strong><\/div>\n

https:\/\/developer.nvidia.com\/cudnn \u4ece\u5b98\u7f51\u4e0b\u8f7dcudnn
\n\"\"
\n\"\"
\n\u4e0b\u8f7d\u7684\u6587\u4ef6\u540d\u4e3a\uff1acudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz
\n\u6587\u4ef6\u62f7\u8d1d\u5230\u670d\u52a1\u5668\u3002\u7136\u540e\u5b89\u88c5\uff1a<\/p>\n

\r\nbpang@bobpang:\/data$ tar xvf cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive.tar.xz\r\nbpang@bobpang:~$ cd \/usr\/local\/cuda\r\nbpang@bobpang:\/usr\/local\/cuda$ sudo cp -p \/data\/cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive\/include\/cudnn*.h include\/\r\nbpang@bobpang:\/usr\/local\/cuda$ sudo cp -p \/data\/cudnn-linux-x86_64-8.3.2.44_cuda11.5-archive\/lib\/libcudnn* lib64\/\r\nbpang@bobpang:~$ sudo chmod a+r \/usr\/local\/cuda-11.6\/include\/cudnn.h\r\nbpang@bobpang:~$ sudo chmod a+r \/usr\/local\/cuda-11.6\/lib64\/libcudnn*\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u5b89\u88c5Ubuntu 20.04\u6309\u7167\u5b89\u88c5\u63d0\u793a\uff0c\u4ed4\u7ec6\u9009\u62e9\u6bcf\u4e00\u9879\uff0c\u57fa\u672c\u9ed8\u8ba4\u5373\u53ef\u3002 \u7cfb\u7edf\u5b89\u88c5\u5b8c\u6210\u4e4b\u540e\uff0c\u8fdb\u5165\u7cfb\u7edf\uff0c\u4f7f\u7528ls […]<\/p>\n","protected":false},"author":309,"featured_media":239418,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-239417","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\/239417","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=239417"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239417\/revisions"}],"predecessor-version":[{"id":239434,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/239417\/revisions\/239434"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/239418"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=239417"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=239417"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=239417"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}