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
延伸文章資訊
- 1Ubuntu 16.04 安裝CUDA、cuDNN 教學 - Medium
Step 0 如何選擇安裝的版本 · Step 1 安裝前的準備動作 · Step 2 安裝CUDA · Step 3 安裝NVIDIA GPU driver · Step 4 安裝cuDNN.
- 2How 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...
- 3Installation Guide Linux :: CUDA Toolkit Documentation
Ubuntu
- 4Ubuntu 安裝CUDA cuDNN pytorch tensorflow mxnet | by 林塔恩
This installation did not install the CUDA Driver. A driver of version at least 460.00 is require...
- 5How to Install CUDA on Ubuntu 20.04 - Linoxide
Start off by updating the package lists on your Ubuntu 20.04 instance. ... Next, install the CUDA...