How to Install CUDA on Ubuntu 20.04 - Linoxide
文章推薦指數: 80 %
Start off by updating the package lists on your Ubuntu 20.04 instance. ... Next, install the CUDA toolkit using the APT package manager as follows ... Skiptocontent LinOxide Menu LinuxCommandsUbuntuDebianCentOSNewsletterTutorials BestinLinux Automation Apps&Tools Containers TerminalTips Security Monitoring PackageManagement RECENTPOSTS BestPDFEditorsforLinuxThatYouShouldKnow HowtoInstallGrafana8onUbuntu20.04 Top8ReasonstoUseGarudaLinux HowtoInstallRundeckonUbuntu20.04 HowtoInstallMicrosoftEdgeonUbuntu[GUIandTerminal] AboutMeetUs TeamFeedbackContactUs CUDAisaparallelcomputingplatformandaprogrammingmodelthatprovidesaremarkableuserexperiencewhenleveragingGPUforeverydaygeneral-purposecomputing.CUDAstandsforComputeUnifiedDeviceArchitecture.ItiscreatedbyNVIDIA. CUDAcomprisestheCUDAtoolkit(compiler,profile,anddebugger),thesoftwaredriver,andtheCUDASDK.ThesoftwarelayergivesdirectaccesstotheGPU'svirtualinstructionsetandparallelcomputationalelements.FordeeplearningresearchesandframeworkdevelopersusecuDNNforhigh-performanceGPUacceleration.Itisalibraryofprimitivesfordeepneuralnetworks. Inthisguide,welearnhowtoinstallCUDAandCuDNNonUbuntu20.04.Therearetwowaysofgoingaboutthis.YoucaninstallCUDAfromUbuntuRepository-whichistheeasiestapproach-orinstallfromtheCUDArepositorywhichprovidesthelatestversionofCUDA. Prerequisites: Minimum20GBoffreediskspaceRecommeded2GBRAMShouldhaveNVIDIAgraphicsdriverinstalled.DriverthatcomeswithCUDAmaynotbelastestversion. Method1:InstallCUDAfromUbunturepository StartoffbyupdatingthepackagelistsonyourUbuntu20.04instance. $sudoaptupdate Next,installtheCUDAtoolkitusingtheAPTpackagemanagerasfollows.Notethattheinstallationisintensive,andassuchensureyouhaveafastandstableinternetconnectionandaminimumof10Gofdiskspace. $sudoaptinstallnvidia-cuda-toolkit Oncetheinstallationiscomplete,weneedtoaddCUDAtoPATHsoastonotifytheshellofthelocationofCUDA.Todothis,wewillspecifythePATHinthe.bashrcfile.So,openthefileusingyourcommand-linetexteditor. $sudovim~/.bashrc Attheveryendofthefile,copyandpastethefollowinglinesofcode. #setPATHforcuda10.1installation if[-d"/usr/local/cuda-10.1/bin/"];then exportPATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}} exportLD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}} fi Next,reloadthechangesinthe.bashrcfile. $source~/.bashrc NowcheckandconfirmtheversionofCUDAinstalledusingthefollowingcommand. $nvcc--version CheckCUDAversion Method2:InstallCUDAfromCUDArepository Asmentionedearlier,theCUDArepositoryprovidesthelatestversionofCUDA.So,ifyouareouttoinstallthelatestversion,thenfollowtheinstructionsoutlinedherein. First,downloadtheCUDArepositorypin: $wgethttps://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin Next,movethepintothe/etc/preferences.ddirectoryandrenameitascuda-repository-pin-600. $sudomvcuda-ubuntu2004.pin/etc/apt/preferences.d/cuda-repository-pin-600 MoveCUDApintothe/etc/preferencesdirectory Thereafter,downloadtheCUDADebianfile.Benotifiedthatthefileisquitelarge-2.3Gtobepreciseatthetimeofwritingthisguide.Ensureyouhaveagoodinternetconnectionandamplediskspace. $wgethttps://developer.download.nvidia.com/compute/cuda/11.4.2/local_installers/cuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb Oncedownloaded,usethedpkgutilitytoexecutethefile. sudodpkg-icuda-repo-ubuntu2004-11-4-local_11.4.2-470.57.02-1_amd64.deb Next,installtheCUDAGPGkeyasfollows: $sudoapt-keyadd/var/cuda-repo-ubuntu2004-11-4-local/7fa2af80.pub Finally,updatethepackagelistsandinstallCUDAusingtheAPTpackagemanager. $sudoaptupdate $sudoaptinstallcuda-y InstallCuDNN CuDNNdoesn'tcomewithCuda.TodownloadCuDNNyouneedtoregistertobecomeamemberoftheNVIDIADeveloperProgramwhichisfree. AfterregisteringinNVIDIADeveloperProgramyoucandownloadthelatestversionofcuDNN.HereIamdownloadingthecuDNNLibraryforLinux. First,extractthecuDNNpackage: $tar-xzvfcudnn-10.2-linux-x64-v8.2.4.15.tgz ThencopythefollowingfilestotheCUDAdirectory: $sudocpcuda/include/cudnn*.h/usr/local/cuda/include $sudocpcuda/lib64/libcudnn*/usr/local/cuda/lib64 $sudochmoda+r/usr/local/cuda/include/cudnn*.h/usr/local/cuda/lib64/libcudnn* Conclusion Inthistutorial,welearnedhowtoinstallCUDAandcuDNNonUbuntu20.04.Thanksforreading,pleaseleaveyourfeedbackandsuggestions. LeaveaCommentCancelreplyCommentName Email Website Currentye@r* Leavethisfieldempty JoinOur17.5KLinuxCommunityWe’dlovetoconnectwithyouonanyofthefollowingsocialmediaplatforms. FreeLinux#LWeekly–Subscribe *indicatesrequired EmailAddress* ViewPrevious#LWEEKLYEditions. RecentPosts BestPDFEditorsforLinuxThatYouShouldKnow HowtoInstallGrafana8onUbuntu20.04 Top8ReasonstoUseGarudaLinux HowtoInstallRundeckonUbuntu20.04 HowtoInstallMicrosoftEdgeonUbuntu[GUIandTerminal] LINUXCLI A-ZLinuxCommands JoinOurSocialCommunity JoinourFacebookActiveGroup FollowusonLinkedin FollowusonFacebookpage FollowusonTwitterpage FREENEWSLETTER
延伸文章資訊
- 1How to Install CUDA on Ubuntu 20.04 LTS - Linux Hint
CUDA version 10 is available in the official package repository of Ubuntu 20.04 LTS. ... To confi...
- 2How to install CUDA on Ubuntu 20.04 Focal Fossa Linux
How to install CUDA toolkit from CUDA repository · In case you have not done so yet, make sure th...
- 3如何安裝CUDA、cuDNN 到Ubuntu 20.04? - 叩頂窩客
玩深度學習第一件事,先把CUDA、cuDNN 裝好!先確認手上的GPU 是否有支援CUDA,緊接著下載CUDA 安裝,過程中他也會自動幫你安裝正確的驅動。
- 4在Ubuntu 上安裝NVIDIA CUDA - VMware Docs
可以在Ubuntu Linux 上安裝CUDA。 ... 使用wget 命令下載適用於Ubuntu 20.04 的NVIDIA CUDA 發行版。
- 5Installation Guide Linux :: CUDA Toolkit Documentation
Ubuntu