{"id":9251,"date":"2021-08-13T11:47:15","date_gmt":"2021-08-13T11:47:15","guid":{"rendered":"https:\/\/linuxways.net\/?p=9251"},"modified":"2021-08-13T11:47:15","modified_gmt":"2021-08-13T11:47:15","slug":"how-to-install-cuda-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-install-cuda-on-ubuntu-20-04\/","title":{"rendered":"How to Install CUDA on Ubuntu 20.04"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>CUDA toolkit is an extension of the Graphics Processing Unit parallel computing architecture developed by NVIDIA. It also enhances the performance of the computer by using the power of the GPU. Programmers can use it through popular programming languages. We can install the CUDA toolkit from the Ubuntu repository.<\/p>\n<p>Below is the guide on how to install CUDA on Ubuntu 20.04.<\/p>\n<h2>Installing the CUDA toolkit from the Ubuntu repository<\/h2>\n<p>Step 1 &#8211; Update packages from the Internet by apt command:<\/p>\n<pre>$ sudo apt update<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1026\" height=\"249\" class=\"wp-image-9252\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251.png 1026w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251-300x73.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251-1024x249.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251-768x186.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-251-1020x249.png 1020w\" sizes=\"auto, (max-width: 1026px) 100vw, 1026px\" \/><\/p>\n<p>Step 2 &#8211; Now we start installing the CUDA toolkit by apt command:<\/p>\n<pre>$ sudo apt install nvidia-cuda-toolkit<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"192\" class=\"wp-image-9253\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-252.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-252.png 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-252-300x56.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-252-768x144.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-252-1020x192.png 1020w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<h2>Add CUDA to PATH<\/h2>\n<p>After installing, we must add CUDA to PATH, so that the shell knows where CUDA is located. Let\u2019s open the .profile file by vim command:<\/p>\n<pre>$ sudo vim ~\/.profile<\/pre>\n<p>Then add the following lines to the end of the file and save:<\/p>\n<pre># set PATH for cuda 10.1 installation\r\n\r\nif [ -d \"\/usr\/local\/cuda-10.1\/bin\/\" ]; then\r\n\r\nexport PATH=\/usr\/local\/cuda-10.1\/bin${PATH:+:${PATH}}\r\n\r\nexport LD_LIBRARY_PATH=\/usr\/local\/cuda-10.1\/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}\r\n\r\nfi<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1026\" height=\"660\" class=\"wp-image-9254\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-10.jpeg\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-10.jpeg 1026w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-10-300x193.jpeg 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-10-1024x659.jpeg 1024w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-10-768x494.jpeg 768w\" sizes=\"auto, (max-width: 1026px) 100vw, 1026px\" \/><\/p>\n<p>After finishing, let\u2019s reboot your computer:<\/p>\n<pre>$ sudo reboot<\/pre>\n<h2>Check your CUDA version<\/h2>\n<pre>$ nvcc --version<\/pre>\n<p>Output:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"1025\" height=\"130\" class=\"wp-image-9255\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-253.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-253.png 1025w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-253-300x38.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-253-768x97.png 768w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/08\/word-image-253-1020x130.png 1020w\" sizes=\"auto, (max-width: 1025px) 100vw, 1025px\" \/><\/p>\n<h2>Conclusion<\/h2>\n<p>You\u2019ve already gone through the details of how to install CUDA on Ubuntu 20.04.<\/p>\n<p>Thanks for reading.<\/p>","protected":false},"excerpt":{"rendered":"<p>Introduction CUDA toolkit is an extension of the Graphics Processing Unit parallel computing architecture developed by NVIDIA. It also enhances the performance of the computer by using the&hellip;<\/p>","protected":false},"author":1,"featured_media":9283,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[480,100],"class_list":["post-9251","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-cuda","tag-ubuntu-20-04"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9251","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=9251"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/9251\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/9283"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=9251"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=9251"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=9251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}