How to get the CUDA version? - Stack Overflow

文章推薦指數: 80 %
投票人數:10人

(or /usr/local/cuda/bin/nvcc --version ) gives the CUDA compiler version (which matches the toolkit version). From application code, you can query the runtime ... Home Public Questions Tags Users Collectives ExploreCollectives FindaJob Jobs Companies Teams StackOverflowforTeams –Collaborateandshareknowledgewithaprivategroup. CreateafreeTeam WhatisTeams? Teams CreatefreeTeam CollectivesonStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore HowtogettheCUDAversion? AskQuestion Asked 10yearsago Modified 25daysago Viewed 1.6mtimes 732 133 IsthereanyquickcommandorscripttocheckfortheversionofCUDAinstalled? Ifoundthemanualof4.0undertheinstallationdirectorybutI'mnotsurewhetheritisoftheactualinstalledversionornot. cuda Share Improvethisquestion Follow editedFeb14,2021at2:47 AlexanderAbakumov 12k1111goldbadges7676silverbadges121121bronzebadges askedMar15,2012at20:30 HailiangZhangHailiangZhang 15.4k2121goldbadges6464silverbadges112112bronzebadges 7 3 Seealso:HowtoverifyCuDNNinstallation? – MartinThoma Jan2,2017at12:41 6 WhichOSisthisquestiontargeting? – nbro Jan11,2018at0:15 doyouthinkabouttheinstalledandsupportedruntimeortheinstalledSDK? – AlexanderStohr May16,2019at15:18 10 @JaredHoberocknvcc--versionproduceTheprogram'nvcc'iscurrentlynotinstalled.Youcaninstallitbytyping:sudoaptinstallnvidia-cuda-toolkithowevernvidia-smicontainCUDAVersion:10.1. – mrgloom Aug22,2019at13:27 3 Butcat/usr/local/cuda/version.txtgivesmorepreciseversionCUDAVersion10.1.168 – mrgloom Aug22,2019at13:29  |  Show2morecomments 30Answers 30 Sortedby: Resettodefault Highestscore(default) Datemodified(newestfirst) Datecreated(oldestfirst) 968 AsJaredmentionsinacomment,fromthecommandline: nvcc--version (or/usr/local/cuda/bin/nvcc--version)givestheCUDAcompilerversion(whichmatchesthetoolkitversion). Fromapplicationcode,youcanquerytheruntimeAPIversionwith cudaRuntimeGetVersion() orthedriverAPIversionwith cudaDriverGetVersion() AsDanielpointsout,deviceQueryisanSDKsampleappthatqueriestheabove,alongwithdevicecapabilities. Asothersnote,youcanalsocheckthecontentsoftheversion.txtusing(e.g.,onMacorLinux) cat/usr/local/cuda/version.txt However,ifthereisanotherversionoftheCUDAtoolkitinstalledotherthantheonesymlinkedfrom/usr/local/cuda,thismayreportaninaccurateversionifanotherversionisearlierinyourPATHthantheabove,sousewithcaution. Share Improvethisanswer Follow editedDec19,2018at3:34 answeredMar16,2012at1:39 harrismharrism 24.3k22goldbadges5454silverbadges8787bronzebadges 12 7 nvcc--versionshouldworkfromtheWindowscommandpromptassumingnvccisinyourpath. – harrism Jan14,2017at6:06 20 inUbuntuyoumayneedtoinstallnvidia-cuda-toolstomakethiscommandtowork.justtypesudoaptinstallnvidia-cuda-toolkit – OlegKokorin Aug24,2017at11:46 14 Ifyoucan'tfindnvcc,itshouldbein/usr/local/cuda/bin/. – Rush Mar2,2018at19:17 14 Upvoteforcat/usr/local/cuda/version.txt.Popularmethodwithnvcc--versionworksifyouhavenvidia-toolkitinstalled,however,ifyouhaveonlycudaruntime,[email protected].(Tensorflowsetupinstructionsdonotinstallnvcc) – KirillPavlov Mar24,2019at13:49 3 Both"/usr/local/cuda/bin/nvcc--version"and"nvcc--version"showdifferentoutput. – kamrankausar Jun11,2020at11:57  |  Show7morecomments 207 OnUbuntuCudaV8: $cat/usr/local/cuda/version.txt YoucanalsogetsomeinsightsintowhichCUDAversionsareinstalledwith: $ls-l/usr/local|grepcuda whichwillgiveyousomethinglikethis: lrwxrwxrwx1rootroot9Mar52020cuda->cuda-10.2 drwxr-xr-x16rootroot4096Mar52020cuda-10.2 drwxr-xr-x16rootroot4096Mar52020cuda-8.0.61 GivenasanePATH,theversioncudapointstoshouldbetheactiveone(10.2inthiscase). NOTE:ThisonlyworksifyouarewillingtoassumeCUDAisinstalledunder/usr/local/cuda(whichistruefortheindependentinstallerwiththedefaultlocation,butnottruee.g.fordistributionswithCUDAintegratedasapackage).Ref:commentfrom@einpoklum. Share Improvethisanswer Follow editedMar17,2021at2:19 drevicko 13.6k1313goldbadges6969silverbadges9292bronzebadges answeredSep8,2017at13:12 mwwebmwweb 6,55344goldbadges1616silverbadges2323bronzebadges 10 11 thisismoreversatilethanharrism'sanswersinceitdoesn'trequireinstallingnvcc(whichrequiresadminprivileges) – dinosaur Dec13,2017at0:46 1 WorksonAWSLinuxDeepLearningAMI – RutgerHofste Feb1,2018at14:38 21 usingthisIget"CUDAVersion8.0.61"butnvcc--versiongivesme"Cudacompilationtools,release7.5,V7.5.17"doyouknowthereasonforthemissmatch? – martinako Mar21,2018at15:07 1 Upvotedforbeingthemorecorrectanswer,myCUDAversionis9.0.176andwasnowherementionedinnvcc-V – Kalpit May24,2018at9:41 Igetafilenotfounderror,butnvccreportsversion8.0./usr/local/cudadoesnotexist.. – Elias Jul17,2018at14:35  |  Show5morecomments 142 Ifyourun nvidia-smi YoushouldfindtheCUDAVersiononthetoprightcornerofthecomand'soutput.AtleastIfoundthatoutputforCUDAversion10.0e.g., Share Improvethisanswer Follow editedAug16,2019at22:12 answeredApr16,2019at22:33 mostafa.elhoushimostafa.elhoushi 2,22611goldbadge1414silverbadges77bronzebadges 6 7 Lookslikenvidia-smionlyoutputsdriverversionforolderversions. – mrgloom Jun14,2019at12:55 48 ThatCUDAVersiondisplayonlyworksfordriverversionafter410.72.AnditwilldisplayCUDAVersionevenwhennoCUDAisinstalled.Sothisinformationnotmakeanysensecurrently.Reference:devtalk.nvidia.com/default/topic/1045528/… – BruceYo Sep24,2019at2:48 43 Thisanswerisincorrect,ThatonlyindicatesthedriverCUDAversionsupport.ItdoesnotprovideanyinformationaboutwhichCUDAversionisinstalledorevenwhetherthereisCUDAinstalledatall – talonmies Nov10,2019at20:09 5 Thiscudaversiononlyshowsthegpucudacapabilitiesandnotthecudaversionusedforruntimeapi. – monti May28,2020at10:33 11 nvcc--versionandnvidia-smididnotgivemethesameCUDAversion.Anditturnsoutyours(nvidia-smi)wasthewrongone. – scottlittle Sep27,2020at1:16  |  Show1morecomment 43 ForCUDAversion: nvcc--version Oruse, nvidia-smi ForcuDNNversion: ForLinux: UsefollowingtofindpathforcuDNN: $whereiscuda cuda:/usr/local/cuda Thenusethistogetversionfromheaderfile, $cat/usr/local/cuda/include/cudnn.h|grepCUDNN_MAJOR-A2 ForWindows, UsefollowingtofindpathforcuDNN: C:\>wherecudnn* C:\ProgramFiles\cuDNN7\cuda\bin\cudnn64_7.dll Thenusethistodumpversionfromheaderfile, type"%PROGRAMFILES%\cuDNN7\cuda\include\cudnn.h"|findstrCUDNN_MAJOR Ifyou'regettingtwodifferentversionsforCUDAonWindows- DifferentCUDAversionsshownbynvccandNVIDIA-smi Share Improvethisanswer Follow editedSep8,2020at8:02 SambbhavGarg 3977bronzebadges answeredJul5,2018at22:33 ShitalShahShitalShah 54.4k1212goldbadges213213silverbadges172172bronzebadges 5 1 youaretalkingaboutCUDASDK.maybethequestionwasonCUDAruntimeanddrivers-thenthiswontfit.(ormaybethequestionisaboutcomputecapability-butnotsureifthatisthecase.) – AlexanderStohr May16,2019at15:23 nvccisabinaryandwillreportitsversion.youcanhavemultipleversionssidetosideinserparatesubdirs./usr/local/cudaisanoptionalsymlinkanditsprobablyonlypresentiftheCUDASDKisinstalled. – AlexanderStohr May16,2019at15:24 1 @Lorenz-insomeinstancesIdidn'thadnvidia-smiinstalled.Also,whenyouaredebuggingitisgoodtoknowwherethingsare.IfyouwanttouninstallcudaonLinux,manytimesyouronlyoptionistomanuallyfindversionsanddeletethem.Also,noticethatanswercontainsCUDAaswellascuDNN,laterisnotshownbysmi.I'veupdatedanswertousenvidia-smijustincaseifyouronlyinterestistheversionnumberforCUDA. – ShitalShah Aug2,2020at5:01 Theaimwastoget@Mircea'scommentdeleted,Ididnotmeanyouranswer.Itwasnotmyintentiontogetnvidia-smimentionedinyouranswer.Itisalreadywrongtonamenvidia-smiatall!Itisnotananswertothequestionofthisthread.Ifyoudesparatelywanttonameit,youmustmakeclearthatitdoesnotshowtheinstalledversion,butonlythesupportedversion.Youranswer,asitisnow,doesnotmakethisclear,andisthuswronginthispoint. – questionto42standswithUkraine Aug3,2020at15:01 ForLinuxitwasactuallyincat/usr/local/cuda/include/cudnn_version.h|grepCUDNN_MAJOR-A2andforacondaenvironment:cat/opt/anaconda3/envs/tensorflow-gpu-2.6/include/cudnn_version.h|grepCUDNN_MAJOR-A2 – GabrielCretin Nov30,2021at10:45 Addacomment  |  32 UsethefollowingcommandtocheckCUDAinstallationbyConda: condalistcudatoolkit AndthefollowingcommandtocheckCUDNNversioninstalledbyconda: condalistcudnn Ifyouwanttoinstall/updateCUDAandCUDNNthroughCONDA,pleaseusethefollowingcommands: condainstall-canacondacudatoolkit condainstall-canacondacudnn AlternativelyyoucanusefollowingcommandstocheckCUDAinstallation: nvidia-smi OR nvcc--version Ifyouareusingtensorflow-gputhroughAnacondapackage(YoucanverifythisbysimplyopeningPythoninconsoleandcheckifthedefaultpythonshowsAnaconda,Inc.whenitstarts,oryoucanrunwhichpythonandcheckthelocation),thenmanuallyinstallingCUDAandCUDNNwillmostprobablynotwork.Youwillhavetoupdatethroughcondainstead. IfyouwanttoinstallCUDA,CUDNN,ortensorflow-gpumanually,youcancheckouttheinstructionsherehttps://www.tensorflow.org/install/gpu Share Improvethisanswer Follow answeredAug23,2019at5:59 SidKSidK 98088silverbadges99bronzebadges 4 4 nvidia-smidoesnotgiveyoutheinstalledversion,justthesupportedone,whichisofnouseforthequestion,[email protected]. – questionto42standswithUkraine Jul29,2020at21:20 1 nvcc--versionisnotworkinginanacondapromptifyouhavethecudatoolkitinstalledwithconda,anditisarepetitionoftheacceptedanswerifyoumeanitoutsideofanacondapromptforanon-condainstallation. – questionto42standswithUkraine Jul29,2020at21:22 Mindthatinconda,youshouldnotseparatelyinstallcudatoolkitifyouwanttoinstallitforpytorch.Havealookatstackoverflow.com/questions/53102436/…fordetails. – questionto42standswithUkraine Jul29,2020at21:25 1 Upvoteforhowtocheckifcudaisinstalledinanaconda. – questionto42standswithUkraine Jul29,2020at21:27 Addacomment  |  25 OnUbuntu: Try $cat/usr/local/cuda/version.txt or $cat/usr/local/cuda-8.0/version.txt Sometimesthefolderisnamed"Cuda-version". Ifnoneofaboveworks,trygoingto $/usr/local/ AndfindthecorrectnameofyourCudafolder. Outputshouldbesimilarto: CUDAVersion8.0.61 Share Improvethisanswer Follow answeredFeb12,2018at8:37 EmirHusicEmirHusic 71055silverbadges1414bronzebadges 1 thatsallaboutCUDASDK.itsnotaboutCUDAdrivers. – AlexanderStohr May16,2019at15:25 Addacomment  |  19 OtherrespondentshavealreadydescribedwhichcommandscanbeusedtochecktheCUDAversion.Here,I'lldescribehowtoturntheoutputofthosecommandsintoanenvironmentvariableoftheform"10.2","11.0",etc. Torecap,youcanuse nvcc--version tofindouttheCUDAversion. Ithinkthisshouldbeyourfirstportofcall. IfyouhavemultipleversionsofCUDAinstalled,thiscommandshouldprintouttheversionforthecopywhichishighestonyourPATH. Theoutputlookslikethis: nvcc:NVIDIA(R)Cudacompilerdriver Copyright(c)2005-2020NVIDIACorporation BuiltonThu_Jun_11_22:26:38_PDT_2020 Cudacompilationtools,release11.0,V11.0.194 Buildcuda_11.0_bu.TC445_37.28540450_0 WecanpassthisoutputthroughsedtopickoutjusttheMAJOR.MINORreleaseversionnumber. CUDA_VERSION=$(nvcc--version|sed-n's/^.*release\([0-9\.]\+\).*$/\1/p') Ifnvccisn'tonyourpath,youshouldbeabletorunitbyspecifyingthefullpathtothedefaultlocationofnvccinstead. /usr/local/cuda/bin/nvcc--version Theoutputofwhichisthesameasabove,anditcanbeparsedinthesameway. Alternatively,youcanfindtheCUDAversionfromtheversion.txtfile. cat/usr/local/cuda/version.txt Theoutputofwhich CUDAVersion10.1.243 canbeparsedusingsedtopickoutjusttheMAJOR.MINORreleaseversionnumber. CUDA_VERSION=$(cat/usr/local/cuda/version.txt|sed's/.*\([0-9]\+\.[0-9]\+\).*/\1/') Notethatsometimestheversion.txtfilereferstoadifferentCUDAinstallationthanthenvcc--version.Inthisscenario,thenvccversionshouldbetheversionyou'reactuallyusing. WecancombinethesethreemethodstogetherinordertorobustlygettheCUDAversionasfollows: ifnvcc--version2&>/dev/null;then #DetermineCUDAversionusingdefaultnvccbinary CUDA_VERSION=$(nvcc--version|sed-n's/^.*release\([0-9\.]\+\).*$/\1/p'); elif/usr/local/cuda/bin/nvcc--version2&>/dev/null;then #DetermineCUDAversionusing/usr/local/cuda/bin/nvccbinary CUDA_VERSION=$(/usr/local/cuda/bin/nvcc--version|sed-n's/^.*release\([0-9\.]\+\).*$/\1/p'); elif[-f"/usr/local/cuda/version.txt"];then #DetermineCUDAversionusing/usr/local/cuda/version.txtfile CUDA_VERSION=$(cat/usr/local/cuda/version.txt|sed's/.*\([0-9]\+\.[0-9]\+\).*/\1/') else CUDA_VERSION="" fi Thisenvironmentvariableisusefulfordownstreaminstallations,suchaswhenpipinstallingacopyofpytorchthatwascompiledforthecorrectCUDAversion. python-mpipinstall\ "torch==1.9.0+cu${CUDA_VERSION/./}"\ "torchvision==0.10.0+cu${CUDA_VERSION/./}"\ -fhttps://download.pytorch.org/whl/torch_stable.html Similarly,youcouldinstalltheCPUversionofpytorchwhenCUDAisnotinstalled. if["$CUDA_VERSION"=""];then MOD="+cpu"; echo"Warning:InstallingCPU-onlyversionofpytorch" else MOD="+cu${CUDA_VERSION/./}"; echo"Installingpytorchwith$MOD" fi python-mpipinstall\ "torch==1.9.0${MOD}"\ "torchvision==0.10.0${MOD}"\ -fhttps://download.pytorch.org/whl/torch_stable.html ButbecarefulwiththisbecauseyoucanaccidentallyinstallaCPU-onlyversionwhenyoumeanttohaveGPUsupport. Forexample,ifyouruntheinstallscriptonaserver'sloginnodewhichdoesn'thaveGPUsandyourjobswillbedeployedontonodeswhichdohaveGPUs.Inthiscase,theloginnodewilltypicallynothaveCUDAinstalled. Share Improvethisanswer Follow editedAug13,2021at8:56 answeredJul23,2021at12:30 scottclowescottclowe 1,4371313silverbadges1717bronzebadges Addacomment  |  13 IfyouhaveinstalledCUDASDK,youcanrun"deviceQuery"toseetheversionofCUDA Share Improvethisanswer Follow answeredMar15,2012at22:26 DanielDaniel 13944bronzebadges 1 6 Forthosewondering:deviceQueryisasampleprogramtobuild(Linux:runmakein/usr/local/cuda/samples,then./bin/x86_64/linux/release/deviceQuery). – Matthieu Sep29,2017at14:18 Addacomment  |  8 OnWindows10,Ifoundnvidia-smi.exein'C:\ProgramFiles\NVIDIACorporation\NVSMI';aftercdintothatfolder(wasnotinthePATHinmycase)and'.\nvidia-smi.exe'itshowed Share Improvethisanswer Follow answeredApr30,2021at8:03 StanislavKoncebovskiStanislavKoncebovski 14122silverbadges66bronzebadges 1 ThisdoesnotshowthecurrentlyinstalledCUDAversionbutonlythehighestcompatibleCUDAversionavailableforyourGPU.Seecommentstothisotheranswerstackoverflow.com/a/55717476/988591. – JfredoJ Jun19,2021at11:45 Addacomment  |  7 Onecangetthecudaversionbytypingthefollowingintheterminal: $nvcc-V #belowistheresult nvcc:NVIDIA(R)Cudacompilerdriver Copyright(c)2005-2017NVIDIACorporation BuiltonFri_Nov__3_21:07:56_CDT_2017 Cudacompilationtools,release9.1,V9.1.85 Alternatively,onecanmanuallycheckfortheversionbyfirstfindingouttheinstallationdirectoryusing: $whereis-bcuda cuda:/usr/local/cuda AndthencdintothatdirectoryandcheckfortheCUDAversion. Share Improvethisanswer Follow answeredMay24,2018at22:36 kmario23kmario23 48.9k1313goldbadges138138silverbadges140140bronzebadges Addacomment  |  7 IfyouhavePyTorchinstalled,youcansimplyrunthefollowingcodeinyourIDE: importtorch print(torch.version.cuda) Share Improvethisanswer Follow answeredApr23,2021at9:16 HexNeuralHexNeural 10122silverbadges66bronzebadges Addacomment  |  6 YoumightfindCUDA-Zuseful,hereisaquotefromtheirSite: "ThisprogramwasbornasaparodyofanotherZ-utilitiessuchasCPU-ZandGPU-Z.CUDA-ZshowssomebasicinformationaboutCUDA-enabledGPUsandGPGPUs.ItworkswithnVIDIAGeforce,QuadroandTeslacards,IONchipsets." http://cuda-z.sourceforge.net/ OntheSupportTabthereistheURLfortheSourceCode:http://sourceforge.net/p/cuda-z/code/andthedownloadisnotactuallyanInstallerbuttheExecutableitself(noinstallation,sothisis"quick"). ThisUtilityprovideslotsofinformationandifyouneedtoknowhowitwasderivedthereistheSourcetolookat.ThereareotherUtilitiessimilartothisthatyoumightsearchfor. Share Improvethisanswer Follow answeredNov16,2014at10:00 RobRob 1,42922goldbadges2323silverbadges2525bronzebadges 3 thisisaprogramfortheWindowsplatform.willitbeuseablefrominsideascript? – AlexanderStohr May16,2019at15:22 LookingatthevarioustabsIcouldn'tfindanyusefulinformationaboutCUDA. – JfredoJ Jun19,2021at11:42 It'sforLinux,Windows,andMac:sourceforge.net/p/cuda-z/code/HEAD/tree/qt-s-mini/4.8.6-checktheTrunkforthesource:sourceforge.net/p/cuda-z/code/HEAD/tree/trunk – Rob Jun19,2021at11:51 Addacomment  |  6 WehavethreewaystocheckVersion: Inmycasebelowistheoutput:- Way1:- cat/usr/local/cuda/version.txt Output:- CUDAVersion10.1.243 Way2:- nvcc--version Output:- nvcc:NVIDIA(R)Cudacompilerdriver Copyright(c)2005-2017NVIDIACorporation BuiltonFri_Nov__3_21:07:56_CDT_2017 Cudacompilationtools,release9.1,V9.1.85 Way3:- /usr/local/cuda/bin/nvcc--version Output:- nvcc:NVIDIA(R)Cudacompilerdriver Copyright(c)2005-2019NVIDIACorporation BuiltonSun_Jul_28_19:07:16_PDT_2019 Cudacompilationtools,release10.1,V10.1.243 Way4:- nvidia-smi NVIDIA-SMI450.36.06DriverVersion:450.36.06CUDAVersion:11.0 Outputsarenotsame.Don'tknowwhyit'shappening. Share Improvethisanswer Follow answeredJun11,2020at12:14 kamrankausarkamrankausar 3,3031919silverbadges1616bronzebadges 2 Way1nolongerworkswithCUDA11(oratleast11.2);pleasementionthat. – einpoklum Feb10,2021at17:55 Thisanswerismisleading.Downvoting. – CognitiveRobot May17,2021at3:17 Addacomment  |  4 FirstyoushouldfindwhereCudainstalled. Ifit'sadefaultinstallationlikeherethelocationshouldbe: forubuntu: /usr/local/cuda inthisfolderyoushouldhaveafile version.txt openthisfilewithanytexteditororrun: catversion.txt fromthefolder OR cat/usr/local/cuda/version.txt Share Improvethisanswer Follow answeredDec20,2017at18:20 ChaosPredictorChaosPredictor 3,15811goldbadge2828silverbadges3939bronzebadges Addacomment  |  3 AfterinstallingCUDAonecanchecktheversionsby:nvcc-V Ihaveinstalledboth5.0and5.5soitgives CudaCompilationTools,release5.5,V5.5,0 ThiscommandworksforbothWindowsandUbuntu. Share Improvethisanswer Follow answeredSep24,2013at5:12 BhavinPatelBhavinPatel 9677bronzebadges 1 1 nvccnotinstalled – KansaiRobot May1,2021at10:00 Addacomment  |  3 Apartfromtheonesmentionedabove,yourCUDAinstallationspath(ifnotchangedduringsetup)typicallycontainstheversionnumber doingawhichnvccshouldgivethepathandthatwillgiveyoutheversion PS:Thisisaquickanddirtyway,theaboveanswersaremoreelegantandwillresultintherightversionwithconsiderableeffort Share Improvethisanswer Follow editedMar11,2016at21:27 SandeepRajuPrabhakar 16.5k88goldbadges3434silverbadges4242bronzebadges answeredMay28,2014at14:50 SidharthN.KashyapSidharthN.Kashyap 30122silverbadges66bronzebadges 2 Getting/usr/bin/nvcc.nvcc--versionisthewaytogo. – ÍhorMé Apr21,2017at13:13 nvccisnotinstalled – KansaiRobot Oct6,2021at3:30 Addacomment  |  3 Ifyouarerunningonlinux: dpkg-l|grepcuda Share Improvethisanswer Follow editedMar4,2020at8:44 AliAzG 1,65322goldbadges1717silverbadges2727bronzebadges answeredAug1,2019at20:57 PidemPidem 25222silverbadges1212bronzebadges Addacomment  |  2 ifnvcc--versionisnotworkingforyouthenusecat/usr/local/cuda/version.txt Share Improvethisanswer Follow answeredFeb4,2019at22:29 NassimaNoufailNassimaNoufail 8922bronzebadges Addacomment  |  2 Openaterminalandrunthesecommands: cd/usr/local/cuda/samples/1_Utilities/deviceQuery sudomake ./deviceQuery YoucangettheinformationofCUDADriverversion,CUDARuntimeVersion,andalsodetailedinformationforGPU(s).Animageexampleoftheoutputfrommyendisasbelow. Youcanfindtheimagehere. Share Improvethisanswer Follow answeredFeb18,2021at0:40 XingangXingang 2111bronzebadge Addacomment  |  2 IfyouhavemultipleCUDAinstalled,theoneloadedinyoursystemisCUDAassociatedwith"nvcc".Therefore,"nvcc--version"showswhatyouwant. Share Improvethisanswer Follow answeredFeb10at21:10 WilliamTaoWilliamTao 3133bronzebadges Addacomment  |  1 iget/usr/local-nosuchfileordirectory.Thoughnvcc-Vgives nvcc:NVIDIA(R)Cudacompilerdriver Copyright(c)2005-2016NVIDIACorporation BuiltonSun_Sep__4_22:14:01_CDT_2016 Cudacompilationtools,release8.0,V8.0.44 Share Improvethisanswer Follow answeredJun26,2018at13:17 MikhailYudaevMikhailYudaev 2111silverbadge33bronzebadges Addacomment  |  1 Foundmineafter: whereiscuda at cuda:/usr/lib/cuda/usr/include/cuda.h with nvcc--version CUDAVersion9.1.85 Share Improvethisanswer Follow editedJun21,2020at20:01 answeredJun21,2020at19:55 VM47VM47 6166bronzebadges Addacomment  |  1 Youcouldalsouse: nvidia-smi|grep"CUDAVersion:" Toretrievetheexplicitline. Share Improvethisanswer Follow answeredFeb2,2021at14:44 Borja_042Borja_042 91011goldbadge1212silverbadges2222bronzebadges 2 Thismaynotgiveyouthecorrectversionsometimes.Pleasecheck@mwwebanswer.Thatgivestheactualinstalledversion.cat/usr/local/cuda/version.txt – bgth Nov9,2021at7:47 sawthesecommentsnumeroustime:thisimpliedabadwordingfornvidia-smi"CUDAVersion",couldanyonesuggestNvidiawhoeverwritethispieceofprogrametochangewordingto:"CUDAcompatibleversionupto:"thentherewillbenoconfusionanymore;) – PaulWang Mar3at19:07 Addacomment  |  1 ProgrammaticallywiththeCUDARuntimeAPIC++wrappers: autov1=cuda::version::maximum_supported_by_driver(); autov2=cuda::version::runtime(); Thisgivesyouacuda::version_tstructure,whichyoucancompareandalsoprint/streame.g.: if(v2<:version_t std::cerr share improvethisanswer follow editedaug25 answeredjan22 einpoklumeinpoklum canyousuggestawaytodothiswithoutcompilingc mar11 ok.iwashopingtoavoidinstallingthecudasdk mar12 ifound sep17 addacomment usingtensorflow: importtensorflowastf fromtensorflow.python.platformimportbuild_infoasbuild print tensorflowversion:2.4.0 cudaversion:11.0 cudnnversion:8 answeredoct20 roushanroushan youcanchecktheversionofcudausing nvcc-v oryoucanuse nvcc--version oryoucancheckthelocationofwherethecudaisusing whereiscuda andthendo catlocation editedapr8 davidbuck answeredapr8 samruddhichitnissamruddhichitnis ifthereisaversionmismatchbetweennvccandnvidia-smithendifferentversionsofcudaareusedasdriverandruntim eenvironemtn. toensuresameversionofcudadriversareusedwhatyouneedtodoistogetcudaonsystempath. firstrunwhereiscudaandfindthelocationofcudadriver. thengoto.bashrcandmodifythepathvariableandsetthedirectoryprecedenceorderofsearchusingvariable forinstance cuda: cudaisinstalledat vim exportpath="/usr/local/cuda/bin:${PATH}" andafterthislinesetthedirectorysearchpathas: exportld_library_path="/usr/local/cuda/lib64:${LD_LIBRARY_PATH}" thensavethe.bashrcfile.andrefreshitas: thiswillensureyouhavenvcc-vandnvidia-smitousethesameversionofdrivers. editeddec14 answereddec13 tanveertanveer onmycuda-11.6.0installation theinformationcanberetrievedasfollows: python-c answeredjan21at10:50 ognumognum youcouldalsotry: nvidia-smi-q whichoutputssomethinglike: cudaversion:11.1 answeredfeb16at19:37 thatisn feb24at15:01 onwindows11withcuda11.6.1 cat answeredfeb24at12:19 neele22neele22 whydidigetvoteddown feb24at21:05 youranswer thanksforcontributingananswertostackoverflow draftsaved draftdiscarded signuporlogin signupusinggoogle signupusingfacebook signupusingemailandpassword submit postasaguest name email required postyouranswer discard byclicking nottheansweryou theoverflowblog newdata:whatmakesdevelopershappyatwork aiandnanotechnologyareworkingtogethertosolvereal-worldproblems featuredonmeta whatgoesintositesponsorshipsonse stackexchangeq announcingana shouldweburninatethe newuserexperience:deepdiveintoourresearchonthestagingground askwizardfornewusersfeaturetestisnowlive linked howtoverifycudnninstallation howtogetthenvidiadriverversionfromthecommandline differentcudaversionsshownbynvccandnvidia-smi tensorflow:libcudart.so.7.5:cannotopensharedobjectfile:nosuchfileordirectory importerror:libcudnn.so.7:cannotopensharedobjectfile:nosuchfileordirectory howdoiinstallpytorch1.3.1withcudaenabled installgpuversiontensorflowwitholderversioncudaandcudnn pytorchcudawithanacondanotavailable whyaretorch.version.cudaanddevicequeryreportingdifferentversions icannotgettensorflow2.0toworkonmygpu seemorelinkedquestions related cudaincompatiblewithmygccversion atop-likeutilityformonitoringcudaactivityonagpu howdocudablocks opencvcan wheredidcudagetinstalledinmycomputer ubuntu16.04 howtofindcudaversioninubuntu hotnetworkquestions iscashstillneededinmaltaordidtheislandcompletelytransitiontocreditcards whyisreutersconsideredasanindependentandunbiasedpoliticalnewssource convertingogrgeometryaswktofpolygonfromfloattointegerinthewktstring whatweretheincentivesbehindwinword.conceptcomputervirus cantheearthbeseenfromthemoonwhenwehaveatotallunareclipseattheperigee caniadddoublecreamtomycakebatterinsteadofsourcream didelijahviolatethelawin1kings18:19-20 algorithmofautomaticee.imagevisualizationusedbymap.addlayer differencebetween isitimpolitetosendtheprofessorapre-writtenletterofrecommendationforapproval whydosomefidosecurityfobsusekeyboardemulationmode whatmeaningdoestheword isnon-digitalnecessarilyanalog ificastthebestowcursespellonmyself cannotbecomeringbecausedistributionlawdoesnothold truthvsknowledge lombokforsalesforceapex extractingnumberwithletterfromtheaddressstringinqgis howcanipreservebooks howtoshowhiddenfolders canahexbloodcasthexanddisguiseselfonthesameday howmanyholdstobeircurrent doineedaworkvisaorisanestaokforashorttriptotheus spatialjoinwithwhilecondition morehotquestions questionfeed subscribetorss tosubscribetothisrssfeed default yourprivacy acceptallcookies customizesettings>



請為這篇文章評分?