nvml.h 284 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606
  1. /*
  2. * Copyright 1993-2016 NVIDIA Corporation. All rights reserved.
  3. *
  4. * NOTICE TO USER:
  5. *
  6. * This source code is subject to NVIDIA ownership rights under U.S. and
  7. * international Copyright laws. Users and possessors of this source code
  8. * are hereby granted a nonexclusive, royalty-free license to use this code
  9. * in individual and commercial software.
  10. *
  11. * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE
  12. * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR
  13. * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH
  14. * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF
  15. * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
  16. * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL,
  17. * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
  18. * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  19. * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  20. * OR PERFORMANCE OF THIS SOURCE CODE.
  21. *
  22. * U.S. Government End Users. This source code is a "commercial item" as
  23. * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of
  24. * "commercial computer software" and "commercial computer software
  25. * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995)
  26. * and is provided to the U.S. Government only as a commercial end item.
  27. * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through
  28. * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the
  29. * source code with only those rights set forth herein.
  30. *
  31. * Any use of this source code in individual and commercial software must
  32. * include, in the user documentation and internal comments to the code,
  33. * the above Disclaimer and U.S. Government End Users Notice.
  34. */
  35. /*
  36. NVML API Reference
  37. The NVIDIA Management Library (NVML) is a C-based programmatic interface for monitoring and
  38. managing various states within NVIDIA Tesla &tm; GPUs. It is intended to be a platform for building
  39. 3rd party applications, and is also the underlying library for the NVIDIA-supported nvidia-smi
  40. tool. NVML is thread-safe so it is safe to make simultaneous NVML calls from multiple threads.
  41. API Documentation
  42. Supported platforms:
  43. - Windows: Windows Server 2008 R2 64bit, Windows Server 2012 R2 64bit, Windows 7 64bit, Windows 8 64bit, Windows 10 64bit
  44. - Linux: 32-bit and 64-bit
  45. - Hypervisors: Windows Server 2008R2/2012 Hyper-V 64bit, Citrix XenServer 6.2 SP1+, VMware ESX 5.1/5.5
  46. Supported products:
  47. - Full Support
  48. - All Tesla products, starting with the Fermi architecture
  49. - All Quadro products, starting with the Fermi architecture
  50. - All GRID products, starting with the Kepler architecture
  51. - Selected GeForce Titan products
  52. - Limited Support
  53. - All Geforce products, starting with the Fermi architecture
  54. The NVML library can be found at \%ProgramW6432\%\\"NVIDIA Corporation"\\NVSMI\\ on Windows. It is
  55. not be added to the system path by default. To dynamically link to NVML, add this path to the PATH
  56. environmental variable. To dynamically load NVML, call LoadLibrary with this path.
  57. On Linux the NVML library will be found on the standard library path. For 64 bit Linux, both the 32 bit
  58. and 64 bit NVML libraries will be installed.
  59. Online documentation for this library is available at http://docs.nvidia.com/deploy/nvml-api/index.html
  60. */
  61. #ifndef __nvml_nvml_h__
  62. #define __nvml_nvml_h__
  63. #ifdef __cplusplus
  64. extern "C" {
  65. #endif
  66. /*
  67. * On Windows, set up methods for DLL export
  68. * define NVML_STATIC_IMPORT when using nvml_loader library
  69. */
  70. #if defined _WINDOWS
  71. #if !defined NVML_STATIC_IMPORT
  72. #if defined NVML_LIB_EXPORT
  73. #define DECLDIR __declspec(dllexport)
  74. #else
  75. #define DECLDIR __declspec(dllimport)
  76. #endif
  77. #else
  78. #define DECLDIR
  79. #endif
  80. #else
  81. #define DECLDIR
  82. #endif
  83. /**
  84. * NVML API versioning support
  85. */
  86. #define NVML_API_VERSION 8
  87. #define NVML_API_VERSION_STR "8"
  88. #define nvmlInit nvmlInit_v2
  89. #define nvmlDeviceGetPciInfo nvmlDeviceGetPciInfo_v2
  90. #define nvmlDeviceGetCount nvmlDeviceGetCount_v2
  91. #define nvmlDeviceGetHandleByIndex nvmlDeviceGetHandleByIndex_v2
  92. #define nvmlDeviceGetHandleByPciBusId nvmlDeviceGetHandleByPciBusId_v2
  93. /***************************************************************************************************/
  94. /** @defgroup nvmlDeviceStructs Device Structs
  95. * @{
  96. */
  97. /***************************************************************************************************/
  98. /**
  99. * Special constant that some fields take when they are not available.
  100. * Used when only part of the struct is not available.
  101. *
  102. * Each structure explicitly states when to check for this value.
  103. */
  104. #define NVML_VALUE_NOT_AVAILABLE (-1)
  105. typedef struct nvmlDevice_st* nvmlDevice_t;
  106. /**
  107. * Buffer size guaranteed to be large enough for pci bus id
  108. */
  109. #define NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE 16
  110. /**
  111. * PCI information about a GPU device.
  112. */
  113. typedef struct nvmlPciInfo_st
  114. {
  115. char busId[NVML_DEVICE_PCI_BUS_ID_BUFFER_SIZE]; //!< The tuple domain:bus:device.function PCI identifier (&amp; NULL terminator)
  116. unsigned int domain; //!< The PCI domain on which the device's bus resides, 0 to 0xffff
  117. unsigned int bus; //!< The bus on which the device resides, 0 to 0xff
  118. unsigned int device; //!< The device's id on the bus, 0 to 31
  119. unsigned int pciDeviceId; //!< The combined 16-bit device id and 16-bit vendor id
  120. // Added in NVML 2.285 API
  121. unsigned int pciSubSystemId; //!< The 32-bit Sub System Device ID
  122. // NVIDIA reserved for internal use only
  123. unsigned int reserved0;
  124. unsigned int reserved1;
  125. unsigned int reserved2;
  126. unsigned int reserved3;
  127. } nvmlPciInfo_t;
  128. /**
  129. * Detailed ECC error counts for a device.
  130. *
  131. * @deprecated Different GPU families can have different memory error counters
  132. * See \ref nvmlDeviceGetMemoryErrorCounter
  133. */
  134. typedef struct nvmlEccErrorCounts_st
  135. {
  136. unsigned long long l1Cache; //!< L1 cache errors
  137. unsigned long long l2Cache; //!< L2 cache errors
  138. unsigned long long deviceMemory; //!< Device memory errors
  139. unsigned long long registerFile; //!< Register file errors
  140. } nvmlEccErrorCounts_t;
  141. /**
  142. * Utilization information for a device.
  143. * Each sample period may be between 1 second and 1/6 second, depending on the product being queried.
  144. */
  145. typedef struct nvmlUtilization_st
  146. {
  147. unsigned int gpu; //!< Percent of time over the past sample period during which one or more kernels was executing on the GPU
  148. unsigned int memory; //!< Percent of time over the past sample period during which global (device) memory was being read or written
  149. } nvmlUtilization_t;
  150. /**
  151. * Memory allocation information for a device.
  152. */
  153. typedef struct nvmlMemory_st
  154. {
  155. unsigned long long total; //!< Total installed FB memory (in bytes)
  156. unsigned long long free; //!< Unallocated FB memory (in bytes)
  157. unsigned long long used; //!< Allocated FB memory (in bytes). Note that the driver/GPU always sets aside a small amount of memory for bookkeeping
  158. } nvmlMemory_t;
  159. /**
  160. * BAR1 Memory allocation Information for a device
  161. */
  162. typedef struct nvmlBAR1Memory_st
  163. {
  164. unsigned long long bar1Total; //!< Total BAR1 Memory (in bytes)
  165. unsigned long long bar1Free; //!< Unallocated BAR1 Memory (in bytes)
  166. unsigned long long bar1Used; //!< Allocated Used Memory (in bytes)
  167. }nvmlBAR1Memory_t;
  168. /**
  169. * Information about running compute processes on the GPU
  170. */
  171. typedef struct nvmlProcessInfo_st
  172. {
  173. unsigned int pid; //!< Process ID
  174. unsigned long long usedGpuMemory; //!< Amount of used GPU memory in bytes.
  175. //! Under WDDM, \ref NVML_VALUE_NOT_AVAILABLE is always reported
  176. //! because Windows KMD manages all the memory and not the NVIDIA driver
  177. } nvmlProcessInfo_t;
  178. /**
  179. * Enum to represent type of bridge chip
  180. */
  181. typedef enum nvmlBridgeChipType_enum
  182. {
  183. NVML_BRIDGE_CHIP_PLX = 0,
  184. NVML_BRIDGE_CHIP_BRO4 = 1
  185. }nvmlBridgeChipType_t;
  186. /**
  187. * Maximum number of NvLink links supported
  188. */
  189. #define NVML_NVLINK_MAX_LINKS 6
  190. /**
  191. * Enum to represent the NvLink utilization counter packet units
  192. */
  193. typedef enum nvmlNvLinkUtilizationCountUnits_enum
  194. {
  195. NVML_NVLINK_COUNTER_UNIT_CYCLES = 0, // count by cycles
  196. NVML_NVLINK_COUNTER_UNIT_PACKETS = 1, // count by packets
  197. NVML_NVLINK_COUNTER_UNIT_BYTES = 2, // count by bytes
  198. // this must be last
  199. NVML_NVLINK_COUNTER_UNIT_COUNT
  200. } nvmlNvLinkUtilizationCountUnits_t;
  201. /**
  202. * Enum to represent the NvLink utilization counter packet types to count
  203. * ** this is ONLY applicable with the units as packets or bytes
  204. * ** as specified in \a nvmlNvLinkUtilizationCountUnits_t
  205. * ** all packet filter descriptions are target GPU centric
  206. * ** these can be "OR'd" together
  207. */
  208. typedef enum nvmlNvLinkUtilizationCountPktTypes_enum
  209. {
  210. NVML_NVLINK_COUNTER_PKTFILTER_NOP = 0x1, // no operation packets
  211. NVML_NVLINK_COUNTER_PKTFILTER_READ = 0x2, // read packets
  212. NVML_NVLINK_COUNTER_PKTFILTER_WRITE = 0x4, // write packets
  213. NVML_NVLINK_COUNTER_PKTFILTER_RATOM = 0x8, // reduction atomic requests
  214. NVML_NVLINK_COUNTER_PKTFILTER_NRATOM = 0x10, // non-reduction atomic requests
  215. NVML_NVLINK_COUNTER_PKTFILTER_FLUSH = 0x20, // flush requests
  216. NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA = 0x40, // responses with data
  217. NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA = 0x80, // responses without data
  218. NVML_NVLINK_COUNTER_PKTFILTER_ALL = 0xFF // all packets
  219. } nvmlNvLinkUtilizationCountPktTypes_t;
  220. /**
  221. * Struct to define the NVLINK counter controls
  222. */
  223. typedef struct nvmlNvLinkUtilizationControl_st
  224. {
  225. nvmlNvLinkUtilizationCountUnits_t units;
  226. nvmlNvLinkUtilizationCountPktTypes_t pktfilter;
  227. } nvmlNvLinkUtilizationControl_t;
  228. /**
  229. * Enum to represent NvLink queryable capabilities
  230. */
  231. typedef enum nvmlNvLinkCapability_enum
  232. {
  233. NVML_NVLINK_CAP_P2P_SUPPORTED = 0, // P2P over NVLink is supported
  234. NVML_NVLINK_CAP_SYSMEM_ACCESS = 1, // Access to system memory is supported
  235. NVML_NVLINK_CAP_P2P_ATOMICS = 2, // P2P atomics are supported
  236. NVML_NVLINK_CAP_SYSMEM_ATOMICS= 3, // System memory atomics are supported
  237. NVML_NVLINK_CAP_SLI_BRIDGE = 4, // SLI is supported over this link
  238. NVML_NVLINK_CAP_VALID = 5, // Link is supported on this device
  239. // should be last
  240. NVML_NVLINK_CAP_COUNT
  241. } nvmlNvLinkCapability_t;
  242. /**
  243. * Enum to represent NvLink queryable error counters
  244. */
  245. typedef enum nvmlNvLinkErrorCounter_enum
  246. {
  247. NVML_NVLINK_ERROR_DL_REPLAY = 0, // Data link transmit replay error counter
  248. NVML_NVLINK_ERROR_DL_RECOVERY = 1, // Data link transmit recovery error counter
  249. NVML_NVLINK_ERROR_DL_CRC_FLIT = 2, // Data link receive flow control digit CRC error counter
  250. NVML_NVLINK_ERROR_DL_CRC_DATA = 3, // Data link receive data CRC error counter
  251. // this must be last
  252. NVML_NVLINK_ERROR_COUNT
  253. } nvmlNvLinkErrorCounter_t;
  254. /**
  255. * Represents level relationships within a system between two GPUs
  256. * The enums are spaced to allow for future relationships
  257. */
  258. typedef enum nvmlGpuLevel_enum
  259. {
  260. NVML_TOPOLOGY_INTERNAL = 0, // e.g. Tesla K80
  261. NVML_TOPOLOGY_SINGLE = 10, // all devices that only need traverse a single PCIe switch
  262. NVML_TOPOLOGY_MULTIPLE = 20, // all devices that need not traverse a host bridge
  263. NVML_TOPOLOGY_HOSTBRIDGE = 30, // all devices that are connected to the same host bridge
  264. NVML_TOPOLOGY_CPU = 40, // all devices that are connected to the same CPU but possibly multiple host bridges
  265. NVML_TOPOLOGY_SYSTEM = 50, // all devices in the system
  266. // there is purposefully no COUNT here because of the need for spacing above
  267. } nvmlGpuTopologyLevel_t;
  268. /* P2P Capability Index Status*/
  269. typedef enum nvmlGpuP2PStatus_enum
  270. {
  271. NVML_P2P_STATUS_OK = 0,
  272. NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED,
  273. NVML_P2P_STATUS_GPU_NOT_SUPPORTED,
  274. NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED,
  275. NVML_P2P_STATUS_DISABLED_BY_REGKEY,
  276. NVML_P2P_STATUS_NOT_SUPPORTED,
  277. NVML_P2P_STATUS_UNKNOWN
  278. } nvmlGpuP2PStatus_t;
  279. /* P2P Capability Index*/
  280. typedef enum nvmlGpuP2PCapsIndex_enum
  281. {
  282. NVML_P2P_CAPS_INDEX_READ = 0,
  283. NVML_P2P_CAPS_INDEX_WRITE,
  284. NVML_P2P_CAPS_INDEX_NVLINK,
  285. NVML_P2P_CAPS_INDEX_ATOMICS,
  286. NVML_P2P_CAPS_INDEX_PROP,
  287. NVML_P2P_CAPS_INDEX_UNKNOWN
  288. }nvmlGpuP2PCapsIndex_t;
  289. /**
  290. * Maximum limit on Physical Bridges per Board
  291. */
  292. #define NVML_MAX_PHYSICAL_BRIDGE (128)
  293. /**
  294. * Information about the Bridge Chip Firmware
  295. */
  296. typedef struct nvmlBridgeChipInfo_st
  297. {
  298. nvmlBridgeChipType_t type; //!< Type of Bridge Chip
  299. unsigned int fwVersion; //!< Firmware Version. 0=Version is unavailable
  300. }nvmlBridgeChipInfo_t;
  301. /**
  302. * This structure stores the complete Hierarchy of the Bridge Chip within the board. The immediate
  303. * bridge is stored at index 0 of bridgeInfoList, parent to immediate bridge is at index 1 and so forth.
  304. */
  305. typedef struct nvmlBridgeChipHierarchy_st
  306. {
  307. unsigned char bridgeCount; //!< Number of Bridge Chips on the Board
  308. nvmlBridgeChipInfo_t bridgeChipInfo[NVML_MAX_PHYSICAL_BRIDGE]; //!< Hierarchy of Bridge Chips on the board
  309. }nvmlBridgeChipHierarchy_t;
  310. /**
  311. * Represents Type of Sampling Event
  312. */
  313. typedef enum nvmlSamplingType_enum
  314. {
  315. NVML_TOTAL_POWER_SAMPLES = 0, //!< To represent total power drawn by GPU
  316. NVML_GPU_UTILIZATION_SAMPLES = 1, //!< To represent percent of time during which one or more kernels was executing on the GPU
  317. NVML_MEMORY_UTILIZATION_SAMPLES = 2, //!< To represent percent of time during which global (device) memory was being read or written
  318. NVML_ENC_UTILIZATION_SAMPLES = 3, //!< To represent percent of time during which NVENC remains busy
  319. NVML_DEC_UTILIZATION_SAMPLES = 4, //!< To represent percent of time during which NVDEC remains busy
  320. NVML_PROCESSOR_CLK_SAMPLES = 5, //!< To represent processor clock samples
  321. NVML_MEMORY_CLK_SAMPLES = 6, //!< To represent memory clock samples
  322. // Keep this last
  323. NVML_SAMPLINGTYPE_COUNT
  324. }nvmlSamplingType_t;
  325. /**
  326. * Represents the queryable PCIe utilization counters
  327. */
  328. typedef enum nvmlPcieUtilCounter_enum
  329. {
  330. NVML_PCIE_UTIL_TX_BYTES = 0, // 1KB granularity
  331. NVML_PCIE_UTIL_RX_BYTES = 1, // 1KB granularity
  332. // Keep this last
  333. NVML_PCIE_UTIL_COUNT
  334. } nvmlPcieUtilCounter_t;
  335. /**
  336. * Represents the type for sample value returned
  337. */
  338. typedef enum nvmlValueType_enum
  339. {
  340. NVML_VALUE_TYPE_DOUBLE = 0,
  341. NVML_VALUE_TYPE_UNSIGNED_INT = 1,
  342. NVML_VALUE_TYPE_UNSIGNED_LONG = 2,
  343. NVML_VALUE_TYPE_UNSIGNED_LONG_LONG = 3,
  344. NVML_VALUE_TYPE_SIGNED_LONG_LONG = 4,
  345. // Keep this last
  346. NVML_VALUE_TYPE_COUNT
  347. }nvmlValueType_t;
  348. /**
  349. * Union to represent different types of Value
  350. */
  351. typedef union nvmlValue_st
  352. {
  353. double dVal; //!< If the value is double
  354. unsigned int uiVal; //!< If the value is unsigned int
  355. unsigned long ulVal; //!< If the value is unsigned long
  356. unsigned long long ullVal; //!< If the value is unsigned long long
  357. signed long long sllVal; //!< If the value is signed long long
  358. }nvmlValue_t;
  359. /**
  360. * Information for Sample
  361. */
  362. typedef struct nvmlSample_st
  363. {
  364. unsigned long long timeStamp; //!< CPU Timestamp in microseconds
  365. nvmlValue_t sampleValue; //!< Sample Value
  366. }nvmlSample_t;
  367. /**
  368. * Represents type of perf policy for which violation times can be queried
  369. */
  370. typedef enum nvmlPerfPolicyType_enum
  371. {
  372. NVML_PERF_POLICY_POWER = 0, //!< How long did power violations cause the GPU to be below application clocks
  373. NVML_PERF_POLICY_THERMAL = 1, //!< How long did thermal violations cause the GPU to be below application clocks
  374. NVML_PERF_POLICY_SYNC_BOOST = 2, //!< How long did sync boost cause the GPU to be below application clocks
  375. NVML_PERF_POLICY_BOARD_LIMIT = 3, //!< How long did the board limit cause the GPU to be below application clocks
  376. NVML_PERF_POLICY_LOW_UTILIZATION = 4, //!< How long did low utilization cause the GPU to be below application clocks
  377. NVML_PERF_POLICY_RELIABILITY = 5, //!< How long did the board reliability limit cause the GPU to be below application clocks
  378. NVML_PERF_POLICY_TOTAL_APP_CLOCKS = 10, //!< Total time the GPU was held below application clocks by any limiter (0 - 5 above)
  379. NVML_PERF_POLICY_TOTAL_BASE_CLOCKS = 11, //!< Total time the GPU was held below base clocks
  380. // Keep this last
  381. NVML_PERF_POLICY_COUNT
  382. }nvmlPerfPolicyType_t;
  383. /**
  384. * Struct to hold perf policy violation status data
  385. */
  386. typedef struct nvmlViolationTime_st
  387. {
  388. unsigned long long referenceTime; //!< referenceTime represents CPU timestamp in microseconds
  389. unsigned long long violationTime; //!< violationTime in Nanoseconds
  390. }nvmlViolationTime_t;
  391. /** @} */
  392. /***************************************************************************************************/
  393. /** @defgroup nvmlDeviceEnumvs Device Enums
  394. * @{
  395. */
  396. /***************************************************************************************************/
  397. /**
  398. * Generic enable/disable enum.
  399. */
  400. typedef enum nvmlEnableState_enum
  401. {
  402. NVML_FEATURE_DISABLED = 0, //!< Feature disabled
  403. NVML_FEATURE_ENABLED = 1 //!< Feature enabled
  404. } nvmlEnableState_t;
  405. //! Generic flag used to specify the default behavior of some functions. See description of particular functions for details.
  406. #define nvmlFlagDefault 0x00
  407. //! Generic flag used to force some behavior. See description of particular functions for details.
  408. #define nvmlFlagForce 0x01
  409. /**
  410. * * The Brand of the GPU
  411. * */
  412. typedef enum nvmlBrandType_enum
  413. {
  414. NVML_BRAND_UNKNOWN = 0,
  415. NVML_BRAND_QUADRO = 1,
  416. NVML_BRAND_TESLA = 2,
  417. NVML_BRAND_NVS = 3,
  418. NVML_BRAND_GRID = 4,
  419. NVML_BRAND_GEFORCE = 5,
  420. // Keep this last
  421. NVML_BRAND_COUNT
  422. } nvmlBrandType_t;
  423. /**
  424. * Temperature thresholds.
  425. */
  426. typedef enum nvmlTemperatureThresholds_enum
  427. {
  428. NVML_TEMPERATURE_THRESHOLD_SHUTDOWN = 0, // Temperature at which the GPU will shut down
  429. // for HW protection
  430. NVML_TEMPERATURE_THRESHOLD_SLOWDOWN = 1, // Temperature at which the GPU will begin slowdown
  431. // Keep this last
  432. NVML_TEMPERATURE_THRESHOLD_COUNT
  433. } nvmlTemperatureThresholds_t;
  434. /**
  435. * Temperature sensors.
  436. */
  437. typedef enum nvmlTemperatureSensors_enum
  438. {
  439. NVML_TEMPERATURE_GPU = 0, //!< Temperature sensor for the GPU die
  440. // Keep this last
  441. NVML_TEMPERATURE_COUNT
  442. } nvmlTemperatureSensors_t;
  443. /**
  444. * Compute mode.
  445. *
  446. * NVML_COMPUTEMODE_EXCLUSIVE_PROCESS was added in CUDA 4.0.
  447. * Earlier CUDA versions supported a single exclusive mode,
  448. * which is equivalent to NVML_COMPUTEMODE_EXCLUSIVE_THREAD in CUDA 4.0 and beyond.
  449. */
  450. typedef enum nvmlComputeMode_enum
  451. {
  452. NVML_COMPUTEMODE_DEFAULT = 0, //!< Default compute mode -- multiple contexts per device
  453. NVML_COMPUTEMODE_EXCLUSIVE_THREAD = 1, //!< Support Removed
  454. NVML_COMPUTEMODE_PROHIBITED = 2, //!< Compute-prohibited mode -- no contexts per device
  455. NVML_COMPUTEMODE_EXCLUSIVE_PROCESS = 3, //!< Compute-exclusive-process mode -- only one context per device, usable from multiple threads at a time
  456. // Keep this last
  457. NVML_COMPUTEMODE_COUNT
  458. } nvmlComputeMode_t;
  459. /**
  460. * ECC bit types.
  461. *
  462. * @deprecated See \ref nvmlMemoryErrorType_t for a more flexible type
  463. */
  464. #define nvmlEccBitType_t nvmlMemoryErrorType_t
  465. /**
  466. * Single bit ECC errors
  467. *
  468. * @deprecated Mapped to \ref NVML_MEMORY_ERROR_TYPE_CORRECTED
  469. */
  470. #define NVML_SINGLE_BIT_ECC NVML_MEMORY_ERROR_TYPE_CORRECTED
  471. /**
  472. * Double bit ECC errors
  473. *
  474. * @deprecated Mapped to \ref NVML_MEMORY_ERROR_TYPE_UNCORRECTED
  475. */
  476. #define NVML_DOUBLE_BIT_ECC NVML_MEMORY_ERROR_TYPE_UNCORRECTED
  477. /**
  478. * Memory error types
  479. */
  480. typedef enum nvmlMemoryErrorType_enum
  481. {
  482. /**
  483. * A memory error that was corrected
  484. *
  485. * For ECC errors, these are single bit errors
  486. * For Texture memory, these are errors fixed by resend
  487. */
  488. NVML_MEMORY_ERROR_TYPE_CORRECTED = 0,
  489. /**
  490. * A memory error that was not corrected
  491. *
  492. * For ECC errors, these are double bit errors
  493. * For Texture memory, these are errors where the resend fails
  494. */
  495. NVML_MEMORY_ERROR_TYPE_UNCORRECTED = 1,
  496. // Keep this last
  497. NVML_MEMORY_ERROR_TYPE_COUNT //!< Count of memory error types
  498. } nvmlMemoryErrorType_t;
  499. /**
  500. * ECC counter types.
  501. *
  502. * Note: Volatile counts are reset each time the driver loads. On Windows this is once per boot. On Linux this can be more frequent.
  503. * On Linux the driver unloads when no active clients exist. If persistence mode is enabled or there is always a driver
  504. * client active (e.g. X11), then Linux also sees per-boot behavior. If not, volatile counts are reset each time a compute app
  505. * is run.
  506. */
  507. typedef enum nvmlEccCounterType_enum
  508. {
  509. NVML_VOLATILE_ECC = 0, //!< Volatile counts are reset each time the driver loads.
  510. NVML_AGGREGATE_ECC = 1, //!< Aggregate counts persist across reboots (i.e. for the lifetime of the device)
  511. // Keep this last
  512. NVML_ECC_COUNTER_TYPE_COUNT //!< Count of memory counter types
  513. } nvmlEccCounterType_t;
  514. /**
  515. * Clock types.
  516. *
  517. * All speeds are in Mhz.
  518. */
  519. typedef enum nvmlClockType_enum
  520. {
  521. NVML_CLOCK_GRAPHICS = 0, //!< Graphics clock domain
  522. NVML_CLOCK_SM = 1, //!< SM clock domain
  523. NVML_CLOCK_MEM = 2, //!< Memory clock domain
  524. NVML_CLOCK_VIDEO = 3, //!< Video encoder/decoder clock domain
  525. // Keep this last
  526. NVML_CLOCK_COUNT //<! Count of clock types
  527. } nvmlClockType_t;
  528. /**
  529. * Clock Ids. These are used in combination with nvmlClockType_t
  530. * to specify a single clock value.
  531. */
  532. typedef enum nvmlClockId_enum
  533. {
  534. NVML_CLOCK_ID_CURRENT = 0, //!< Current actual clock value
  535. NVML_CLOCK_ID_APP_CLOCK_TARGET = 1, //!< Target application clock
  536. NVML_CLOCK_ID_APP_CLOCK_DEFAULT = 2, //!< Default application clock target
  537. NVML_CLOCK_ID_CUSTOMER_BOOST_MAX = 3, //!< OEM-defined maximum clock rate
  538. //Keep this last
  539. NVML_CLOCK_ID_COUNT //<! Count of Clock Ids.
  540. } nvmlClockId_t;
  541. /**
  542. * Driver models.
  543. *
  544. * Windows only.
  545. */
  546. typedef enum nvmlDriverModel_enum
  547. {
  548. NVML_DRIVER_WDDM = 0, //!< WDDM driver model -- GPU treated as a display device
  549. NVML_DRIVER_WDM = 1 //!< WDM (TCC) model (recommended) -- GPU treated as a generic device
  550. } nvmlDriverModel_t;
  551. /**
  552. * Allowed PStates.
  553. */
  554. typedef enum nvmlPStates_enum
  555. {
  556. NVML_PSTATE_0 = 0, //!< Performance state 0 -- Maximum Performance
  557. NVML_PSTATE_1 = 1, //!< Performance state 1
  558. NVML_PSTATE_2 = 2, //!< Performance state 2
  559. NVML_PSTATE_3 = 3, //!< Performance state 3
  560. NVML_PSTATE_4 = 4, //!< Performance state 4
  561. NVML_PSTATE_5 = 5, //!< Performance state 5
  562. NVML_PSTATE_6 = 6, //!< Performance state 6
  563. NVML_PSTATE_7 = 7, //!< Performance state 7
  564. NVML_PSTATE_8 = 8, //!< Performance state 8
  565. NVML_PSTATE_9 = 9, //!< Performance state 9
  566. NVML_PSTATE_10 = 10, //!< Performance state 10
  567. NVML_PSTATE_11 = 11, //!< Performance state 11
  568. NVML_PSTATE_12 = 12, //!< Performance state 12
  569. NVML_PSTATE_13 = 13, //!< Performance state 13
  570. NVML_PSTATE_14 = 14, //!< Performance state 14
  571. NVML_PSTATE_15 = 15, //!< Performance state 15 -- Minimum Performance
  572. NVML_PSTATE_UNKNOWN = 32 //!< Unknown performance state
  573. } nvmlPstates_t;
  574. /**
  575. * GPU Operation Mode
  576. *
  577. * GOM allows to reduce power usage and optimize GPU throughput by disabling GPU features.
  578. *
  579. * Each GOM is designed to meet specific user needs.
  580. */
  581. typedef enum nvmlGom_enum
  582. {
  583. NVML_GOM_ALL_ON = 0, //!< Everything is enabled and running at full speed
  584. NVML_GOM_COMPUTE = 1, //!< Designed for running only compute tasks. Graphics operations
  585. //!< are not allowed
  586. NVML_GOM_LOW_DP = 2 //!< Designed for running graphics applications that don't require
  587. //!< high bandwidth double precision
  588. } nvmlGpuOperationMode_t;
  589. /**
  590. * Available infoROM objects.
  591. */
  592. typedef enum nvmlInforomObject_enum
  593. {
  594. NVML_INFOROM_OEM = 0, //!< An object defined by OEM
  595. NVML_INFOROM_ECC = 1, //!< The ECC object determining the level of ECC support
  596. NVML_INFOROM_POWER = 2, //!< The power management object
  597. // Keep this last
  598. NVML_INFOROM_COUNT //!< This counts the number of infoROM objects the driver knows about
  599. } nvmlInforomObject_t;
  600. /**
  601. * Return values for NVML API calls.
  602. */
  603. typedef enum nvmlReturn_enum
  604. {
  605. NVML_SUCCESS = 0, //!< The operation was successful
  606. NVML_ERROR_UNINITIALIZED = 1, //!< NVML was not first initialized with nvmlInit()
  607. NVML_ERROR_INVALID_ARGUMENT = 2, //!< A supplied argument is invalid
  608. NVML_ERROR_NOT_SUPPORTED = 3, //!< The requested operation is not available on target device
  609. NVML_ERROR_NO_PERMISSION = 4, //!< The current user does not have permission for operation
  610. NVML_ERROR_ALREADY_INITIALIZED = 5, //!< Deprecated: Multiple initializations are now allowed through ref counting
  611. NVML_ERROR_NOT_FOUND = 6, //!< A query to find an object was unsuccessful
  612. NVML_ERROR_INSUFFICIENT_SIZE = 7, //!< An input argument is not large enough
  613. NVML_ERROR_INSUFFICIENT_POWER = 8, //!< A device's external power cables are not properly attached
  614. NVML_ERROR_DRIVER_NOT_LOADED = 9, //!< NVIDIA driver is not loaded
  615. NVML_ERROR_TIMEOUT = 10, //!< User provided timeout passed
  616. NVML_ERROR_IRQ_ISSUE = 11, //!< NVIDIA Kernel detected an interrupt issue with a GPU
  617. NVML_ERROR_LIBRARY_NOT_FOUND = 12, //!< NVML Shared Library couldn't be found or loaded
  618. NVML_ERROR_FUNCTION_NOT_FOUND = 13, //!< Local version of NVML doesn't implement this function
  619. NVML_ERROR_CORRUPTED_INFOROM = 14, //!< infoROM is corrupted
  620. NVML_ERROR_GPU_IS_LOST = 15, //!< The GPU has fallen off the bus or has otherwise become inaccessible
  621. NVML_ERROR_RESET_REQUIRED = 16, //!< The GPU requires a reset before it can be used again
  622. NVML_ERROR_OPERATING_SYSTEM = 17, //!< The GPU control device has been blocked by the operating system/cgroups
  623. NVML_ERROR_LIB_RM_VERSION_MISMATCH = 18, //!< RM detects a driver/library version mismatch
  624. NVML_ERROR_IN_USE = 19, //!< An operation cannot be performed because the GPU is currently in use
  625. NVML_ERROR_MEMORY = 20, //!< Insufficient memory
  626. NVML_ERROR_NO_DATA = 21, //!<No data
  627. NVML_ERROR_VGPU_ECC_NOT_SUPPORTED = 22, //!< The requested vgpu operation is not available on target device, becasue ECC is enabled
  628. NVML_ERROR_UNKNOWN = 999 //!< An internal driver error occurred
  629. } nvmlReturn_t;
  630. /**
  631. * Memory locations
  632. *
  633. * See \ref nvmlDeviceGetMemoryErrorCounter
  634. */
  635. typedef enum nvmlMemoryLocation_enum
  636. {
  637. NVML_MEMORY_LOCATION_L1_CACHE = 0, //!< GPU L1 Cache
  638. NVML_MEMORY_LOCATION_L2_CACHE = 1, //!< GPU L2 Cache
  639. NVML_MEMORY_LOCATION_DEVICE_MEMORY = 2, //!< GPU Device Memory
  640. NVML_MEMORY_LOCATION_REGISTER_FILE = 3, //!< GPU Register File
  641. NVML_MEMORY_LOCATION_TEXTURE_MEMORY = 4, //!< GPU Texture Memory
  642. NVML_MEMORY_LOCATION_TEXTURE_SHM = 5, //!< Shared memory
  643. NVML_MEMORY_LOCATION_CBU = 6, //!< CBU
  644. // Keep this last
  645. NVML_MEMORY_LOCATION_COUNT //!< This counts the number of memory locations the driver knows about
  646. } nvmlMemoryLocation_t;
  647. /**
  648. * Causes for page retirement
  649. */
  650. typedef enum nvmlPageRetirementCause_enum
  651. {
  652. NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS = 0, //!< Page was retired due to multiple single bit ECC error
  653. NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR = 1, //!< Page was retired due to double bit ECC error
  654. // Keep this last
  655. NVML_PAGE_RETIREMENT_CAUSE_COUNT
  656. } nvmlPageRetirementCause_t;
  657. /**
  658. * API types that allow changes to default permission restrictions
  659. */
  660. typedef enum nvmlRestrictedAPI_enum
  661. {
  662. NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS = 0, //!< APIs that change application clocks, see nvmlDeviceSetApplicationsClocks
  663. //!< and see nvmlDeviceResetApplicationsClocks
  664. NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS = 1, //!< APIs that enable/disable Auto Boosted clocks
  665. //!< see nvmlDeviceSetAutoBoostedClocksEnabled
  666. // Keep this last
  667. NVML_RESTRICTED_API_COUNT
  668. } nvmlRestrictedAPI_t;
  669. /** @} */
  670. /***************************************************************************************************/
  671. /** @defgroup nvmlGridEnums GRID Enums
  672. * @{
  673. */
  674. /***************************************************************************************************/
  675. /*!
  676. * GPU virtualization mode types.
  677. */
  678. typedef enum nvmlGpuVirtualizationMode {
  679. NVML_GPU_VIRTUALIZATION_MODE_NONE = 0, //!< Represents Bare Metal GPU
  680. NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH = 1, //!< Device is associated with GPU-Passthorugh
  681. NVML_GPU_VIRTUALIZATION_MODE_VGPU = 2, //!< Device is associated with vGPU inside virtual machine.
  682. NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU = 3, //!< Device is associated with VGX hypervisor in vGPU mode
  683. NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA = 4, //!< Device is associated with VGX hypervisor in vSGA mode
  684. } nvmlGpuVirtualizationMode_t;
  685. /** @} */
  686. /***************************************************************************************************/
  687. /** @defgroup nvmlFieldValueEnums Field Value Enums
  688. * @{
  689. */
  690. /***************************************************************************************************/
  691. /**
  692. * Field Identifiers.
  693. *
  694. * All Identifiers pertain to a device. Each ID is only used once and is guaranteed never to change.
  695. */
  696. #define NVML_FI_DEV_ECC_CURRENT 1 //!< Current ECC mode. 1=Active. 0=Inactive
  697. #define NVML_FI_DEV_ECC_PENDING 2 //!< Pending ECC mode. 1=Active. 0=Inactive
  698. /* ECC Count Totals */
  699. #define NVML_FI_DEV_ECC_SBE_VOL_TOTAL 3 //!< Total single bit volatile ECC errors
  700. #define NVML_FI_DEV_ECC_DBE_VOL_TOTAL 4 //!< Total double bit volatile ECC errors
  701. #define NVML_FI_DEV_ECC_SBE_AGG_TOTAL 5 //!< Total single bit aggregate (persistent) ECC errors
  702. #define NVML_FI_DEV_ECC_DBE_AGG_TOTAL 6 //!< Total double bit aggregate (persistent) ECC errors
  703. /* Individual ECC locations */
  704. #define NVML_FI_DEV_ECC_SBE_VOL_L1 7 //!< L1 cache single bit volatile ECC errors
  705. #define NVML_FI_DEV_ECC_DBE_VOL_L1 8 //!< L1 cache double bit volatile ECC errors
  706. #define NVML_FI_DEV_ECC_SBE_VOL_L2 9 //!< L2 cache single bit volatile ECC errors
  707. #define NVML_FI_DEV_ECC_DBE_VOL_L2 10 //!< L2 cache double bit volatile ECC errors
  708. #define NVML_FI_DEV_ECC_SBE_VOL_DEV 11 //!< Device memory single bit volatile ECC errors
  709. #define NVML_FI_DEV_ECC_DBE_VOL_DEV 12 //!< Device memory double bit volatile ECC errors
  710. #define NVML_FI_DEV_ECC_SBE_VOL_REG 13 //!< Register file single bit volatile ECC errors
  711. #define NVML_FI_DEV_ECC_DBE_VOL_REG 14 //!< Register file double bit volatile ECC errors
  712. #define NVML_FI_DEV_ECC_SBE_VOL_TEX 15 //!< Texture memory single bit volatile ECC errors
  713. #define NVML_FI_DEV_ECC_DBE_VOL_TEX 16 //!< Texture memory double bit volatile ECC errors
  714. #define NVML_FI_DEV_ECC_DBE_VOL_CBU 17 //!< CBU double bit volatile ECC errors
  715. #define NVML_FI_DEV_ECC_SBE_AGG_L1 18 //!< L1 cache single bit aggregate (persistent) ECC errors
  716. #define NVML_FI_DEV_ECC_DBE_AGG_L1 19 //!< L1 cache double bit aggregate (persistent) ECC errors
  717. #define NVML_FI_DEV_ECC_SBE_AGG_L2 20 //!< L2 cache single bit aggregate (persistent) ECC errors
  718. #define NVML_FI_DEV_ECC_DBE_AGG_L2 21 //!< L2 cache double bit aggregate (persistent) ECC errors
  719. #define NVML_FI_DEV_ECC_SBE_AGG_DEV 22 //!< Device memory single bit aggregate (persistent) ECC errors
  720. #define NVML_FI_DEV_ECC_DBE_AGG_DEV 23 //!< Device memory double bit aggregate (persistent) ECC errors
  721. #define NVML_FI_DEV_ECC_SBE_AGG_REG 24 //!< Register File single bit aggregate (persistent) ECC errors
  722. #define NVML_FI_DEV_ECC_DBE_AGG_REG 25 //!< Register File double bit aggregate (persistent) ECC errors
  723. #define NVML_FI_DEV_ECC_SBE_AGG_TEX 26 //!< Texture memory single bit aggregate (persistent) ECC errors
  724. #define NVML_FI_DEV_ECC_DBE_AGG_TEX 27 //!< Texture memory double bit aggregate (persistent) ECC errors
  725. #define NVML_FI_DEV_ECC_DBE_AGG_CBU 28 //!< CBU double bit aggregate ECC errors
  726. /* Page Retirement */
  727. #define NVML_FI_DEV_RETIRED_SBE 29 //!< Number of retired pages because of single bit errors
  728. #define NVML_FI_DEV_RETIRED_DBE 30 //!< Number of retired pages because of double bit errors
  729. #define NVML_FI_DEV_RETIRED_PENDING 31 //!< If any pages are pending retirement. 1=yes. 0=no.
  730. /* NvLink Flit Error Counters */
  731. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L0 32 //!< NVLink flow control CRC Error Counter for Lane 0
  732. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L1 33 //!< NVLink flow control CRC Error Counter for Lane 1
  733. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L2 34 //!< NVLink flow control CRC Error Counter for Lane 2
  734. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L3 35 //!< NVLink flow control CRC Error Counter for Lane 3
  735. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L4 36 //!< NVLink flow control CRC Error Counter for Lane 4
  736. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L5 37 //!< NVLink flow control CRC Error Counter for Lane 5
  737. #define NVML_FI_DEV_NVLINK_CRC_FLIT_ERROR_COUNT_TOTAL 38 //!< NVLink flow control CRC Error Counter total for all Lanes
  738. /* NvLink CRC Data Error Counters */
  739. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L0 39 //!< NVLink data CRC Error Counter for Lane 0
  740. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L1 40 //!< NVLink data CRC Error Counter for Lane 1
  741. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L2 41 //!< NVLink data CRC Error Counter for Lane 2
  742. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L3 42 //!< NVLink data CRC Error Counter for Lane 3
  743. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L4 43 //!< NVLink data CRC Error Counter for Lane 4
  744. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_L5 44 //!< NVLink data CRC Error Counter for Lane 5
  745. #define NVML_FI_DEV_NVLINK_CRC_DATA_ERROR_COUNT_TOTAL 45 //!< NvLink data CRC Error Counter total for all Lanes
  746. /* NvLink Replay Error Counters */
  747. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L0 46 //!< NVLink Replay Error Counter for Lane 0
  748. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L1 47 //!< NVLink Replay Error Counter for Lane 1
  749. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L2 48 //!< NVLink Replay Error Counter for Lane 2
  750. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L3 49 //!< NVLink Replay Error Counter for Lane 3
  751. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L4 50 //!< NVLink Replay Error Counter for Lane 4
  752. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_L5 51 //!< NVLink Replay Error Counter for Lane 5
  753. #define NVML_FI_DEV_NVLINK_REPLAY_ERROR_COUNT_TOTAL 52 //!< NVLink Replay Error Counter total for all Lanes
  754. /* NvLink Recovery Error Counters */
  755. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L0 53 //!< NVLink Recovery Error Counter for Lane 0
  756. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L1 54 //!< NVLink Recovery Error Counter for Lane 1
  757. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L2 55 //!< NVLink Recovery Error Counter for Lane 2
  758. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L3 56 //!< NVLink Recovery Error Counter for Lane 3
  759. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L4 57 //!< NVLink Recovery Error Counter for Lane 4
  760. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_L5 58 //!< NVLink Recovery Error Counter for Lane 5
  761. #define NVML_FI_DEV_NVLINK_RECOVERY_ERROR_COUNT_TOTAL 59 //!< NVLink Recovery Error Counter total for all Lanes
  762. /* NvLink Bandwidth Counters */
  763. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L0 60 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 0
  764. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L1 61 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 1
  765. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L2 62 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 2
  766. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L3 63 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 3
  767. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L4 64 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 4
  768. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_L5 65 //!< NVLink Bandwidth Counter for Counter Set 0, Lane 5
  769. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C0_TOTAL 66 //!< NVLink Bandwidth Counter Total for Counter Set 0, All Lanes
  770. /* NvLink Bandwidth Counters */
  771. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L0 67 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 0
  772. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L1 68 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 1
  773. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L2 69 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 2
  774. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L3 70 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 3
  775. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L4 71 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 4
  776. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_L5 72 //!< NVLink Bandwidth Counter for Counter Set 1, Lane 5
  777. #define NVML_FI_DEV_NVLINK_BANDWIDTH_C1_TOTAL 73 //!< NVLink Bandwidth Counter Total for Counter Set 1, All Lanes
  778. /* NVML Perf Policy Counters */
  779. #define NVML_FI_DEV_PERF_POLICY_POWER 74 //!< Perf Policy Counter for Power Policy
  780. #define NVML_FI_DEV_PERF_POLICY_THERMAL 75 //!< Perf Policy Counter for Thermal Policy
  781. #define NVML_FI_DEV_PERF_POLICY_SYNC_BOOST 76 //!< Perf Policy Counter for Sync boost Policy
  782. #define NVML_FI_DEV_PERF_POLICY_BOARD_LIMIT 77 //!< Perf Policy Counter for Board Limit
  783. #define NVML_FI_DEV_PERF_POLICY_LOW_UTILIZATION 78 //!< Perf Policy Counter for Low GPU Utilization Policy
  784. #define NVML_FI_DEV_PERF_POLICY_RELIABILITY 79 //!< Perf Policy Counter for Reliability Policy
  785. #define NVML_FI_DEV_PERF_POLICY_TOTAL_APP_CLOCKS 80 //!< Perf Policy Counter for Total App Clock Policy
  786. #define NVML_FI_DEV_PERF_POLICY_TOTAL_BASE_CLOCKS 81 //!< Perf Policy Counter for Total Base Clocks Policy
  787. /* Memory temperatures */
  788. #define NVML_FI_DEV_MEMORY_TEMP 82 //!< Memory temperature for the device
  789. #define NVML_FI_MAX 83 //!< One greater than the largest field ID defined above
  790. /**
  791. * Information for a Field Value Sample
  792. */
  793. typedef struct nvmlFieldValue_st
  794. {
  795. unsigned int fieldId; //!< ID of the NVML field to retrieve. This must be set before any call that uses this struct. See the constants starting with NVML_FI_ above.
  796. unsigned int unused; //!< Currently unused. This should be initialized to 0 by the caller before any API call
  797. long long timestamp; //!< CPU Timestamp of this value in microseconds since 1970
  798. long long latencyUsec; //!< How long this field value took to update (in usec) within NVML. This may be averaged across several fields that are serviced by the same driver call.
  799. nvmlValueType_t valueType; //!< Type of the value stored in value
  800. nvmlReturn_t nvmlReturn; //!< Return code for retrieving this value. This must be checked before looking at value, as value is undefined if nvmlReturn != NVML_SUCCESS
  801. nvmlValue_t value; //!< Value for this field. This is only valid if nvmlReturn == NVML_SUCCESS
  802. } nvmlFieldValue_t;
  803. /** @} */
  804. /***************************************************************************************************/
  805. /** @defgroup nvmlUnitStructs Unit Structs
  806. * @{
  807. */
  808. /***************************************************************************************************/
  809. typedef struct nvmlUnit_st* nvmlUnit_t;
  810. /**
  811. * Description of HWBC entry
  812. */
  813. typedef struct nvmlHwbcEntry_st
  814. {
  815. unsigned int hwbcId;
  816. char firmwareVersion[32];
  817. } nvmlHwbcEntry_t;
  818. /**
  819. * Fan state enum.
  820. */
  821. typedef enum nvmlFanState_enum
  822. {
  823. NVML_FAN_NORMAL = 0, //!< Fan is working properly
  824. NVML_FAN_FAILED = 1 //!< Fan has failed
  825. } nvmlFanState_t;
  826. /**
  827. * Led color enum.
  828. */
  829. typedef enum nvmlLedColor_enum
  830. {
  831. NVML_LED_COLOR_GREEN = 0, //!< GREEN, indicates good health
  832. NVML_LED_COLOR_AMBER = 1 //!< AMBER, indicates problem
  833. } nvmlLedColor_t;
  834. /**
  835. * LED states for an S-class unit.
  836. */
  837. typedef struct nvmlLedState_st
  838. {
  839. char cause[256]; //!< If amber, a text description of the cause
  840. nvmlLedColor_t color; //!< GREEN or AMBER
  841. } nvmlLedState_t;
  842. /**
  843. * Static S-class unit info.
  844. */
  845. typedef struct nvmlUnitInfo_st
  846. {
  847. char name[96]; //!< Product name
  848. char id[96]; //!< Product identifier
  849. char serial[96]; //!< Product serial number
  850. char firmwareVersion[96]; //!< Firmware version
  851. } nvmlUnitInfo_t;
  852. /**
  853. * Power usage information for an S-class unit.
  854. * The power supply state is a human readable string that equals "Normal" or contains
  855. * a combination of "Abnormal" plus one or more of the following:
  856. *
  857. * - High voltage
  858. * - Fan failure
  859. * - Heatsink temperature
  860. * - Current limit
  861. * - Voltage below UV alarm threshold
  862. * - Low-voltage
  863. * - SI2C remote off command
  864. * - MOD_DISABLE input
  865. * - Short pin transition
  866. */
  867. typedef struct nvmlPSUInfo_st
  868. {
  869. char state[256]; //!< The power supply state
  870. unsigned int current; //!< PSU current (A)
  871. unsigned int voltage; //!< PSU voltage (V)
  872. unsigned int power; //!< PSU power draw (W)
  873. } nvmlPSUInfo_t;
  874. /**
  875. * Fan speed reading for a single fan in an S-class unit.
  876. */
  877. typedef struct nvmlUnitFanInfo_st
  878. {
  879. unsigned int speed; //!< Fan speed (RPM)
  880. nvmlFanState_t state; //!< Flag that indicates whether fan is working properly
  881. } nvmlUnitFanInfo_t;
  882. /**
  883. * Fan speed readings for an entire S-class unit.
  884. */
  885. typedef struct nvmlUnitFanSpeeds_st
  886. {
  887. nvmlUnitFanInfo_t fans[24]; //!< Fan speed data for each fan
  888. unsigned int count; //!< Number of fans in unit
  889. } nvmlUnitFanSpeeds_t;
  890. /** @} */
  891. /***************************************************************************************************/
  892. /** @addtogroup nvmlEvents
  893. * @{
  894. */
  895. /***************************************************************************************************/
  896. /**
  897. * Handle to an event set
  898. */
  899. typedef struct nvmlEventSet_st* nvmlEventSet_t;
  900. /** @defgroup nvmlEventType Event Types
  901. * @{
  902. * Event Types which user can be notified about.
  903. * See description of particular functions for details.
  904. *
  905. * See \ref nvmlDeviceRegisterEvents and \ref nvmlDeviceGetSupportedEventTypes to check which devices
  906. * support each event.
  907. *
  908. * Types can be combined with bitwise or operator '|' when passed to \ref nvmlDeviceRegisterEvents
  909. */
  910. //! Event about single bit ECC errors
  911. /**
  912. * \note A corrected texture memory error is not an ECC error, so it does not generate a single bit event
  913. */
  914. #define nvmlEventTypeSingleBitEccError 0x0000000000000001LL
  915. //! Event about double bit ECC errors
  916. /**
  917. * \note An uncorrected texture memory error is not an ECC error, so it does not generate a double bit event
  918. */
  919. #define nvmlEventTypeDoubleBitEccError 0x0000000000000002LL
  920. //! Event about PState changes
  921. /**
  922. * \note On Fermi architecture PState changes are also an indicator that GPU is throttling down due to
  923. * no work being executed on the GPU, power capping or thermal capping. In a typical situation,
  924. * Fermi-based GPU should stay in P0 for the duration of the execution of the compute process.
  925. */
  926. #define nvmlEventTypePState 0x0000000000000004LL
  927. //! Event that Xid critical error occurred
  928. #define nvmlEventTypeXidCriticalError 0x0000000000000008LL
  929. //! Event about clock changes
  930. /**
  931. * Kepler only
  932. */
  933. #define nvmlEventTypeClock 0x0000000000000010LL
  934. //! Mask with no events
  935. #define nvmlEventTypeNone 0x0000000000000000LL
  936. //! Mask of all events
  937. #define nvmlEventTypeAll (nvmlEventTypeNone \
  938. | nvmlEventTypeSingleBitEccError \
  939. | nvmlEventTypeDoubleBitEccError \
  940. | nvmlEventTypePState \
  941. | nvmlEventTypeClock \
  942. | nvmlEventTypeXidCriticalError \
  943. )
  944. /** @} */
  945. /**
  946. * Information about occurred event
  947. */
  948. typedef struct nvmlEventData_st
  949. {
  950. nvmlDevice_t device; //!< Specific device where the event occurred
  951. unsigned long long eventType; //!< Information about what specific event occurred
  952. unsigned long long eventData; //!< Stores last XID error for the device in the event of nvmlEventTypeXidCriticalError,
  953. // eventData is 0 for any other event. eventData is set as 999 for unknown xid error.
  954. } nvmlEventData_t;
  955. /** @} */
  956. /***************************************************************************************************/
  957. /** @addtogroup nvmlClocksThrottleReasons
  958. * @{
  959. */
  960. /***************************************************************************************************/
  961. /** Nothing is running on the GPU and the clocks are dropping to Idle state
  962. * \note This limiter may be removed in a later release
  963. */
  964. #define nvmlClocksThrottleReasonGpuIdle 0x0000000000000001LL
  965. /** GPU clocks are limited by current setting of applications clocks
  966. *
  967. * @see nvmlDeviceSetApplicationsClocks
  968. * @see nvmlDeviceGetApplicationsClock
  969. */
  970. #define nvmlClocksThrottleReasonApplicationsClocksSetting 0x0000000000000002LL
  971. /**
  972. * @deprecated Renamed to \ref nvmlClocksThrottleReasonApplicationsClocksSetting
  973. * as the name describes the situation more accurately.
  974. */
  975. #define nvmlClocksThrottleReasonUserDefinedClocks nvmlClocksThrottleReasonApplicationsClocksSetting
  976. /** SW Power Scaling algorithm is reducing the clocks below requested clocks
  977. *
  978. * @see nvmlDeviceGetPowerUsage
  979. * @see nvmlDeviceSetPowerManagementLimit
  980. * @see nvmlDeviceGetPowerManagementLimit
  981. */
  982. #define nvmlClocksThrottleReasonSwPowerCap 0x0000000000000004LL
  983. /** HW Slowdown (reducing the core clocks by a factor of 2 or more) is engaged
  984. *
  985. * This is an indicator of:
  986. * - temperature being too high
  987. * - External Power Brake Assertion is triggered (e.g. by the system power supply)
  988. * - Power draw is too high and Fast Trigger protection is reducing the clocks
  989. * - May be also reported during PState or clock change
  990. * - This behavior may be removed in a later release.
  991. *
  992. * @see nvmlDeviceGetTemperature
  993. * @see nvmlDeviceGetTemperatureThreshold
  994. * @see nvmlDeviceGetPowerUsage
  995. */
  996. #define nvmlClocksThrottleReasonHwSlowdown 0x0000000000000008LL
  997. /** Sync Boost
  998. *
  999. * This GPU has been added to a Sync boost group with nvidia-smi or DCGM in
  1000. * order to maximize performance per watt. All GPUs in the sync boost group
  1001. * will boost to the minimum possible clocks across the entire group. Look at
  1002. * the throttle reasons for other GPUs in the system to see why those GPUs are
  1003. * holding this one at lower clocks.
  1004. *
  1005. */
  1006. #define nvmlClocksThrottleReasonSyncBoost 0x0000000000000010LL
  1007. /** Bit mask representing no clocks throttling
  1008. *
  1009. * Clocks are as high as possible.
  1010. * */
  1011. #define nvmlClocksThrottleReasonNone 0x0000000000000000LL
  1012. /** Bit mask representing all supported clocks throttling reasons
  1013. * New reasons might be added to this list in the future
  1014. */
  1015. #define nvmlClocksThrottleReasonAll (nvmlClocksThrottleReasonNone \
  1016. | nvmlClocksThrottleReasonGpuIdle \
  1017. | nvmlClocksThrottleReasonApplicationsClocksSetting \
  1018. | nvmlClocksThrottleReasonSwPowerCap \
  1019. | nvmlClocksThrottleReasonHwSlowdown \
  1020. | nvmlClocksThrottleReasonSyncBoost \
  1021. )
  1022. /** @} */
  1023. /***************************************************************************************************/
  1024. /** @defgroup nvmlAccountingStats Accounting Statistics
  1025. * @{
  1026. *
  1027. * Set of APIs designed to provide per process information about usage of GPU.
  1028. *
  1029. * @note All accounting statistics and accounting mode live in nvidia driver and reset
  1030. * to default (Disabled) when driver unloads.
  1031. * It is advised to run with persistence mode enabled.
  1032. *
  1033. * @note Enabling accounting mode has no negative impact on the GPU performance.
  1034. */
  1035. /***************************************************************************************************/
  1036. /**
  1037. * Describes accounting statistics of a process.
  1038. */
  1039. typedef struct nvmlAccountingStats_st {
  1040. unsigned int gpuUtilization; //!< Percent of time over the process's lifetime during which one or more kernels was executing on the GPU.
  1041. //! Utilization stats just like returned by \ref nvmlDeviceGetUtilizationRates but for the life time of a
  1042. //! process (not just the last sample period).
  1043. //! Set to NVML_VALUE_NOT_AVAILABLE if nvmlDeviceGetUtilizationRates is not supported
  1044. unsigned int memoryUtilization; //!< Percent of time over the process's lifetime during which global (device) memory was being read or written.
  1045. //! Set to NVML_VALUE_NOT_AVAILABLE if nvmlDeviceGetUtilizationRates is not supported
  1046. unsigned long long maxMemoryUsage; //!< Maximum total memory in bytes that was ever allocated by the process.
  1047. //! Set to NVML_VALUE_NOT_AVAILABLE if nvmlProcessInfo_t->usedGpuMemory is not supported
  1048. unsigned long long time; //!< Amount of time in ms during which the compute context was active. The time is reported as 0 if
  1049. //!< the process is not terminated
  1050. unsigned long long startTime; //!< CPU Timestamp in usec representing start time for the process
  1051. unsigned int isRunning; //!< Flag to represent if the process is running (1 for running, 0 for terminated)
  1052. unsigned int reserved[5]; //!< Reserved for future use
  1053. } nvmlAccountingStats_t;
  1054. /** @} */
  1055. /***************************************************************************************************/
  1056. /** @defgroup nvmlVgpuConstants Vgpu Constants
  1057. * @{
  1058. */
  1059. /***************************************************************************************************/
  1060. /**
  1061. * Buffer size guaranteed to be large enough for \ref nvmlVgpuTypeGetLicense
  1062. */
  1063. #define NVML_GRID_LICENSE_BUFFER_SIZE 128
  1064. #define NVML_VGPU_NAME_BUFFER_SIZE 64
  1065. #define NVML_MAX_VGPU_TYPES_PER_PGPU 17
  1066. #define NVML_MAX_VGPU_INSTANCES_PER_PGPU 24
  1067. #define NVML_GRID_LICENSE_FEATURE_MAX_COUNT 3
  1068. #define NVML_GRID_LICENSE_INFO_MAX_LENGTH 128
  1069. /** @} */
  1070. /***************************************************************************************************/
  1071. /** @defgroup nvmlVgpuEnum Vgpu Enum
  1072. * @{
  1073. */
  1074. /***************************************************************************************************/
  1075. /*!
  1076. * Types of VM identifiers
  1077. */
  1078. typedef enum nvmlVgpuVmIdType {
  1079. NVML_VGPU_VM_ID_DOMAIN_ID = 0, //!< VM ID represents DOMAIN ID
  1080. NVML_VGPU_VM_ID_UUID = 1, //!< VM ID represents UUID
  1081. } nvmlVgpuVmIdType_t;
  1082. // vGPU GUEST info state.
  1083. typedef enum nvmlVgpuGuestInfoState_enum
  1084. {
  1085. NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = 0, //<! Guest-dependent fields uninitialized
  1086. NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = 1, //<! Guest-dependent fields initialized
  1087. } nvmlVgpuGuestInfoState_t;
  1088. // GRID license feature code
  1089. typedef enum {
  1090. NVML_GRID_LICENSE_FEATURE_CODE_VGPU = 1, // Virtual GPU
  1091. NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION = 2 // Virtual Workstation
  1092. } nvmlGridLicenseFeatureCode_t;
  1093. /** @} */
  1094. /***************************************************************************************************/
  1095. /** @defgroup nvmlVgpuStructs Vgpu Structs
  1096. * @{
  1097. */
  1098. /***************************************************************************************************/
  1099. typedef unsigned int nvmlVgpuTypeId_t;
  1100. typedef unsigned int nvmlVgpuInstance_t;
  1101. /**
  1102. * Structure to store Utilization Value and vgpuInstance
  1103. */
  1104. typedef struct nvmlVgpuInstanceUtilizationSample_st
  1105. {
  1106. nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance
  1107. unsigned long long timeStamp; //!< CPU Timestamp in microseconds
  1108. nvmlValue_t smUtil; //!< SM (3D/Compute) Util Value
  1109. nvmlValue_t memUtil; //!< Frame Buffer Memory Util Value
  1110. nvmlValue_t encUtil; //!< Encoder Util Value
  1111. nvmlValue_t decUtil; //!< Decoder Util Value
  1112. } nvmlVgpuInstanceUtilizationSample_t;
  1113. /**
  1114. * Structure to store Utilization Value, vgpuInstance and subprocess information
  1115. */
  1116. typedef struct nvmlVgpuProcessUtilizationSample_st
  1117. {
  1118. nvmlVgpuInstance_t vgpuInstance; //!< vGPU Instance
  1119. unsigned int pid; //!< PID of process running within the vGPU VM
  1120. char processName[NVML_VGPU_NAME_BUFFER_SIZE]; //!< Name of process running within the vGPU VM
  1121. unsigned long long timeStamp; //!< CPU Timestamp in microseconds
  1122. unsigned int smUtil; //!< SM (3D/Compute) Util Value
  1123. unsigned int memUtil; //!< Frame Buffer Memory Util Value
  1124. unsigned int encUtil; //!< Encoder Util Value
  1125. unsigned int decUtil; //!< Decoder Util Value
  1126. } nvmlVgpuProcessUtilizationSample_t;
  1127. /**
  1128. * Structure to store utilization value and process Id
  1129. */
  1130. typedef struct nvmlProcessUtilizationSample_st
  1131. {
  1132. unsigned int pid; //!< PID of process
  1133. unsigned long long timeStamp; //!< CPU Timestamp in microseconds
  1134. unsigned int smUtil; //!< SM (3D/Compute) Util Value
  1135. unsigned int memUtil; //!< Frame Buffer Memory Util Value
  1136. unsigned int encUtil; //!< Encoder Util Value
  1137. unsigned int decUtil; //!< Decoder Util Value
  1138. } nvmlProcessUtilizationSample_t;
  1139. /**
  1140. * Structure to store GRID licensable features
  1141. */
  1142. typedef struct nvmlGridLicensableFeature_st
  1143. {
  1144. nvmlGridLicenseFeatureCode_t featureCode; //<! Licensed feature code
  1145. unsigned int featureState; //<! Non-zero if feature is currently licensed, otherwise zero
  1146. char licenseInfo[NVML_GRID_LICENSE_INFO_MAX_LENGTH];
  1147. } nvmlGridLicensableFeature_t;
  1148. typedef struct nvmlGridLicensableFeatures_st
  1149. {
  1150. int isGridLicenseSupported; //<! Non-zero if GRID Software Licensing is supported on the system, otherwise zero
  1151. unsigned int licensableFeaturesCount; //<! Entries returned in \a gridLicensableFeatures array
  1152. nvmlGridLicensableFeature_t gridLicensableFeatures[NVML_GRID_LICENSE_FEATURE_MAX_COUNT];
  1153. } nvmlGridLicensableFeatures_t;
  1154. /** @} */
  1155. /***************************************************************************************************/
  1156. /** @defgroup nvmlEncoderStructs Encoder Structs
  1157. * @{
  1158. */
  1159. /***************************************************************************************************/
  1160. /*
  1161. * Represents type of encoder for capacity can be queried
  1162. */
  1163. typedef enum nvmlEncoderQueryType_enum
  1164. {
  1165. NVML_ENCODER_QUERY_H264 = 0,
  1166. NVML_ENCODER_QUERY_HEVC = 1,
  1167. }nvmlEncoderType_t;
  1168. /*
  1169. * Struct to hold encoder session data
  1170. */
  1171. typedef struct nvmlEncoderSessionInfo_st
  1172. {
  1173. unsigned int sessionId; //!< Unique session ID
  1174. unsigned int pid; //!< Owning process ID
  1175. nvmlVgpuInstance_t vgpuInstance; //!< Owning vGPU instance ID (only valid on vGPU hosts, otherwise zero)
  1176. nvmlEncoderType_t codecType; //!< Video encoder type
  1177. unsigned int hResolution; //!< Current encode horizontal resolution
  1178. unsigned int vResolution; //!< Current encode vertical resolution
  1179. unsigned int averageFps; //!< Moving average encode frames per second
  1180. unsigned int averageLatency; //!< Moving average encode latency in microseconds
  1181. }nvmlEncoderSessionInfo_t;
  1182. /** @} */
  1183. /***************************************************************************************************/
  1184. /** @defgroup nvmlInitializationAndCleanup Initialization and Cleanup
  1185. * This chapter describes the methods that handle NVML initialization and cleanup.
  1186. * It is the user's responsibility to call \ref nvmlInit() before calling any other methods, and
  1187. * nvmlShutdown() once NVML is no longer being used.
  1188. * @{
  1189. */
  1190. /***************************************************************************************************/
  1191. /**
  1192. * Initialize NVML, but don't initialize any GPUs yet.
  1193. *
  1194. * \note In NVML 5.319 new nvmlInit_v2 has replaced nvmlInit"_v1" (default in NVML 4.304 and older) that
  1195. * did initialize all GPU devices in the system.
  1196. *
  1197. * This allows NVML to communicate with a GPU
  1198. * when other GPUs in the system are unstable or in a bad state. When using this API, GPUs are
  1199. * discovered and initialized in nvmlDeviceGetHandleBy* functions instead.
  1200. *
  1201. * \note To contrast nvmlInit_v2 with nvmlInit"_v1", NVML 4.304 nvmlInit"_v1" will fail when any detected GPU is in
  1202. * a bad or unstable state.
  1203. *
  1204. * For all products.
  1205. *
  1206. * This method, should be called once before invoking any other methods in the library.
  1207. * A reference count of the number of initializations is maintained. Shutdown only occurs
  1208. * when the reference count reaches zero.
  1209. *
  1210. * @return
  1211. * - \ref NVML_SUCCESS if NVML has been properly initialized
  1212. * - \ref NVML_ERROR_DRIVER_NOT_LOADED if NVIDIA driver is not running
  1213. * - \ref NVML_ERROR_NO_PERMISSION if NVML does not have permission to talk to the driver
  1214. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1215. */
  1216. nvmlReturn_t DECLDIR nvmlInit(void);
  1217. /**
  1218. * Shut down NVML by releasing all GPU resources previously allocated with \ref nvmlInit().
  1219. *
  1220. * For all products.
  1221. *
  1222. * This method should be called after NVML work is done, once for each call to \ref nvmlInit()
  1223. * A reference count of the number of initializations is maintained. Shutdown only occurs
  1224. * when the reference count reaches zero. For backwards compatibility, no error is reported if
  1225. * nvmlShutdown() is called more times than nvmlInit().
  1226. *
  1227. * @return
  1228. * - \ref NVML_SUCCESS if NVML has been properly shut down
  1229. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1230. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1231. */
  1232. nvmlReturn_t DECLDIR nvmlShutdown(void);
  1233. /** @} */
  1234. /***************************************************************************************************/
  1235. /** @defgroup nvmlErrorReporting Error reporting
  1236. * This chapter describes helper functions for error reporting routines.
  1237. * @{
  1238. */
  1239. /***************************************************************************************************/
  1240. /**
  1241. * Helper method for converting NVML error codes into readable strings.
  1242. *
  1243. * For all products.
  1244. *
  1245. * @param result NVML error code to convert
  1246. *
  1247. * @return String representation of the error.
  1248. *
  1249. */
  1250. const DECLDIR char* nvmlErrorString(nvmlReturn_t result);
  1251. /** @} */
  1252. /***************************************************************************************************/
  1253. /** @defgroup nvmlConstants Constants
  1254. * @{
  1255. */
  1256. /***************************************************************************************************/
  1257. /**
  1258. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetInforomVersion and \ref nvmlDeviceGetInforomImageVersion
  1259. */
  1260. #define NVML_DEVICE_INFOROM_VERSION_BUFFER_SIZE 16
  1261. /**
  1262. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetUUID
  1263. */
  1264. #define NVML_DEVICE_UUID_BUFFER_SIZE 80
  1265. /**
  1266. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetBoardPartNumber
  1267. */
  1268. #define NVML_DEVICE_PART_NUMBER_BUFFER_SIZE 80
  1269. /**
  1270. * Buffer size guaranteed to be large enough for \ref nvmlSystemGetDriverVersion
  1271. */
  1272. #define NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE 80
  1273. /**
  1274. * Buffer size guaranteed to be large enough for \ref nvmlSystemGetNVMLVersion
  1275. */
  1276. #define NVML_SYSTEM_NVML_VERSION_BUFFER_SIZE 80
  1277. /**
  1278. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetName
  1279. */
  1280. #define NVML_DEVICE_NAME_BUFFER_SIZE 64
  1281. /**
  1282. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetSerial
  1283. */
  1284. #define NVML_DEVICE_SERIAL_BUFFER_SIZE 30
  1285. /**
  1286. * Buffer size guaranteed to be large enough for \ref nvmlDeviceGetVbiosVersion
  1287. */
  1288. #define NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE 32
  1289. /** @} */
  1290. /***************************************************************************************************/
  1291. /** @defgroup nvmlSystemQueries System Queries
  1292. * This chapter describes the queries that NVML can perform against the local system. These queries
  1293. * are not device-specific.
  1294. * @{
  1295. */
  1296. /***************************************************************************************************/
  1297. /**
  1298. * Retrieves the version of the system's graphics driver.
  1299. *
  1300. * For all products.
  1301. *
  1302. * The version identifier is an alphanumeric string. It will not exceed 80 characters in length
  1303. * (including the NULL terminator). See \ref nvmlConstants::NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE.
  1304. *
  1305. * @param version Reference in which to return the version identifier
  1306. * @param length The maximum allowed length of the string returned in \a version
  1307. *
  1308. * @return
  1309. * - \ref NVML_SUCCESS if \a version has been set
  1310. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1311. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a version is NULL
  1312. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  1313. */
  1314. nvmlReturn_t DECLDIR nvmlSystemGetDriverVersion(char *version, unsigned int length);
  1315. /**
  1316. * Retrieves the version of the NVML library.
  1317. *
  1318. * For all products.
  1319. *
  1320. * The version identifier is an alphanumeric string. It will not exceed 80 characters in length
  1321. * (including the NULL terminator). See \ref nvmlConstants::NVML_SYSTEM_NVML_VERSION_BUFFER_SIZE.
  1322. *
  1323. * @param version Reference in which to return the version identifier
  1324. * @param length The maximum allowed length of the string returned in \a version
  1325. *
  1326. * @return
  1327. * - \ref NVML_SUCCESS if \a version has been set
  1328. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a version is NULL
  1329. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  1330. */
  1331. nvmlReturn_t DECLDIR nvmlSystemGetNVMLVersion(char *version, unsigned int length);
  1332. /**
  1333. * Retrieves the version of the CUDA driver.
  1334. *
  1335. * For all products.
  1336. *
  1337. * The returned CUDA driver version is the same as the CUDA API
  1338. * cuDriverGetVersion() would return on the system.
  1339. *
  1340. * @param cudaDriverVersion Reference in which to return the version identifier
  1341. *
  1342. * @return
  1343. * - \ref NVML_SUCCESS if \a cudaDriverVersion has been set
  1344. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a cudaDriverVersion is NULL
  1345. */
  1346. nvmlReturn_t DECLDIR nvmlSystemGetCudaDriverVersion(int *cudaDriverVersion);
  1347. /**
  1348. * Gets name of the process with provided process id
  1349. *
  1350. * For all products.
  1351. *
  1352. * Returned process name is cropped to provided length.
  1353. * name string is encoded in ANSI.
  1354. *
  1355. * @param pid The identifier of the process
  1356. * @param name Reference in which to return the process name
  1357. * @param length The maximum allowed length of the string returned in \a name
  1358. *
  1359. * @return
  1360. * - \ref NVML_SUCCESS if \a name has been set
  1361. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1362. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a name is NULL or \a length is 0.
  1363. * - \ref NVML_ERROR_NOT_FOUND if process doesn't exists
  1364. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  1365. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1366. */
  1367. nvmlReturn_t DECLDIR nvmlSystemGetProcessName(unsigned int pid, char *name, unsigned int length);
  1368. /** @} */
  1369. /***************************************************************************************************/
  1370. /** @defgroup nvmlUnitQueries Unit Queries
  1371. * This chapter describes that queries that NVML can perform against each unit. For S-class systems only.
  1372. * In each case the device is identified with an nvmlUnit_t handle. This handle is obtained by
  1373. * calling \ref nvmlUnitGetHandleByIndex().
  1374. * @{
  1375. */
  1376. /***************************************************************************************************/
  1377. /**
  1378. * Retrieves the number of units in the system.
  1379. *
  1380. * For S-class products.
  1381. *
  1382. * @param unitCount Reference in which to return the number of units
  1383. *
  1384. * @return
  1385. * - \ref NVML_SUCCESS if \a unitCount has been set
  1386. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1387. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unitCount is NULL
  1388. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1389. */
  1390. nvmlReturn_t DECLDIR nvmlUnitGetCount(unsigned int *unitCount);
  1391. /**
  1392. * Acquire the handle for a particular unit, based on its index.
  1393. *
  1394. * For S-class products.
  1395. *
  1396. * Valid indices are derived from the \a unitCount returned by \ref nvmlUnitGetCount().
  1397. * For example, if \a unitCount is 2 the valid indices are 0 and 1, corresponding to UNIT 0 and UNIT 1.
  1398. *
  1399. * The order in which NVML enumerates units has no guarantees of consistency between reboots.
  1400. *
  1401. * @param index The index of the target unit, >= 0 and < \a unitCount
  1402. * @param unit Reference in which to return the unit handle
  1403. *
  1404. * @return
  1405. * - \ref NVML_SUCCESS if \a unit has been set
  1406. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1407. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a index is invalid or \a unit is NULL
  1408. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1409. */
  1410. nvmlReturn_t DECLDIR nvmlUnitGetHandleByIndex(unsigned int index, nvmlUnit_t *unit);
  1411. /**
  1412. * Retrieves the static information associated with a unit.
  1413. *
  1414. * For S-class products.
  1415. *
  1416. * See \ref nvmlUnitInfo_t for details on available unit info.
  1417. *
  1418. * @param unit The identifier of the target unit
  1419. * @param info Reference in which to return the unit information
  1420. *
  1421. * @return
  1422. * - \ref NVML_SUCCESS if \a info has been populated
  1423. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1424. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit is invalid or \a info is NULL
  1425. */
  1426. nvmlReturn_t DECLDIR nvmlUnitGetUnitInfo(nvmlUnit_t unit, nvmlUnitInfo_t *info);
  1427. /**
  1428. * Retrieves the LED state associated with this unit.
  1429. *
  1430. * For S-class products.
  1431. *
  1432. * See \ref nvmlLedState_t for details on allowed states.
  1433. *
  1434. * @param unit The identifier of the target unit
  1435. * @param state Reference in which to return the current LED state
  1436. *
  1437. * @return
  1438. * - \ref NVML_SUCCESS if \a state has been set
  1439. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1440. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit is invalid or \a state is NULL
  1441. * - \ref NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
  1442. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1443. *
  1444. * @see nvmlUnitSetLedState()
  1445. */
  1446. nvmlReturn_t DECLDIR nvmlUnitGetLedState(nvmlUnit_t unit, nvmlLedState_t *state);
  1447. /**
  1448. * Retrieves the PSU stats for the unit.
  1449. *
  1450. * For S-class products.
  1451. *
  1452. * See \ref nvmlPSUInfo_t for details on available PSU info.
  1453. *
  1454. * @param unit The identifier of the target unit
  1455. * @param psu Reference in which to return the PSU information
  1456. *
  1457. * @return
  1458. * - \ref NVML_SUCCESS if \a psu has been populated
  1459. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1460. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit is invalid or \a psu is NULL
  1461. * - \ref NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
  1462. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1463. */
  1464. nvmlReturn_t DECLDIR nvmlUnitGetPsuInfo(nvmlUnit_t unit, nvmlPSUInfo_t *psu);
  1465. /**
  1466. * Retrieves the temperature readings for the unit, in degrees C.
  1467. *
  1468. * For S-class products.
  1469. *
  1470. * Depending on the product, readings may be available for intake (type=0),
  1471. * exhaust (type=1) and board (type=2).
  1472. *
  1473. * @param unit The identifier of the target unit
  1474. * @param type The type of reading to take
  1475. * @param temp Reference in which to return the intake temperature
  1476. *
  1477. * @return
  1478. * - \ref NVML_SUCCESS if \a temp has been populated
  1479. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1480. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit or \a type is invalid or \a temp is NULL
  1481. * - \ref NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
  1482. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1483. */
  1484. nvmlReturn_t DECLDIR nvmlUnitGetTemperature(nvmlUnit_t unit, unsigned int type, unsigned int *temp);
  1485. /**
  1486. * Retrieves the fan speed readings for the unit.
  1487. *
  1488. * For S-class products.
  1489. *
  1490. * See \ref nvmlUnitFanSpeeds_t for details on available fan speed info.
  1491. *
  1492. * @param unit The identifier of the target unit
  1493. * @param fanSpeeds Reference in which to return the fan speed information
  1494. *
  1495. * @return
  1496. * - \ref NVML_SUCCESS if \a fanSpeeds has been populated
  1497. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1498. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit is invalid or \a fanSpeeds is NULL
  1499. * - \ref NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
  1500. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1501. */
  1502. nvmlReturn_t DECLDIR nvmlUnitGetFanSpeedInfo(nvmlUnit_t unit, nvmlUnitFanSpeeds_t *fanSpeeds);
  1503. /**
  1504. * Retrieves the set of GPU devices that are attached to the specified unit.
  1505. *
  1506. * For S-class products.
  1507. *
  1508. * The \a deviceCount argument is expected to be set to the size of the input \a devices array.
  1509. *
  1510. * @param unit The identifier of the target unit
  1511. * @param deviceCount Reference in which to provide the \a devices array size, and
  1512. * to return the number of attached GPU devices
  1513. * @param devices Reference in which to return the references to the attached GPU devices
  1514. *
  1515. * @return
  1516. * - \ref NVML_SUCCESS if \a deviceCount and \a devices have been populated
  1517. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1518. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a deviceCount indicates that the \a devices array is too small
  1519. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit is invalid, either of \a deviceCount or \a devices is NULL
  1520. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1521. */
  1522. nvmlReturn_t DECLDIR nvmlUnitGetDevices(nvmlUnit_t unit, unsigned int *deviceCount, nvmlDevice_t *devices);
  1523. /**
  1524. * Retrieves the IDs and firmware versions for any Host Interface Cards (HICs) in the system.
  1525. *
  1526. * For S-class products.
  1527. *
  1528. * The \a hwbcCount argument is expected to be set to the size of the input \a hwbcEntries array.
  1529. * The HIC must be connected to an S-class system for it to be reported by this function.
  1530. *
  1531. * @param hwbcCount Size of hwbcEntries array
  1532. * @param hwbcEntries Array holding information about hwbc
  1533. *
  1534. * @return
  1535. * - \ref NVML_SUCCESS if \a hwbcCount and \a hwbcEntries have been populated
  1536. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1537. * - \ref NVML_ERROR_INVALID_ARGUMENT if either \a hwbcCount or \a hwbcEntries is NULL
  1538. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a hwbcCount indicates that the \a hwbcEntries array is too small
  1539. */
  1540. nvmlReturn_t DECLDIR nvmlSystemGetHicVersion(unsigned int *hwbcCount, nvmlHwbcEntry_t *hwbcEntries);
  1541. /** @} */
  1542. /***************************************************************************************************/
  1543. /** @defgroup nvmlDeviceQueries Device Queries
  1544. * This chapter describes that queries that NVML can perform against each device.
  1545. * In each case the device is identified with an nvmlDevice_t handle. This handle is obtained by
  1546. * calling one of \ref nvmlDeviceGetHandleByIndex(), \ref nvmlDeviceGetHandleBySerial(),
  1547. * \ref nvmlDeviceGetHandleByPciBusId(). or \ref nvmlDeviceGetHandleByUUID().
  1548. * @{
  1549. */
  1550. /***************************************************************************************************/
  1551. /**
  1552. * Retrieves the number of compute devices in the system. A compute device is a single GPU.
  1553. *
  1554. * For all products.
  1555. *
  1556. * Note: New nvmlDeviceGetCount_v2 (default in NVML 5.319) returns count of all devices in the system
  1557. * even if nvmlDeviceGetHandleByIndex_v2 returns NVML_ERROR_NO_PERMISSION for such device.
  1558. * Update your code to handle this error, or use NVML 4.304 or older nvml header file.
  1559. * For backward binary compatibility reasons _v1 version of the API is still present in the shared
  1560. * library.
  1561. * Old _v1 version of nvmlDeviceGetCount doesn't count devices that NVML has no permission to talk to.
  1562. *
  1563. * @param deviceCount Reference in which to return the number of accessible devices
  1564. *
  1565. * @return
  1566. * - \ref NVML_SUCCESS if \a deviceCount has been set
  1567. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1568. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a deviceCount is NULL
  1569. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1570. */
  1571. nvmlReturn_t DECLDIR nvmlDeviceGetCount(unsigned int *deviceCount);
  1572. /**
  1573. * Acquire the handle for a particular device, based on its index.
  1574. *
  1575. * For all products.
  1576. *
  1577. * Valid indices are derived from the \a accessibleDevices count returned by
  1578. * \ref nvmlDeviceGetCount(). For example, if \a accessibleDevices is 2 the valid indices
  1579. * are 0 and 1, corresponding to GPU 0 and GPU 1.
  1580. *
  1581. * The order in which NVML enumerates devices has no guarantees of consistency between reboots. For that reason it
  1582. * is recommended that devices be looked up by their PCI ids or UUID. See
  1583. * \ref nvmlDeviceGetHandleByUUID() and \ref nvmlDeviceGetHandleByPciBusId().
  1584. *
  1585. * Note: The NVML index may not correlate with other APIs, such as the CUDA device index.
  1586. *
  1587. * Starting from NVML 5, this API causes NVML to initialize the target GPU
  1588. * NVML may initialize additional GPUs if:
  1589. * - The target GPU is an SLI slave
  1590. *
  1591. * Note: New nvmlDeviceGetCount_v2 (default in NVML 5.319) returns count of all devices in the system
  1592. * even if nvmlDeviceGetHandleByIndex_v2 returns NVML_ERROR_NO_PERMISSION for such device.
  1593. * Update your code to handle this error, or use NVML 4.304 or older nvml header file.
  1594. * For backward binary compatibility reasons _v1 version of the API is still present in the shared
  1595. * library.
  1596. * Old _v1 version of nvmlDeviceGetCount doesn't count devices that NVML has no permission to talk to.
  1597. *
  1598. * This means that nvmlDeviceGetHandleByIndex_v2 and _v1 can return different devices for the same index.
  1599. * If you don't touch macros that map old (_v1) versions to _v2 versions at the top of the file you don't
  1600. * need to worry about that.
  1601. *
  1602. * @param index The index of the target GPU, >= 0 and < \a accessibleDevices
  1603. * @param device Reference in which to return the device handle
  1604. *
  1605. * @return
  1606. * - \ref NVML_SUCCESS if \a device has been set
  1607. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1608. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a index is invalid or \a device is NULL
  1609. * - \ref NVML_ERROR_INSUFFICIENT_POWER if any attached devices have improperly attached external power cables
  1610. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to talk to this device
  1611. * - \ref NVML_ERROR_IRQ_ISSUE if NVIDIA kernel detected an interrupt issue with the attached GPUs
  1612. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1613. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1614. *
  1615. * @see nvmlDeviceGetIndex
  1616. * @see nvmlDeviceGetCount
  1617. */
  1618. nvmlReturn_t DECLDIR nvmlDeviceGetHandleByIndex(unsigned int index, nvmlDevice_t *device);
  1619. /**
  1620. * Acquire the handle for a particular device, based on its board serial number.
  1621. *
  1622. * For Fermi &tm; or newer fully supported devices.
  1623. *
  1624. * This number corresponds to the value printed directly on the board, and to the value returned by
  1625. * \ref nvmlDeviceGetSerial().
  1626. *
  1627. * @deprecated Since more than one GPU can exist on a single board this function is deprecated in favor
  1628. * of \ref nvmlDeviceGetHandleByUUID.
  1629. * For dual GPU boards this function will return NVML_ERROR_INVALID_ARGUMENT.
  1630. *
  1631. * Starting from NVML 5, this API causes NVML to initialize the target GPU
  1632. * NVML may initialize additional GPUs as it searches for the target GPU
  1633. *
  1634. * @param serial The board serial number of the target GPU
  1635. * @param device Reference in which to return the device handle
  1636. *
  1637. * @return
  1638. * - \ref NVML_SUCCESS if \a device has been set
  1639. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1640. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a serial is invalid, \a device is NULL or more than one
  1641. * device has the same serial (dual GPU boards)
  1642. * - \ref NVML_ERROR_NOT_FOUND if \a serial does not match a valid device on the system
  1643. * - \ref NVML_ERROR_INSUFFICIENT_POWER if any attached devices have improperly attached external power cables
  1644. * - \ref NVML_ERROR_IRQ_ISSUE if NVIDIA kernel detected an interrupt issue with the attached GPUs
  1645. * - \ref NVML_ERROR_GPU_IS_LOST if any GPU has fallen off the bus or is otherwise inaccessible
  1646. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1647. *
  1648. * @see nvmlDeviceGetSerial
  1649. * @see nvmlDeviceGetHandleByUUID
  1650. */
  1651. nvmlReturn_t DECLDIR nvmlDeviceGetHandleBySerial(const char *serial, nvmlDevice_t *device);
  1652. /**
  1653. * Acquire the handle for a particular device, based on its globally unique immutable UUID associated with each device.
  1654. *
  1655. * For all products.
  1656. *
  1657. * @param uuid The UUID of the target GPU
  1658. * @param device Reference in which to return the device handle
  1659. *
  1660. * Starting from NVML 5, this API causes NVML to initialize the target GPU
  1661. * NVML may initialize additional GPUs as it searches for the target GPU
  1662. *
  1663. * @return
  1664. * - \ref NVML_SUCCESS if \a device has been set
  1665. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1666. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a uuid is invalid or \a device is null
  1667. * - \ref NVML_ERROR_NOT_FOUND if \a uuid does not match a valid device on the system
  1668. * - \ref NVML_ERROR_INSUFFICIENT_POWER if any attached devices have improperly attached external power cables
  1669. * - \ref NVML_ERROR_IRQ_ISSUE if NVIDIA kernel detected an interrupt issue with the attached GPUs
  1670. * - \ref NVML_ERROR_GPU_IS_LOST if any GPU has fallen off the bus or is otherwise inaccessible
  1671. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1672. *
  1673. * @see nvmlDeviceGetUUID
  1674. */
  1675. nvmlReturn_t DECLDIR nvmlDeviceGetHandleByUUID(const char *uuid, nvmlDevice_t *device);
  1676. /**
  1677. * Acquire the handle for a particular device, based on its PCI bus id.
  1678. *
  1679. * For all products.
  1680. *
  1681. * This value corresponds to the nvmlPciInfo_t::busId returned by \ref nvmlDeviceGetPciInfo().
  1682. *
  1683. * Starting from NVML 5, this API causes NVML to initialize the target GPU
  1684. * NVML may initialize additional GPUs if:
  1685. * - The target GPU is an SLI slave
  1686. *
  1687. * \note NVML 4.304 and older version of nvmlDeviceGetHandleByPciBusId"_v1" returns NVML_ERROR_NOT_FOUND
  1688. * instead of NVML_ERROR_NO_PERMISSION.
  1689. *
  1690. * @param pciBusId The PCI bus id of the target GPU
  1691. * @param device Reference in which to return the device handle
  1692. *
  1693. * @return
  1694. * - \ref NVML_SUCCESS if \a device has been set
  1695. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1696. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a pciBusId is invalid or \a device is NULL
  1697. * - \ref NVML_ERROR_NOT_FOUND if \a pciBusId does not match a valid device on the system
  1698. * - \ref NVML_ERROR_INSUFFICIENT_POWER if the attached device has improperly attached external power cables
  1699. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to talk to this device
  1700. * - \ref NVML_ERROR_IRQ_ISSUE if NVIDIA kernel detected an interrupt issue with the attached GPUs
  1701. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1702. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1703. */
  1704. nvmlReturn_t DECLDIR nvmlDeviceGetHandleByPciBusId(const char *pciBusId, nvmlDevice_t *device);
  1705. /**
  1706. * Retrieves the name of this device.
  1707. *
  1708. * For all products.
  1709. *
  1710. * The name is an alphanumeric string that denotes a particular product, e.g. Tesla &tm; C2070. It will not
  1711. * exceed 64 characters in length (including the NULL terminator). See \ref
  1712. * nvmlConstants::NVML_DEVICE_NAME_BUFFER_SIZE.
  1713. *
  1714. * @param device The identifier of the target device
  1715. * @param name Reference in which to return the product name
  1716. * @param length The maximum allowed length of the string returned in \a name
  1717. *
  1718. * @return
  1719. * - \ref NVML_SUCCESS if \a name has been set
  1720. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1721. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a name is NULL
  1722. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  1723. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1724. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1725. */
  1726. nvmlReturn_t DECLDIR nvmlDeviceGetName(nvmlDevice_t device, char *name, unsigned int length);
  1727. /**
  1728. * Retrieves the brand of this device.
  1729. *
  1730. * For all products.
  1731. *
  1732. * The type is a member of \ref nvmlBrandType_t defined above.
  1733. *
  1734. * @param device The identifier of the target device
  1735. * @param type Reference in which to return the product brand type
  1736. *
  1737. * @return
  1738. * - \ref NVML_SUCCESS if \a name has been set
  1739. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1740. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a type is NULL
  1741. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1742. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1743. */
  1744. nvmlReturn_t DECLDIR nvmlDeviceGetBrand(nvmlDevice_t device, nvmlBrandType_t *type);
  1745. /**
  1746. * Retrieves the NVML index of this device.
  1747. *
  1748. * For all products.
  1749. *
  1750. * Valid indices are derived from the \a accessibleDevices count returned by
  1751. * \ref nvmlDeviceGetCount(). For example, if \a accessibleDevices is 2 the valid indices
  1752. * are 0 and 1, corresponding to GPU 0 and GPU 1.
  1753. *
  1754. * The order in which NVML enumerates devices has no guarantees of consistency between reboots. For that reason it
  1755. * is recommended that devices be looked up by their PCI ids or GPU UUID. See
  1756. * \ref nvmlDeviceGetHandleByPciBusId() and \ref nvmlDeviceGetHandleByUUID().
  1757. *
  1758. * Note: The NVML index may not correlate with other APIs, such as the CUDA device index.
  1759. *
  1760. * @param device The identifier of the target device
  1761. * @param index Reference in which to return the NVML index of the device
  1762. *
  1763. * @return
  1764. * - \ref NVML_SUCCESS if \a index has been set
  1765. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1766. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a index is NULL
  1767. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1768. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1769. *
  1770. * @see nvmlDeviceGetHandleByIndex()
  1771. * @see nvmlDeviceGetCount()
  1772. */
  1773. nvmlReturn_t DECLDIR nvmlDeviceGetIndex(nvmlDevice_t device, unsigned int *index);
  1774. /**
  1775. * Retrieves the globally unique board serial number associated with this device's board.
  1776. *
  1777. * For all products with an inforom.
  1778. *
  1779. * The serial number is an alphanumeric string that will not exceed 30 characters (including the NULL terminator).
  1780. * This number matches the serial number tag that is physically attached to the board. See \ref
  1781. * nvmlConstants::NVML_DEVICE_SERIAL_BUFFER_SIZE.
  1782. *
  1783. * @param device The identifier of the target device
  1784. * @param serial Reference in which to return the board/module serial number
  1785. * @param length The maximum allowed length of the string returned in \a serial
  1786. *
  1787. * @return
  1788. * - \ref NVML_SUCCESS if \a serial has been set
  1789. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1790. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a serial is NULL
  1791. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  1792. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  1793. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1794. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1795. */
  1796. nvmlReturn_t DECLDIR nvmlDeviceGetSerial(nvmlDevice_t device, char *serial, unsigned int length);
  1797. /**
  1798. * Retrieves an array of unsigned ints (sized to cpuSetSize) of bitmasks with the ideal CPU affinity for the device
  1799. * For example, if processors 0, 1, 32, and 33 are ideal for the device and cpuSetSize == 2,
  1800. * result[0] = 0x3, result[1] = 0x3
  1801. *
  1802. * For Kepler &tm; or newer fully supported devices.
  1803. * Supported on Linux only.
  1804. *
  1805. * @param device The identifier of the target device
  1806. * @param cpuSetSize The size of the cpuSet array that is safe to access
  1807. * @param cpuSet Array reference in which to return a bitmask of CPUs, 64 CPUs per
  1808. * unsigned long on 64-bit machines, 32 on 32-bit machines
  1809. *
  1810. * @return
  1811. * - \ref NVML_SUCCESS if \a cpuAffinity has been filled
  1812. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1813. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, cpuSetSize == 0, or cpuSet is NULL
  1814. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  1815. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1816. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1817. */
  1818. nvmlReturn_t DECLDIR nvmlDeviceGetCpuAffinity(nvmlDevice_t device, unsigned int cpuSetSize, unsigned long *cpuSet);
  1819. /**
  1820. * Sets the ideal affinity for the calling thread and device using the guidelines
  1821. * given in nvmlDeviceGetCpuAffinity(). Note, this is a change as of version 8.0.
  1822. * Older versions set the affinity for a calling process and all children.
  1823. * Currently supports up to 64 processors.
  1824. *
  1825. * For Kepler &tm; or newer fully supported devices.
  1826. * Supported on Linux only.
  1827. *
  1828. * @param device The identifier of the target device
  1829. *
  1830. * @return
  1831. * - \ref NVML_SUCCESS if the calling process has been successfully bound
  1832. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1833. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid
  1834. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  1835. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1836. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1837. */
  1838. nvmlReturn_t DECLDIR nvmlDeviceSetCpuAffinity(nvmlDevice_t device);
  1839. /**
  1840. * Clear all affinity bindings for the calling thread. Note, this is a change as of version
  1841. * 8.0 as older versions cleared the affinity for a calling process and all children.
  1842. *
  1843. * For Kepler &tm; or newer fully supported devices.
  1844. * Supported on Linux only.
  1845. *
  1846. * @param device The identifier of the target device
  1847. *
  1848. * @return
  1849. * - \ref NVML_SUCCESS if the calling process has been successfully unbound
  1850. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid
  1851. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1852. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1853. */
  1854. nvmlReturn_t DECLDIR nvmlDeviceClearCpuAffinity(nvmlDevice_t device);
  1855. /**
  1856. * Retrieve the common ancestor for two devices
  1857. * For all products.
  1858. * Supported on Linux only.
  1859. *
  1860. * @param device1 The identifier of the first device
  1861. * @param device2 The identifier of the second device
  1862. * @param pathInfo A \ref nvmlGpuTopologyLevel_t that gives the path type
  1863. *
  1864. * @return
  1865. * - \ref NVML_SUCCESS if \a pathInfo has been set
  1866. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device1, or \a device2 is invalid, or \a pathInfo is NULL
  1867. * - \ref NVML_ERROR_NOT_SUPPORTED if the device or OS does not support this feature
  1868. * - \ref NVML_ERROR_UNKNOWN an error has occurred in underlying topology discovery
  1869. */
  1870. nvmlReturn_t DECLDIR nvmlDeviceGetTopologyCommonAncestor(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuTopologyLevel_t *pathInfo);
  1871. /**
  1872. * Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level
  1873. * For all products.
  1874. * Supported on Linux only.
  1875. *
  1876. * @param device The identifier of the first device
  1877. * @param level The \ref nvmlGpuTopologyLevel_t level to search for other GPUs
  1878. * @param count When zero, is set to the number of matching GPUs such that \a deviceArray
  1879. * can be malloc'd. When non-zero, \a deviceArray will be filled with \a count
  1880. * number of device handles.
  1881. * @param deviceArray An array of device handles for GPUs found at \a level
  1882. *
  1883. * @return
  1884. * - \ref NVML_SUCCESS if \a deviceArray or \a count (if initially zero) has been set
  1885. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a level, or \a count is invalid, or \a deviceArray is NULL with a non-zero \a count
  1886. * - \ref NVML_ERROR_NOT_SUPPORTED if the device or OS does not support this feature
  1887. * - \ref NVML_ERROR_UNKNOWN an error has occurred in underlying topology discovery
  1888. */
  1889. nvmlReturn_t DECLDIR nvmlDeviceGetTopologyNearestGpus(nvmlDevice_t device, nvmlGpuTopologyLevel_t level, unsigned int *count, nvmlDevice_t *deviceArray);
  1890. /**
  1891. * Retrieve the set of GPUs that have a CPU affinity with the given CPU number
  1892. * For all products.
  1893. * Supported on Linux only.
  1894. *
  1895. * @param cpuNumber The CPU number
  1896. * @param count When zero, is set to the number of matching GPUs such that \a deviceArray
  1897. * can be malloc'd. When non-zero, \a deviceArray will be filled with \a count
  1898. * number of device handles.
  1899. * @param deviceArray An array of device handles for GPUs found with affinity to \a cpuNumber
  1900. *
  1901. * @return
  1902. * - \ref NVML_SUCCESS if \a deviceArray or \a count (if initially zero) has been set
  1903. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a cpuNumber, or \a count is invalid, or \a deviceArray is NULL with a non-zero \a count
  1904. * - \ref NVML_ERROR_NOT_SUPPORTED if the device or OS does not support this feature
  1905. * - \ref NVML_ERROR_UNKNOWN an error has occurred in underlying topology discovery
  1906. */
  1907. nvmlReturn_t DECLDIR nvmlSystemGetTopologyGpuSet(unsigned int cpuNumber, unsigned int *count, nvmlDevice_t *deviceArray);
  1908. /**
  1909. * Retrieve the status for a given p2p capability index between a given pair of GPU
  1910. *
  1911. * @param device1 The first device
  1912. * @param device2 The second device
  1913. * @param p2pIndex p2p Capability Index being looked for between \a device1 and \a device2
  1914. * @param p2pStatus Reference in which to return the status of the \a p2pIndex
  1915. * between \a device1 and \a device2
  1916. * @return
  1917. * - \ref NVML_SUCCESS if \a p2pStatus has been populated
  1918. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device1 or \a device2 or \a p2pIndex is invalid or \a p2pStatus is NULL
  1919. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1920. */
  1921. nvmlReturn_t DECLDIR nvmlDeviceGetP2PStatus(nvmlDevice_t device1, nvmlDevice_t device2, nvmlGpuP2PCapsIndex_t p2pIndex,nvmlGpuP2PStatus_t *p2pStatus);
  1922. /**
  1923. * Retrieves the globally unique immutable UUID associated with this device, as a 5 part hexadecimal string,
  1924. * that augments the immutable, board serial identifier.
  1925. *
  1926. * For all products.
  1927. *
  1928. * The UUID is a globally unique identifier. It is the only available identifier for pre-Fermi-architecture products.
  1929. * It does NOT correspond to any identifier printed on the board. It will not exceed 80 characters in length
  1930. * (including the NULL terminator). See \ref nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE.
  1931. *
  1932. * @param device The identifier of the target device
  1933. * @param uuid Reference in which to return the GPU UUID
  1934. * @param length The maximum allowed length of the string returned in \a uuid
  1935. *
  1936. * @return
  1937. * - \ref NVML_SUCCESS if \a uuid has been set
  1938. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1939. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a uuid is NULL
  1940. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  1941. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  1942. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1943. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1944. */
  1945. nvmlReturn_t DECLDIR nvmlDeviceGetUUID(nvmlDevice_t device, char *uuid, unsigned int length);
  1946. /**
  1947. * Retrieves minor number for the device. The minor number for the device is such that the Nvidia device node file for
  1948. * each GPU will have the form /dev/nvidia[minor number].
  1949. *
  1950. * For all products.
  1951. * Supported only for Linux
  1952. *
  1953. * @param device The identifier of the target device
  1954. * @param minorNumber Reference in which to return the minor number for the device
  1955. * @return
  1956. * - \ref NVML_SUCCESS if the minor number is successfully retrieved
  1957. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1958. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a minorNumber is NULL
  1959. * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
  1960. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1961. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1962. */
  1963. nvmlReturn_t DECLDIR nvmlDeviceGetMinorNumber(nvmlDevice_t device, unsigned int *minorNumber);
  1964. /**
  1965. * Retrieves the the device board part number which is programmed into the board's InfoROM
  1966. *
  1967. * For all products.
  1968. *
  1969. * @param device Identifier of the target device
  1970. * @param partNumber Reference to the buffer to return
  1971. * @param length Length of the buffer reference
  1972. *
  1973. * @return
  1974. * - \ref NVML_SUCCESS if \a partNumber has been set
  1975. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  1976. * - \ref NVML_ERROR_NOT_SUPPORTED if the needed VBIOS fields have not been filled
  1977. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a serial is NULL
  1978. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  1979. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  1980. */
  1981. nvmlReturn_t DECLDIR nvmlDeviceGetBoardPartNumber(nvmlDevice_t device, char* partNumber, unsigned int length);
  1982. /**
  1983. * Retrieves the version information for the device's infoROM object.
  1984. *
  1985. * For all products with an inforom.
  1986. *
  1987. * Fermi and higher parts have non-volatile on-board memory for persisting device info, such as aggregate
  1988. * ECC counts. The version of the data structures in this memory may change from time to time. It will not
  1989. * exceed 16 characters in length (including the NULL terminator).
  1990. * See \ref nvmlConstants::NVML_DEVICE_INFOROM_VERSION_BUFFER_SIZE.
  1991. *
  1992. * See \ref nvmlInforomObject_t for details on the available infoROM objects.
  1993. *
  1994. * @param device The identifier of the target device
  1995. * @param object The target infoROM object
  1996. * @param version Reference in which to return the infoROM version
  1997. * @param length The maximum allowed length of the string returned in \a version
  1998. *
  1999. * @return
  2000. * - \ref NVML_SUCCESS if \a version has been set
  2001. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2002. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a version is NULL
  2003. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  2004. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not have an infoROM
  2005. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2006. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2007. *
  2008. * @see nvmlDeviceGetInforomImageVersion
  2009. */
  2010. nvmlReturn_t DECLDIR nvmlDeviceGetInforomVersion(nvmlDevice_t device, nvmlInforomObject_t object, char *version, unsigned int length);
  2011. /**
  2012. * Retrieves the global infoROM image version
  2013. *
  2014. * For all products with an inforom.
  2015. *
  2016. * Image version just like VBIOS version uniquely describes the exact version of the infoROM flashed on the board
  2017. * in contrast to infoROM object version which is only an indicator of supported features.
  2018. * Version string will not exceed 16 characters in length (including the NULL terminator).
  2019. * See \ref nvmlConstants::NVML_DEVICE_INFOROM_VERSION_BUFFER_SIZE.
  2020. *
  2021. * @param device The identifier of the target device
  2022. * @param version Reference in which to return the infoROM image version
  2023. * @param length The maximum allowed length of the string returned in \a version
  2024. *
  2025. * @return
  2026. * - \ref NVML_SUCCESS if \a version has been set
  2027. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2028. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a version is NULL
  2029. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  2030. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not have an infoROM
  2031. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2032. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2033. *
  2034. * @see nvmlDeviceGetInforomVersion
  2035. */
  2036. nvmlReturn_t DECLDIR nvmlDeviceGetInforomImageVersion(nvmlDevice_t device, char *version, unsigned int length);
  2037. /**
  2038. * Retrieves the checksum of the configuration stored in the device's infoROM.
  2039. *
  2040. * For all products with an inforom.
  2041. *
  2042. * Can be used to make sure that two GPUs have the exact same configuration.
  2043. * Current checksum takes into account configuration stored in PWR and ECC infoROM objects.
  2044. * Checksum can change between driver releases or when user changes configuration (e.g. disable/enable ECC)
  2045. *
  2046. * @param device The identifier of the target device
  2047. * @param checksum Reference in which to return the infoROM configuration checksum
  2048. *
  2049. * @return
  2050. * - \ref NVML_SUCCESS if \a checksum has been set
  2051. * - \ref NVML_ERROR_CORRUPTED_INFOROM if the device's checksum couldn't be retrieved due to infoROM corruption
  2052. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2053. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a checksum is NULL
  2054. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2055. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2056. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2057. */
  2058. nvmlReturn_t DECLDIR nvmlDeviceGetInforomConfigurationChecksum(nvmlDevice_t device, unsigned int *checksum);
  2059. /**
  2060. * Reads the infoROM from the flash and verifies the checksums.
  2061. *
  2062. * For all products with an inforom.
  2063. *
  2064. * @param device The identifier of the target device
  2065. *
  2066. * @return
  2067. * - \ref NVML_SUCCESS if infoROM is not corrupted
  2068. * - \ref NVML_ERROR_CORRUPTED_INFOROM if the device's infoROM is corrupted
  2069. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2070. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2071. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2072. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2073. */
  2074. nvmlReturn_t DECLDIR nvmlDeviceValidateInforom(nvmlDevice_t device);
  2075. /**
  2076. * Retrieves the display mode for the device.
  2077. *
  2078. * For all products.
  2079. *
  2080. * This method indicates whether a physical display (e.g. monitor) is currently connected to
  2081. * any of the device's connectors.
  2082. *
  2083. * See \ref nvmlEnableState_t for details on allowed modes.
  2084. *
  2085. * @param device The identifier of the target device
  2086. * @param display Reference in which to return the display mode
  2087. *
  2088. * @return
  2089. * - \ref NVML_SUCCESS if \a display has been set
  2090. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2091. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a display is NULL
  2092. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2093. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2094. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2095. */
  2096. nvmlReturn_t DECLDIR nvmlDeviceGetDisplayMode(nvmlDevice_t device, nvmlEnableState_t *display);
  2097. /**
  2098. * Retrieves the display active state for the device.
  2099. *
  2100. * For all products.
  2101. *
  2102. * This method indicates whether a display is initialized on the device.
  2103. * For example whether X Server is attached to this device and has allocated memory for the screen.
  2104. *
  2105. * Display can be active even when no monitor is physically attached.
  2106. *
  2107. * See \ref nvmlEnableState_t for details on allowed modes.
  2108. *
  2109. * @param device The identifier of the target device
  2110. * @param isActive Reference in which to return the display active state
  2111. *
  2112. * @return
  2113. * - \ref NVML_SUCCESS if \a isActive has been set
  2114. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2115. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a isActive is NULL
  2116. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2117. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2118. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2119. */
  2120. nvmlReturn_t DECLDIR nvmlDeviceGetDisplayActive(nvmlDevice_t device, nvmlEnableState_t *isActive);
  2121. /**
  2122. * Retrieves the persistence mode associated with this device.
  2123. *
  2124. * For all products.
  2125. * For Linux only.
  2126. *
  2127. * When driver persistence mode is enabled the driver software state is not torn down when the last
  2128. * client disconnects. By default this feature is disabled.
  2129. *
  2130. * See \ref nvmlEnableState_t for details on allowed modes.
  2131. *
  2132. * @param device The identifier of the target device
  2133. * @param mode Reference in which to return the current driver persistence mode
  2134. *
  2135. * @return
  2136. * - \ref NVML_SUCCESS if \a mode has been set
  2137. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2138. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode is NULL
  2139. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2140. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2141. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2142. *
  2143. * @see nvmlDeviceSetPersistenceMode()
  2144. */
  2145. nvmlReturn_t DECLDIR nvmlDeviceGetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t *mode);
  2146. /**
  2147. * Retrieves the PCI attributes of this device.
  2148. *
  2149. * For all products.
  2150. *
  2151. * See \ref nvmlPciInfo_t for details on the available PCI info.
  2152. *
  2153. * @param device The identifier of the target device
  2154. * @param pci Reference in which to return the PCI info
  2155. *
  2156. * @return
  2157. * - \ref NVML_SUCCESS if \a pci has been populated
  2158. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2159. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pci is NULL
  2160. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2161. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2162. */
  2163. nvmlReturn_t DECLDIR nvmlDeviceGetPciInfo(nvmlDevice_t device, nvmlPciInfo_t *pci);
  2164. /**
  2165. * Retrieves the maximum PCIe link generation possible with this device and system
  2166. *
  2167. * I.E. for a generation 2 PCIe device attached to a generation 1 PCIe bus the max link generation this function will
  2168. * report is generation 1.
  2169. *
  2170. * For Fermi &tm; or newer fully supported devices.
  2171. *
  2172. * @param device The identifier of the target device
  2173. * @param maxLinkGen Reference in which to return the max PCIe link generation
  2174. *
  2175. * @return
  2176. * - \ref NVML_SUCCESS if \a maxLinkGen has been populated
  2177. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2178. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a maxLinkGen is null
  2179. * - \ref NVML_ERROR_NOT_SUPPORTED if PCIe link information is not available
  2180. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2181. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2182. */
  2183. nvmlReturn_t DECLDIR nvmlDeviceGetMaxPcieLinkGeneration(nvmlDevice_t device, unsigned int *maxLinkGen);
  2184. /**
  2185. * Retrieves the maximum PCIe link width possible with this device and system
  2186. *
  2187. * I.E. for a device with a 16x PCIe bus width attached to a 8x PCIe system bus this function will report
  2188. * a max link width of 8.
  2189. *
  2190. * For Fermi &tm; or newer fully supported devices.
  2191. *
  2192. * @param device The identifier of the target device
  2193. * @param maxLinkWidth Reference in which to return the max PCIe link generation
  2194. *
  2195. * @return
  2196. * - \ref NVML_SUCCESS if \a maxLinkWidth has been populated
  2197. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2198. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a maxLinkWidth is null
  2199. * - \ref NVML_ERROR_NOT_SUPPORTED if PCIe link information is not available
  2200. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2201. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2202. */
  2203. nvmlReturn_t DECLDIR nvmlDeviceGetMaxPcieLinkWidth(nvmlDevice_t device, unsigned int *maxLinkWidth);
  2204. /**
  2205. * Retrieves the current PCIe link generation
  2206. *
  2207. * For Fermi &tm; or newer fully supported devices.
  2208. *
  2209. * @param device The identifier of the target device
  2210. * @param currLinkGen Reference in which to return the current PCIe link generation
  2211. *
  2212. * @return
  2213. * - \ref NVML_SUCCESS if \a currLinkGen has been populated
  2214. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2215. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a currLinkGen is null
  2216. * - \ref NVML_ERROR_NOT_SUPPORTED if PCIe link information is not available
  2217. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2218. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2219. */
  2220. nvmlReturn_t DECLDIR nvmlDeviceGetCurrPcieLinkGeneration(nvmlDevice_t device, unsigned int *currLinkGen);
  2221. /**
  2222. * Retrieves the current PCIe link width
  2223. *
  2224. * For Fermi &tm; or newer fully supported devices.
  2225. *
  2226. * @param device The identifier of the target device
  2227. * @param currLinkWidth Reference in which to return the current PCIe link generation
  2228. *
  2229. * @return
  2230. * - \ref NVML_SUCCESS if \a currLinkWidth has been populated
  2231. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2232. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a currLinkWidth is null
  2233. * - \ref NVML_ERROR_NOT_SUPPORTED if PCIe link information is not available
  2234. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2235. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2236. */
  2237. nvmlReturn_t DECLDIR nvmlDeviceGetCurrPcieLinkWidth(nvmlDevice_t device, unsigned int *currLinkWidth);
  2238. /**
  2239. * Retrieve PCIe utilization information.
  2240. * This function is querying a byte counter over a 20ms interval and thus is the
  2241. * PCIe throughput over that interval.
  2242. *
  2243. * For Maxwell &tm; or newer fully supported devices.
  2244. *
  2245. * This method is not supported in virtual machines running virtual GPU (vGPU).
  2246. *
  2247. * @param device The identifier of the target device
  2248. * @param counter The specific counter that should be queried \ref nvmlPcieUtilCounter_t
  2249. * @param value Reference in which to return throughput in KB/s
  2250. *
  2251. * @return
  2252. * - \ref NVML_SUCCESS if \a value has been set
  2253. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2254. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a counter is invalid, or \a value is NULL
  2255. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2256. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2257. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2258. */
  2259. nvmlReturn_t DECLDIR nvmlDeviceGetPcieThroughput(nvmlDevice_t device, nvmlPcieUtilCounter_t counter, unsigned int *value);
  2260. /**
  2261. * Retrieve the PCIe replay counter.
  2262. *
  2263. * For Kepler &tm; or newer fully supported devices.
  2264. *
  2265. * @param device The identifier of the target device
  2266. * @param value Reference in which to return the counter's value
  2267. *
  2268. * @return
  2269. * - \ref NVML_SUCCESS if \a value and \a rollover have been set
  2270. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2271. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a value or \a rollover are NULL
  2272. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2273. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2274. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2275. */
  2276. nvmlReturn_t DECLDIR nvmlDeviceGetPcieReplayCounter(nvmlDevice_t device, unsigned int *value);
  2277. /**
  2278. * Retrieves the current clock speeds for the device.
  2279. *
  2280. * For Fermi &tm; or newer fully supported devices.
  2281. *
  2282. * See \ref nvmlClockType_t for details on available clock information.
  2283. *
  2284. * @param device The identifier of the target device
  2285. * @param type Identify which clock domain to query
  2286. * @param clock Reference in which to return the clock speed in MHz
  2287. *
  2288. * @return
  2289. * - \ref NVML_SUCCESS if \a clock has been set
  2290. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2291. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clock is NULL
  2292. * - \ref NVML_ERROR_NOT_SUPPORTED if the device cannot report the specified clock
  2293. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2294. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2295. */
  2296. nvmlReturn_t DECLDIR nvmlDeviceGetClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock);
  2297. /**
  2298. * Retrieves the maximum clock speeds for the device.
  2299. *
  2300. * For Fermi &tm; or newer fully supported devices.
  2301. *
  2302. * See \ref nvmlClockType_t for details on available clock information.
  2303. *
  2304. * \note On GPUs from Fermi family current P0 clocks (reported by \ref nvmlDeviceGetClockInfo) can differ from max clocks
  2305. * by few MHz.
  2306. *
  2307. * @param device The identifier of the target device
  2308. * @param type Identify which clock domain to query
  2309. * @param clock Reference in which to return the clock speed in MHz
  2310. *
  2311. * @return
  2312. * - \ref NVML_SUCCESS if \a clock has been set
  2313. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2314. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clock is NULL
  2315. * - \ref NVML_ERROR_NOT_SUPPORTED if the device cannot report the specified clock
  2316. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2317. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2318. */
  2319. nvmlReturn_t DECLDIR nvmlDeviceGetMaxClockInfo(nvmlDevice_t device, nvmlClockType_t type, unsigned int *clock);
  2320. /**
  2321. * Retrieves the current setting of a clock that applications will use unless an overspec situation occurs.
  2322. * Can be changed using \ref nvmlDeviceSetApplicationsClocks.
  2323. *
  2324. * For Kepler &tm; or newer fully supported devices.
  2325. *
  2326. * @param device The identifier of the target device
  2327. * @param clockType Identify which clock domain to query
  2328. * @param clockMHz Reference in which to return the clock in MHz
  2329. *
  2330. * @return
  2331. * - \ref NVML_SUCCESS if \a clockMHz has been set
  2332. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2333. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid
  2334. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2335. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2336. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2337. */
  2338. nvmlReturn_t DECLDIR nvmlDeviceGetApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz);
  2339. /**
  2340. * Retrieves the default applications clock that GPU boots with or
  2341. * defaults to after \ref nvmlDeviceResetApplicationsClocks call.
  2342. *
  2343. * For Kepler &tm; or newer fully supported devices.
  2344. *
  2345. * @param device The identifier of the target device
  2346. * @param clockType Identify which clock domain to query
  2347. * @param clockMHz Reference in which to return the default clock in MHz
  2348. *
  2349. * @return
  2350. * - \ref NVML_SUCCESS if \a clockMHz has been set
  2351. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2352. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid
  2353. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2354. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2355. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2356. *
  2357. * \see nvmlDeviceGetApplicationsClock
  2358. */
  2359. nvmlReturn_t DECLDIR nvmlDeviceGetDefaultApplicationsClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz);
  2360. /**
  2361. * Resets the application clock to the default value
  2362. *
  2363. * This is the applications clock that will be used after system reboot or driver reload.
  2364. * Default value is constant, but the current value an be changed using \ref nvmlDeviceSetApplicationsClocks.
  2365. *
  2366. * On Pascal and newer hardware, if clocks were previously locked with \ref nvmlDeviceSetApplicationsClocks,
  2367. * this call will unlock clocks. This returns clocks their default behavior ofautomatically boosting above
  2368. * base clocks as thermal limits allow.
  2369. *
  2370. * @see nvmlDeviceGetApplicationsClock
  2371. * @see nvmlDeviceSetApplicationsClocks
  2372. *
  2373. * For Fermi &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices.
  2374. *
  2375. * @param device The identifier of the target device
  2376. *
  2377. * @return
  2378. * - \ref NVML_SUCCESS if new settings were successfully set
  2379. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2380. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid
  2381. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2382. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2383. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2384. */
  2385. nvmlReturn_t DECLDIR nvmlDeviceResetApplicationsClocks(nvmlDevice_t device);
  2386. /**
  2387. * Retrieves the clock speed for the clock specified by the clock type and clock ID.
  2388. *
  2389. * For Kepler &tm; or newer fully supported devices.
  2390. *
  2391. * @param device The identifier of the target device
  2392. * @param clockType Identify which clock domain to query
  2393. * @param clockId Identify which clock in the domain to query
  2394. * @param clockMHz Reference in which to return the clock in MHz
  2395. *
  2396. * @return
  2397. * - \ref NVML_SUCCESS if \a clockMHz has been set
  2398. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2399. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid
  2400. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2401. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2402. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2403. */
  2404. nvmlReturn_t DECLDIR nvmlDeviceGetClock(nvmlDevice_t device, nvmlClockType_t clockType, nvmlClockId_t clockId, unsigned int *clockMHz);
  2405. /**
  2406. * Retrieves the customer defined maximum boost clock speed specified by the given clock type.
  2407. *
  2408. * For Pascal &tm; or newer fully supported devices.
  2409. *
  2410. * @param device The identifier of the target device
  2411. * @param clockType Identify which clock domain to query
  2412. * @param clockMHz Reference in which to return the clock in MHz
  2413. *
  2414. * @return
  2415. * - \ref NVML_SUCCESS if \a clockMHz has been set
  2416. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2417. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clockMHz is NULL or \a clockType is invalid
  2418. * - \ref NVML_ERROR_NOT_SUPPORTED if the device or the \a clockType on this device does not support this feature
  2419. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2420. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2421. */
  2422. nvmlReturn_t DECLDIR nvmlDeviceGetMaxCustomerBoostClock(nvmlDevice_t device, nvmlClockType_t clockType, unsigned int *clockMHz);
  2423. /**
  2424. * Retrieves the list of possible memory clocks that can be used as an argument for \ref nvmlDeviceSetApplicationsClocks.
  2425. *
  2426. * For Kepler &tm; or newer fully supported devices.
  2427. *
  2428. * @param device The identifier of the target device
  2429. * @param count Reference in which to provide the \a clocksMHz array size, and
  2430. * to return the number of elements
  2431. * @param clocksMHz Reference in which to return the clock in MHz
  2432. *
  2433. * @return
  2434. * - \ref NVML_SUCCESS if \a count and \a clocksMHz have been populated
  2435. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2436. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a count is NULL
  2437. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2438. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a count is too small (\a count is set to the number of
  2439. * required elements)
  2440. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2441. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2442. *
  2443. * @see nvmlDeviceSetApplicationsClocks
  2444. * @see nvmlDeviceGetSupportedGraphicsClocks
  2445. */
  2446. nvmlReturn_t DECLDIR nvmlDeviceGetSupportedMemoryClocks(nvmlDevice_t device, unsigned int *count, unsigned int *clocksMHz);
  2447. /**
  2448. * Retrieves the list of possible graphics clocks that can be used as an argument for \ref nvmlDeviceSetApplicationsClocks.
  2449. *
  2450. * For Kepler &tm; or newer fully supported devices.
  2451. *
  2452. * @param device The identifier of the target device
  2453. * @param memoryClockMHz Memory clock for which to return possible graphics clocks
  2454. * @param count Reference in which to provide the \a clocksMHz array size, and
  2455. * to return the number of elements
  2456. * @param clocksMHz Reference in which to return the clocks in MHz
  2457. *
  2458. * @return
  2459. * - \ref NVML_SUCCESS if \a count and \a clocksMHz have been populated
  2460. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2461. * - \ref NVML_ERROR_NOT_FOUND if the specified \a memoryClockMHz is not a supported frequency
  2462. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clock is NULL
  2463. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2464. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a count is too small
  2465. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2466. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2467. *
  2468. * @see nvmlDeviceSetApplicationsClocks
  2469. * @see nvmlDeviceGetSupportedMemoryClocks
  2470. */
  2471. nvmlReturn_t DECLDIR nvmlDeviceGetSupportedGraphicsClocks(nvmlDevice_t device, unsigned int memoryClockMHz, unsigned int *count, unsigned int *clocksMHz);
  2472. /**
  2473. * Retrieve the current state of Auto Boosted clocks on a device and store it in \a isEnabled
  2474. *
  2475. * For Kepler &tm; or newer fully supported devices.
  2476. *
  2477. * Auto Boosted clocks are enabled by default on some hardware, allowing the GPU to run at higher clock rates
  2478. * to maximize performance as thermal limits allow.
  2479. *
  2480. * On Pascal and newer hardware, Auto Aoosted clocks are controlled through application clocks.
  2481. * Use \ref nvmlDeviceSetApplicationsClocks and \ref nvmlDeviceResetApplicationsClocks to control Auto Boost
  2482. * behavior.
  2483. *
  2484. * @param device The identifier of the target device
  2485. * @param isEnabled Where to store the current state of Auto Boosted clocks of the target device
  2486. * @param defaultIsEnabled Where to store the default Auto Boosted clocks behavior of the target device that the device will
  2487. * revert to when no applications are using the GPU
  2488. *
  2489. * @return
  2490. * - \ref NVML_SUCCESS If \a isEnabled has been been set with the Auto Boosted clocks state of \a device
  2491. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2492. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a isEnabled is NULL
  2493. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support Auto Boosted clocks
  2494. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2495. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2496. *
  2497. */
  2498. nvmlReturn_t DECLDIR nvmlDeviceGetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t *isEnabled, nvmlEnableState_t *defaultIsEnabled);
  2499. /**
  2500. * Try to set the current state of Auto Boosted clocks on a device.
  2501. *
  2502. * For Kepler &tm; or newer fully supported devices.
  2503. *
  2504. * Auto Boosted clocks are enabled by default on some hardware, allowing the GPU to run at higher clock rates
  2505. * to maximize performance as thermal limits allow. Auto Boosted clocks should be disabled if fixed clock
  2506. * rates are desired.
  2507. *
  2508. * Non-root users may use this API by default but can be restricted by root from using this API by calling
  2509. * \ref nvmlDeviceSetAPIRestriction with apiType=NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS.
  2510. * Note: Persistence Mode is required to modify current Auto Boost settings, therefore, it must be enabled.
  2511. *
  2512. * On Pascal and newer hardware, Auto Boosted clocks are controlled through application clocks.
  2513. * Use \ref nvmlDeviceSetApplicationsClocks and \ref nvmlDeviceResetApplicationsClocks to control Auto Boost
  2514. * behavior.
  2515. *
  2516. * @param device The identifier of the target device
  2517. * @param enabled What state to try to set Auto Boosted clocks of the target device to
  2518. *
  2519. * @return
  2520. * - \ref NVML_SUCCESS If the Auto Boosted clocks were successfully set to the state specified by \a enabled
  2521. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2522. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid
  2523. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support Auto Boosted clocks
  2524. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2525. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2526. *
  2527. */
  2528. nvmlReturn_t DECLDIR nvmlDeviceSetAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled);
  2529. /**
  2530. * Try to set the default state of Auto Boosted clocks on a device. This is the default state that Auto Boosted clocks will
  2531. * return to when no compute running processes (e.g. CUDA application which have an active context) are running
  2532. *
  2533. * For Kepler &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices.
  2534. * Requires root/admin permissions.
  2535. *
  2536. * Auto Boosted clocks are enabled by default on some hardware, allowing the GPU to run at higher clock rates
  2537. * to maximize performance as thermal limits allow. Auto Boosted clocks should be disabled if fixed clock
  2538. * rates are desired.
  2539. *
  2540. * On Pascal and newer hardware, Auto Boosted clocks are controlled through application clocks.
  2541. * Use \ref nvmlDeviceSetApplicationsClocks and \ref nvmlDeviceResetApplicationsClocks to control Auto Boost
  2542. * behavior.
  2543. *
  2544. * @param device The identifier of the target device
  2545. * @param enabled What state to try to set default Auto Boosted clocks of the target device to
  2546. * @param flags Flags that change the default behavior. Currently Unused.
  2547. *
  2548. * @return
  2549. * - \ref NVML_SUCCESS If the Auto Boosted clock's default state was successfully set to the state specified by \a enabled
  2550. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2551. * - \ref NVML_ERROR_NO_PERMISSION If the calling user does not have permission to change Auto Boosted clock's default state.
  2552. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid
  2553. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support Auto Boosted clocks
  2554. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2555. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2556. *
  2557. */
  2558. nvmlReturn_t DECLDIR nvmlDeviceSetDefaultAutoBoostedClocksEnabled(nvmlDevice_t device, nvmlEnableState_t enabled, unsigned int flags);
  2559. /**
  2560. * Retrieves the intended operating speed of the device's fan.
  2561. *
  2562. * Note: The reported speed is the intended fan speed. If the fan is physically blocked and unable to spin, the
  2563. * output will not match the actual fan speed.
  2564. *
  2565. * For all discrete products with dedicated fans.
  2566. *
  2567. * The fan speed is expressed as a percent of the maximum, i.e. full speed is 100%.
  2568. *
  2569. * @param device The identifier of the target device
  2570. * @param speed Reference in which to return the fan speed percentage
  2571. *
  2572. * @return
  2573. * - \ref NVML_SUCCESS if \a speed has been set
  2574. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2575. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a speed is NULL
  2576. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not have a fan
  2577. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2578. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2579. */
  2580. nvmlReturn_t DECLDIR nvmlDeviceGetFanSpeed(nvmlDevice_t device, unsigned int *speed);
  2581. /**
  2582. * Retrieves the current temperature readings for the device, in degrees C.
  2583. *
  2584. * For all products.
  2585. *
  2586. * See \ref nvmlTemperatureSensors_t for details on available temperature sensors.
  2587. *
  2588. * @param device The identifier of the target device
  2589. * @param sensorType Flag that indicates which sensor reading to retrieve
  2590. * @param temp Reference in which to return the temperature reading
  2591. *
  2592. * @return
  2593. * - \ref NVML_SUCCESS if \a temp has been set
  2594. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2595. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a sensorType is invalid or \a temp is NULL
  2596. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not have the specified sensor
  2597. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2598. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2599. */
  2600. nvmlReturn_t DECLDIR nvmlDeviceGetTemperature(nvmlDevice_t device, nvmlTemperatureSensors_t sensorType, unsigned int *temp);
  2601. /**
  2602. * Retrieves the temperature threshold for the GPU with the specified threshold type in degrees C.
  2603. *
  2604. * For Kepler &tm; or newer fully supported devices.
  2605. *
  2606. * See \ref nvmlTemperatureThresholds_t for details on available temperature thresholds.
  2607. *
  2608. * @param device The identifier of the target device
  2609. * @param thresholdType The type of threshold value queried
  2610. * @param temp Reference in which to return the temperature reading
  2611. * @return
  2612. * - \ref NVML_SUCCESS if \a temp has been set
  2613. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2614. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a thresholdType is invalid or \a temp is NULL
  2615. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not have a temperature sensor or is unsupported
  2616. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2617. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2618. */
  2619. nvmlReturn_t DECLDIR nvmlDeviceGetTemperatureThreshold(nvmlDevice_t device, nvmlTemperatureThresholds_t thresholdType, unsigned int *temp);
  2620. /**
  2621. * Retrieves the current performance state for the device.
  2622. *
  2623. * For Fermi &tm; or newer fully supported devices.
  2624. *
  2625. * See \ref nvmlPstates_t for details on allowed performance states.
  2626. *
  2627. * @param device The identifier of the target device
  2628. * @param pState Reference in which to return the performance state reading
  2629. *
  2630. * @return
  2631. * - \ref NVML_SUCCESS if \a pState has been set
  2632. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2633. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pState is NULL
  2634. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2635. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2636. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2637. */
  2638. nvmlReturn_t DECLDIR nvmlDeviceGetPerformanceState(nvmlDevice_t device, nvmlPstates_t *pState);
  2639. /**
  2640. * Retrieves current clocks throttling reasons.
  2641. *
  2642. * For all fully supported products.
  2643. *
  2644. * \note More than one bit can be enabled at the same time. Multiple reasons can be affecting clocks at once.
  2645. *
  2646. * @param device The identifier of the target device
  2647. * @param clocksThrottleReasons Reference in which to return bitmask of active clocks throttle
  2648. * reasons
  2649. *
  2650. * @return
  2651. * - \ref NVML_SUCCESS if \a clocksThrottleReasons has been set
  2652. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2653. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a clocksThrottleReasons is NULL
  2654. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2655. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2656. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2657. *
  2658. * @see nvmlClocksThrottleReasons
  2659. * @see nvmlDeviceGetSupportedClocksThrottleReasons
  2660. */
  2661. nvmlReturn_t DECLDIR nvmlDeviceGetCurrentClocksThrottleReasons(nvmlDevice_t device, unsigned long long *clocksThrottleReasons);
  2662. /**
  2663. * Retrieves bitmask of supported clocks throttle reasons that can be returned by
  2664. * \ref nvmlDeviceGetCurrentClocksThrottleReasons
  2665. *
  2666. * For all fully supported products.
  2667. *
  2668. * This method is not supported in virtual machines running virtual GPU (vGPU).
  2669. *
  2670. * @param device The identifier of the target device
  2671. * @param supportedClocksThrottleReasons Reference in which to return bitmask of supported
  2672. * clocks throttle reasons
  2673. *
  2674. * @return
  2675. * - \ref NVML_SUCCESS if \a supportedClocksThrottleReasons has been set
  2676. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2677. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a supportedClocksThrottleReasons is NULL
  2678. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2679. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2680. *
  2681. * @see nvmlClocksThrottleReasons
  2682. * @see nvmlDeviceGetCurrentClocksThrottleReasons
  2683. */
  2684. nvmlReturn_t DECLDIR nvmlDeviceGetSupportedClocksThrottleReasons(nvmlDevice_t device, unsigned long long *supportedClocksThrottleReasons);
  2685. /**
  2686. * Deprecated: Use \ref nvmlDeviceGetPerformanceState. This function exposes an incorrect generalization.
  2687. *
  2688. * Retrieve the current performance state for the device.
  2689. *
  2690. * For Fermi &tm; or newer fully supported devices.
  2691. *
  2692. * See \ref nvmlPstates_t for details on allowed performance states.
  2693. *
  2694. * @param device The identifier of the target device
  2695. * @param pState Reference in which to return the performance state reading
  2696. *
  2697. * @return
  2698. * - \ref NVML_SUCCESS if \a pState has been set
  2699. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2700. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pState is NULL
  2701. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2702. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2703. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2704. */
  2705. nvmlReturn_t DECLDIR nvmlDeviceGetPowerState(nvmlDevice_t device, nvmlPstates_t *pState);
  2706. /**
  2707. * This API has been deprecated.
  2708. *
  2709. * Retrieves the power management mode associated with this device.
  2710. *
  2711. * For products from the Fermi family.
  2712. * - Requires \a NVML_INFOROM_POWER version 3.0 or higher.
  2713. *
  2714. * For from the Kepler or newer families.
  2715. * - Does not require \a NVML_INFOROM_POWER object.
  2716. *
  2717. * This flag indicates whether any power management algorithm is currently active on the device. An
  2718. * enabled state does not necessarily mean the device is being actively throttled -- only that
  2719. * that the driver will do so if the appropriate conditions are met.
  2720. *
  2721. * See \ref nvmlEnableState_t for details on allowed modes.
  2722. *
  2723. * @param device The identifier of the target device
  2724. * @param mode Reference in which to return the current power management mode
  2725. *
  2726. * @return
  2727. * - \ref NVML_SUCCESS if \a mode has been set
  2728. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2729. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode is NULL
  2730. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2731. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2732. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2733. */
  2734. nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementMode(nvmlDevice_t device, nvmlEnableState_t *mode);
  2735. /**
  2736. * Retrieves the power management limit associated with this device.
  2737. *
  2738. * For Fermi &tm; or newer fully supported devices.
  2739. *
  2740. * The power limit defines the upper boundary for the card's power draw. If
  2741. * the card's total power draw reaches this limit the power management algorithm kicks in.
  2742. *
  2743. * This reading is only available if power management mode is supported.
  2744. * See \ref nvmlDeviceGetPowerManagementMode.
  2745. *
  2746. * @param device The identifier of the target device
  2747. * @param limit Reference in which to return the power management limit in milliwatts
  2748. *
  2749. * @return
  2750. * - \ref NVML_SUCCESS if \a limit has been set
  2751. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2752. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a limit is NULL
  2753. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2754. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2755. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2756. */
  2757. nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int *limit);
  2758. /**
  2759. * Retrieves information about possible values of power management limits on this device.
  2760. *
  2761. * For Kepler &tm; or newer fully supported devices.
  2762. *
  2763. * @param device The identifier of the target device
  2764. * @param minLimit Reference in which to return the minimum power management limit in milliwatts
  2765. * @param maxLimit Reference in which to return the maximum power management limit in milliwatts
  2766. *
  2767. * @return
  2768. * - \ref NVML_SUCCESS if \a minLimit and \a maxLimit have been set
  2769. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2770. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a minLimit or \a maxLimit is NULL
  2771. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2772. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2773. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2774. *
  2775. * @see nvmlDeviceSetPowerManagementLimit
  2776. */
  2777. nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit);
  2778. /**
  2779. * Retrieves default power management limit on this device, in milliwatts.
  2780. * Default power management limit is a power management limit that the device boots with.
  2781. *
  2782. * For Kepler &tm; or newer fully supported devices.
  2783. *
  2784. * @param device The identifier of the target device
  2785. * @param defaultLimit Reference in which to return the default power management limit in milliwatts
  2786. *
  2787. * @return
  2788. * - \ref NVML_SUCCESS if \a defaultLimit has been set
  2789. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2790. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a defaultLimit is NULL
  2791. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2792. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2793. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2794. */
  2795. nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementDefaultLimit(nvmlDevice_t device, unsigned int *defaultLimit);
  2796. /**
  2797. * Retrieves power usage for this GPU in milliwatts and its associated circuitry (e.g. memory)
  2798. *
  2799. * For Fermi &tm; or newer fully supported devices.
  2800. *
  2801. * On Fermi and Kepler GPUs the reading is accurate to within +/- 5% of current power draw.
  2802. *
  2803. * It is only available if power management mode is supported. See \ref nvmlDeviceGetPowerManagementMode.
  2804. *
  2805. * @param device The identifier of the target device
  2806. * @param power Reference in which to return the power usage information
  2807. *
  2808. * @return
  2809. * - \ref NVML_SUCCESS if \a power has been populated
  2810. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2811. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a power is NULL
  2812. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support power readings
  2813. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2814. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2815. */
  2816. nvmlReturn_t DECLDIR nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int *power);
  2817. /**
  2818. * Retrieves total energy consumption for this GPU in millijoules (mJ) since the driver was last reloaded
  2819. *
  2820. * For newer than Pascal &tm; fully supported devices.
  2821. *
  2822. * @param device The identifier of the target device
  2823. * @param energy Reference in which to return the energy consumption information
  2824. *
  2825. * @return
  2826. * - \ref NVML_SUCCESS if \a energy has been populated
  2827. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2828. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a energy is NULL
  2829. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support energy readings
  2830. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2831. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2832. */
  2833. nvmlReturn_t DECLDIR nvmlDeviceGetTotalEnergyConsumption(nvmlDevice_t device, unsigned long long *energy);
  2834. /**
  2835. * Get the effective power limit that the driver enforces after taking into account all limiters
  2836. *
  2837. * Note: This can be different from the \ref nvmlDeviceGetPowerManagementLimit if other limits are set elsewhere
  2838. * This includes the out of band power limit interface
  2839. *
  2840. * For Kepler &tm; or newer fully supported devices.
  2841. *
  2842. * @param device The device to communicate with
  2843. * @param limit Reference in which to return the power management limit in milliwatts
  2844. *
  2845. * @return
  2846. * - \ref NVML_SUCCESS if \a limit has been set
  2847. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2848. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a limit is NULL
  2849. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2850. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2851. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2852. */
  2853. nvmlReturn_t DECLDIR nvmlDeviceGetEnforcedPowerLimit(nvmlDevice_t device, unsigned int *limit);
  2854. /**
  2855. * Retrieves the current GOM and pending GOM (the one that GPU will switch to after reboot).
  2856. *
  2857. * For GK110 M-class and X-class Tesla &tm; products from the Kepler family.
  2858. * Modes \ref NVML_GOM_LOW_DP and \ref NVML_GOM_ALL_ON are supported on fully supported GeForce products.
  2859. * Not supported on Quadro &reg; and Tesla &tm; C-class products.
  2860. *
  2861. * @param device The identifier of the target device
  2862. * @param current Reference in which to return the current GOM
  2863. * @param pending Reference in which to return the pending GOM
  2864. *
  2865. * @return
  2866. * - \ref NVML_SUCCESS if \a mode has been populated
  2867. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2868. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a current or \a pending is NULL
  2869. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2870. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2871. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2872. *
  2873. * @see nvmlGpuOperationMode_t
  2874. * @see nvmlDeviceSetGpuOperationMode
  2875. */
  2876. nvmlReturn_t DECLDIR nvmlDeviceGetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t *current, nvmlGpuOperationMode_t *pending);
  2877. /**
  2878. * Retrieves the amount of used, free and total memory available on the device, in bytes.
  2879. *
  2880. * For all products.
  2881. *
  2882. * Enabling ECC reduces the amount of total available memory, due to the extra required parity bits.
  2883. * Under WDDM most device memory is allocated and managed on startup by Windows.
  2884. *
  2885. * Under Linux and Windows TCC, the reported amount of used memory is equal to the sum of memory allocated
  2886. * by all active channels on the device.
  2887. *
  2888. * See \ref nvmlMemory_t for details on available memory info.
  2889. *
  2890. * @param device The identifier of the target device
  2891. * @param memory Reference in which to return the memory information
  2892. *
  2893. * @return
  2894. * - \ref NVML_SUCCESS if \a memory has been populated
  2895. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2896. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memory is NULL
  2897. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2898. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2899. */
  2900. nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo(nvmlDevice_t device, nvmlMemory_t *memory);
  2901. /**
  2902. * Retrieves the current compute mode for the device.
  2903. *
  2904. * For all products.
  2905. *
  2906. * See \ref nvmlComputeMode_t for details on allowed compute modes.
  2907. *
  2908. * @param device The identifier of the target device
  2909. * @param mode Reference in which to return the current compute mode
  2910. *
  2911. * @return
  2912. * - \ref NVML_SUCCESS if \a mode has been set
  2913. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2914. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode is NULL
  2915. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2916. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2917. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2918. *
  2919. * @see nvmlDeviceSetComputeMode()
  2920. */
  2921. nvmlReturn_t DECLDIR nvmlDeviceGetComputeMode(nvmlDevice_t device, nvmlComputeMode_t *mode);
  2922. /**
  2923. * Retrieves the CUDA compute capability of the device.
  2924. *
  2925. * For all products.
  2926. *
  2927. * Returns the major and minor compute capability version numbers of the
  2928. * device. The major and minor versions are equivalent to the
  2929. * CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR and
  2930. * CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR attributes that would be
  2931. * returned by CUDA's cuDeviceGetAttribute().
  2932. *
  2933. * @param device The identifier of the target device
  2934. * @param major Reference in which to return the major CUDA compute capability
  2935. * @param minor Reference in which to return the minor CUDA compute capability
  2936. *
  2937. * @return
  2938. * - \ref NVML_SUCCESS if \a major and \a minor have been set
  2939. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2940. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a major or \a minor are NULL
  2941. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2942. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2943. */
  2944. nvmlReturn_t DECLDIR nvmlDeviceGetCudaComputeCapability(nvmlDevice_t device, int *major, int *minor);
  2945. /**
  2946. * Retrieves the current and pending ECC modes for the device.
  2947. *
  2948. * For Fermi &tm; or newer fully supported devices.
  2949. * Only applicable to devices with ECC.
  2950. * Requires \a NVML_INFOROM_ECC version 1.0 or higher.
  2951. *
  2952. * Changing ECC modes requires a reboot. The "pending" ECC mode refers to the target mode following
  2953. * the next reboot.
  2954. *
  2955. * See \ref nvmlEnableState_t for details on allowed modes.
  2956. *
  2957. * @param device The identifier of the target device
  2958. * @param current Reference in which to return the current ECC mode
  2959. * @param pending Reference in which to return the pending ECC mode
  2960. *
  2961. * @return
  2962. * - \ref NVML_SUCCESS if \a current and \a pending have been set
  2963. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2964. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or either \a current or \a pending is NULL
  2965. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2966. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2967. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2968. *
  2969. * @see nvmlDeviceSetEccMode()
  2970. */
  2971. nvmlReturn_t DECLDIR nvmlDeviceGetEccMode(nvmlDevice_t device, nvmlEnableState_t *current, nvmlEnableState_t *pending);
  2972. /**
  2973. * Retrieves the device boardId from 0-N.
  2974. * Devices with the same boardId indicate GPUs connected to the same PLX. Use in conjunction with
  2975. * \ref nvmlDeviceGetMultiGpuBoard() to decide if they are on the same board as well.
  2976. * The boardId returned is a unique ID for the current configuration. Uniqueness and ordering across
  2977. * reboots and system configurations is not guaranteed (i.e. if a Tesla K40c returns 0x100 and
  2978. * the two GPUs on a Tesla K10 in the same system returns 0x200 it is not guaranteed they will
  2979. * always return those values but they will always be different from each other).
  2980. *
  2981. *
  2982. * For Fermi &tm; or newer fully supported devices.
  2983. *
  2984. * @param device The identifier of the target device
  2985. * @param boardId Reference in which to return the device's board ID
  2986. *
  2987. * @return
  2988. * - \ref NVML_SUCCESS if \a boardId has been set
  2989. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  2990. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a boardId is NULL
  2991. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  2992. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  2993. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  2994. */
  2995. nvmlReturn_t DECLDIR nvmlDeviceGetBoardId(nvmlDevice_t device, unsigned int *boardId);
  2996. /**
  2997. * Retrieves whether the device is on a Multi-GPU Board
  2998. * Devices that are on multi-GPU boards will set \a multiGpuBool to a non-zero value.
  2999. *
  3000. * For Fermi &tm; or newer fully supported devices.
  3001. *
  3002. * @param device The identifier of the target device
  3003. * @param multiGpuBool Reference in which to return a zero or non-zero value
  3004. * to indicate whether the device is on a multi GPU board
  3005. *
  3006. * @return
  3007. * - \ref NVML_SUCCESS if \a multiGpuBool has been set
  3008. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3009. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a multiGpuBool is NULL
  3010. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3011. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3012. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3013. */
  3014. nvmlReturn_t DECLDIR nvmlDeviceGetMultiGpuBoard(nvmlDevice_t device, unsigned int *multiGpuBool);
  3015. /**
  3016. * Retrieves the total ECC error counts for the device.
  3017. *
  3018. * For Fermi &tm; or newer fully supported devices.
  3019. * Only applicable to devices with ECC.
  3020. * Requires \a NVML_INFOROM_ECC version 1.0 or higher.
  3021. * Requires ECC Mode to be enabled.
  3022. *
  3023. * The total error count is the sum of errors across each of the separate memory systems, i.e. the total set of
  3024. * errors across the entire device.
  3025. *
  3026. * See \ref nvmlMemoryErrorType_t for a description of available error types.\n
  3027. * See \ref nvmlEccCounterType_t for a description of available counter types.
  3028. *
  3029. * @param device The identifier of the target device
  3030. * @param errorType Flag that specifies the type of the errors.
  3031. * @param counterType Flag that specifies the counter-type of the errors.
  3032. * @param eccCounts Reference in which to return the specified ECC errors
  3033. *
  3034. * @return
  3035. * - \ref NVML_SUCCESS if \a eccCounts has been set
  3036. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3037. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a errorType or \a counterType is invalid, or \a eccCounts is NULL
  3038. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3039. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3040. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3041. *
  3042. * @see nvmlDeviceClearEccErrorCounts()
  3043. */
  3044. nvmlReturn_t DECLDIR nvmlDeviceGetTotalEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, unsigned long long *eccCounts);
  3045. /**
  3046. * Retrieves the detailed ECC error counts for the device.
  3047. *
  3048. * @deprecated This API supports only a fixed set of ECC error locations
  3049. * On different GPU architectures different locations are supported
  3050. * See \ref nvmlDeviceGetMemoryErrorCounter
  3051. *
  3052. * For Fermi &tm; or newer fully supported devices.
  3053. * Only applicable to devices with ECC.
  3054. * Requires \a NVML_INFOROM_ECC version 2.0 or higher to report aggregate location-based ECC counts.
  3055. * Requires \a NVML_INFOROM_ECC version 1.0 or higher to report all other ECC counts.
  3056. * Requires ECC Mode to be enabled.
  3057. *
  3058. * Detailed errors provide separate ECC counts for specific parts of the memory system.
  3059. *
  3060. * Reports zero for unsupported ECC error counters when a subset of ECC error counters are supported.
  3061. *
  3062. * See \ref nvmlMemoryErrorType_t for a description of available bit types.\n
  3063. * See \ref nvmlEccCounterType_t for a description of available counter types.\n
  3064. * See \ref nvmlEccErrorCounts_t for a description of provided detailed ECC counts.
  3065. *
  3066. * @param device The identifier of the target device
  3067. * @param errorType Flag that specifies the type of the errors.
  3068. * @param counterType Flag that specifies the counter-type of the errors.
  3069. * @param eccCounts Reference in which to return the specified ECC errors
  3070. *
  3071. * @return
  3072. * - \ref NVML_SUCCESS if \a eccCounts has been populated
  3073. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3074. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a errorType or \a counterType is invalid, or \a eccCounts is NULL
  3075. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3076. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3077. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3078. *
  3079. * @see nvmlDeviceClearEccErrorCounts()
  3080. */
  3081. nvmlReturn_t DECLDIR nvmlDeviceGetDetailedEccErrors(nvmlDevice_t device, nvmlMemoryErrorType_t errorType, nvmlEccCounterType_t counterType, nvmlEccErrorCounts_t *eccCounts);
  3082. /**
  3083. * Retrieves the requested memory error counter for the device.
  3084. *
  3085. * For Fermi &tm; or newer fully supported devices.
  3086. * Requires \a NVML_INFOROM_ECC version 2.0 or higher to report aggregate location-based memory error counts.
  3087. * Requires \a NVML_INFOROM_ECC version 1.0 or higher to report all other memory error counts.
  3088. *
  3089. * Only applicable to devices with ECC.
  3090. *
  3091. * Requires ECC Mode to be enabled.
  3092. *
  3093. * See \ref nvmlMemoryErrorType_t for a description of available memory error types.\n
  3094. * See \ref nvmlEccCounterType_t for a description of available counter types.\n
  3095. * See \ref nvmlMemoryLocation_t for a description of available counter locations.\n
  3096. *
  3097. * @param device The identifier of the target device
  3098. * @param errorType Flag that specifies the type of error.
  3099. * @param counterType Flag that specifies the counter-type of the errors.
  3100. * @param locationType Specifies the location of the counter.
  3101. * @param count Reference in which to return the ECC counter
  3102. *
  3103. * @return
  3104. * - \ref NVML_SUCCESS if \a count has been populated
  3105. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3106. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a bitTyp,e \a counterType or \a locationType is
  3107. * invalid, or \a count is NULL
  3108. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support ECC error reporting in the specified memory
  3109. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3110. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3111. */
  3112. nvmlReturn_t DECLDIR nvmlDeviceGetMemoryErrorCounter(nvmlDevice_t device, nvmlMemoryErrorType_t errorType,
  3113. nvmlEccCounterType_t counterType,
  3114. nvmlMemoryLocation_t locationType, unsigned long long *count);
  3115. /**
  3116. * Retrieves the current utilization rates for the device's major subsystems.
  3117. *
  3118. * For Fermi &tm; or newer fully supported devices.
  3119. *
  3120. * See \ref nvmlUtilization_t for details on available utilization rates.
  3121. *
  3122. * \note During driver initialization when ECC is enabled one can see high GPU and Memory Utilization readings.
  3123. * This is caused by ECC Memory Scrubbing mechanism that is performed during driver initialization.
  3124. *
  3125. * @param device The identifier of the target device
  3126. * @param utilization Reference in which to return the utilization information
  3127. *
  3128. * @return
  3129. * - \ref NVML_SUCCESS if \a utilization has been populated
  3130. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3131. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a utilization is NULL
  3132. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3133. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3134. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3135. */
  3136. nvmlReturn_t DECLDIR nvmlDeviceGetUtilizationRates(nvmlDevice_t device, nvmlUtilization_t *utilization);
  3137. /**
  3138. * Retrieves the current utilization and sampling size in microseconds for the Encoder
  3139. *
  3140. * For Kepler &tm; or newer fully supported devices.
  3141. *
  3142. * @param device The identifier of the target device
  3143. * @param utilization Reference to an unsigned int for encoder utilization info
  3144. * @param samplingPeriodUs Reference to an unsigned int for the sampling period in US
  3145. *
  3146. * @return
  3147. * - \ref NVML_SUCCESS if \a utilization has been populated
  3148. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3149. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a utilization is NULL, or \a samplingPeriodUs is NULL
  3150. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3151. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3152. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3153. */
  3154. nvmlReturn_t DECLDIR nvmlDeviceGetEncoderUtilization(nvmlDevice_t device, unsigned int *utilization, unsigned int *samplingPeriodUs);
  3155. /**
  3156. * Retrieves the current capacity of the device's encoder, in macroblocks per second.
  3157. *
  3158. * For Maxwell &tm; or newer fully supported devices.
  3159. *
  3160. * @param device The identifier of the target device
  3161. * @param encoderQueryType Type of encoder to query
  3162. * @param encoderCapacity Reference to an unsigned int for the encoder capacity
  3163. *
  3164. * @return
  3165. * - \ref NVML_SUCCESS if \a encoderCapacity is fetched
  3166. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3167. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a encoderCapacity is NULL, or \a device or \a encoderQueryType
  3168. * are invalid
  3169. * - \ref NVML_ERROR_NOT_SUPPORTED if device does not support the encoder specified in \a encodeQueryType
  3170. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3171. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3172. */
  3173. nvmlReturn_t DECLDIR nvmlDeviceGetEncoderCapacity (nvmlDevice_t device, nvmlEncoderType_t encoderQueryType, unsigned int *encoderCapacity);
  3174. /**
  3175. * Retrieves the current encoder statistics for a given device.
  3176. *
  3177. * For Maxwell &tm; or newer fully supported devices.
  3178. *
  3179. * @param device The identifier of the target device
  3180. * @param sessionCount Reference to an unsigned int for count of active encoder sessions
  3181. * @param averageFps Reference to an unsigned int for trailing average FPS of all active sessions
  3182. * @param averageLatency Reference to an unsigned int for encode latency in microseconds
  3183. *
  3184. * @return
  3185. * - \ref NVML_SUCCESS if \a sessionCount, \a averageFps and \a averageLatency is fetched
  3186. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3187. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount, or \a device or \a averageFps,
  3188. * or \a averageLatency is NULL
  3189. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3190. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3191. */
  3192. nvmlReturn_t DECLDIR nvmlDeviceGetEncoderStats (nvmlDevice_t device, unsigned int *sessionCount,
  3193. unsigned int *averageFps, unsigned int *averageLatency);
  3194. /**
  3195. * Retrieves information about active encoder sessions on a target device.
  3196. *
  3197. * An array of active encoder sessions is returned in the caller-supplied buffer pointed at by \a sessionInfos. The
  3198. * array elememt count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions
  3199. * written to the buffer.
  3200. *
  3201. * If the supplied buffer is not large enough to accomodate the active session array, the function returns
  3202. * NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlEncoderSessionInfo_t array required in \a sessionCount.
  3203. * To query the number of active encoder sessions, call this function with *sessionCount = 0. The code will return
  3204. * NVML_SUCCESS with number of active encoder sessions updated in *sessionCount.
  3205. *
  3206. * For Maxwell &tm; or newer fully supported devices.
  3207. *
  3208. * @param device The identifier of the target device
  3209. * @param sessionCount Reference to caller supplied array size, and returns the number of sessions.
  3210. * @param sessionInfos Reference in which to return the session information
  3211. *
  3212. * @return
  3213. * - \ref NVML_SUCCESS if \a sessionInfos is fetched
  3214. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3215. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a sessionCount is too small, array element count is returned in \a sessionCount
  3216. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount is NULL.
  3217. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3218. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3219. */
  3220. nvmlReturn_t DECLDIR nvmlDeviceGetEncoderSessions(nvmlDevice_t device, unsigned int *sessionCount, nvmlEncoderSessionInfo_t *sessionInfos);
  3221. /**
  3222. * Retrieves the current utilization and sampling size in microseconds for the Decoder
  3223. *
  3224. * For Kepler &tm; or newer fully supported devices.
  3225. *
  3226. * @param device The identifier of the target device
  3227. * @param utilization Reference to an unsigned int for decoder utilization info
  3228. * @param samplingPeriodUs Reference to an unsigned int for the sampling period in US
  3229. *
  3230. * @return
  3231. * - \ref NVML_SUCCESS if \a utilization has been populated
  3232. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3233. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a utilization is NULL, or \a samplingPeriodUs is NULL
  3234. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3235. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3236. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3237. */
  3238. nvmlReturn_t DECLDIR nvmlDeviceGetDecoderUtilization(nvmlDevice_t device, unsigned int *utilization, unsigned int *samplingPeriodUs);
  3239. /**
  3240. * Retrieves the current and pending driver model for the device.
  3241. *
  3242. * For Fermi &tm; or newer fully supported devices.
  3243. * For windows only.
  3244. *
  3245. * On Windows platforms the device driver can run in either WDDM or WDM (TCC) mode. If a display is attached
  3246. * to the device it must run in WDDM mode. TCC mode is preferred if a display is not attached.
  3247. *
  3248. * See \ref nvmlDriverModel_t for details on available driver models.
  3249. *
  3250. * @param device The identifier of the target device
  3251. * @param current Reference in which to return the current driver model
  3252. * @param pending Reference in which to return the pending driver model
  3253. *
  3254. * @return
  3255. * - \ref NVML_SUCCESS if either \a current and/or \a pending have been set
  3256. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3257. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or both \a current and \a pending are NULL
  3258. * - \ref NVML_ERROR_NOT_SUPPORTED if the platform is not windows
  3259. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3260. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3261. *
  3262. * @see nvmlDeviceSetDriverModel()
  3263. */
  3264. nvmlReturn_t DECLDIR nvmlDeviceGetDriverModel(nvmlDevice_t device, nvmlDriverModel_t *current, nvmlDriverModel_t *pending);
  3265. /**
  3266. * Get VBIOS version of the device.
  3267. *
  3268. * For all products.
  3269. *
  3270. * The VBIOS version may change from time to time. It will not exceed 32 characters in length
  3271. * (including the NULL terminator). See \ref nvmlConstants::NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE.
  3272. *
  3273. * @param device The identifier of the target device
  3274. * @param version Reference to which to return the VBIOS version
  3275. * @param length The maximum allowed length of the string returned in \a version
  3276. *
  3277. * @return
  3278. * - \ref NVML_SUCCESS if \a version has been set
  3279. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3280. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a version is NULL
  3281. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  3282. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3283. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3284. */
  3285. nvmlReturn_t DECLDIR nvmlDeviceGetVbiosVersion(nvmlDevice_t device, char *version, unsigned int length);
  3286. /**
  3287. * Get Bridge Chip Information for all the bridge chips on the board.
  3288. *
  3289. * For all fully supported products.
  3290. * Only applicable to multi-GPU products.
  3291. *
  3292. * @param device The identifier of the target device
  3293. * @param bridgeHierarchy Reference to the returned bridge chip Hierarchy
  3294. *
  3295. * @return
  3296. * - \ref NVML_SUCCESS if bridge chip exists
  3297. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3298. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a bridgeInfo is NULL
  3299. * - \ref NVML_ERROR_NOT_SUPPORTED if bridge chip not supported on the device
  3300. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3301. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3302. *
  3303. */
  3304. nvmlReturn_t DECLDIR nvmlDeviceGetBridgeChipInfo(nvmlDevice_t device, nvmlBridgeChipHierarchy_t *bridgeHierarchy);
  3305. /**
  3306. * Get information about processes with a compute context on a device
  3307. *
  3308. * For Fermi &tm; or newer fully supported devices.
  3309. *
  3310. * This function returns information only about compute running processes (e.g. CUDA application which have
  3311. * active context). Any graphics applications (e.g. using OpenGL, DirectX) won't be listed by this function.
  3312. *
  3313. * To query the current number of running compute processes, call this function with *infoCount = 0. The
  3314. * return code will be NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if none are running. For this call
  3315. * \a infos is allowed to be NULL.
  3316. *
  3317. * The usedGpuMemory field returned is all of the memory used by the application.
  3318. *
  3319. * Keep in mind that information returned by this call is dynamic and the number of elements might change in
  3320. * time. Allocate more space for \a infos table in case new compute processes are spawned.
  3321. *
  3322. * @param device The identifier of the target device
  3323. * @param infoCount Reference in which to provide the \a infos array size, and
  3324. * to return the number of returned elements
  3325. * @param infos Reference in which to return the process information
  3326. *
  3327. * @return
  3328. * - \ref NVML_SUCCESS if \a infoCount and \a infos have been populated
  3329. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3330. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a infoCount indicates that the \a infos array is too small
  3331. * \a infoCount will contain minimal amount of space necessary for
  3332. * the call to complete
  3333. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, either of \a infoCount or \a infos is NULL
  3334. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3335. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3336. *
  3337. * @see \ref nvmlSystemGetProcessName
  3338. */
  3339. nvmlReturn_t DECLDIR nvmlDeviceGetComputeRunningProcesses(nvmlDevice_t device, unsigned int *infoCount, nvmlProcessInfo_t *infos);
  3340. /**
  3341. * Get information about processes with a graphics context on a device
  3342. *
  3343. * For Kepler &tm; or newer fully supported devices.
  3344. *
  3345. * This function returns information only about graphics based processes
  3346. * (eg. applications using OpenGL, DirectX)
  3347. *
  3348. * To query the current number of running graphics processes, call this function with *infoCount = 0. The
  3349. * return code will be NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if none are running. For this call
  3350. * \a infos is allowed to be NULL.
  3351. *
  3352. * The usedGpuMemory field returned is all of the memory used by the application.
  3353. *
  3354. * Keep in mind that information returned by this call is dynamic and the number of elements might change in
  3355. * time. Allocate more space for \a infos table in case new graphics processes are spawned.
  3356. *
  3357. * @param device The identifier of the target device
  3358. * @param infoCount Reference in which to provide the \a infos array size, and
  3359. * to return the number of returned elements
  3360. * @param infos Reference in which to return the process information
  3361. *
  3362. * @return
  3363. * - \ref NVML_SUCCESS if \a infoCount and \a infos have been populated
  3364. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3365. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a infoCount indicates that the \a infos array is too small
  3366. * \a infoCount will contain minimal amount of space necessary for
  3367. * the call to complete
  3368. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, either of \a infoCount or \a infos is NULL
  3369. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3370. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3371. *
  3372. * @see \ref nvmlSystemGetProcessName
  3373. */
  3374. nvmlReturn_t DECLDIR nvmlDeviceGetGraphicsRunningProcesses(nvmlDevice_t device, unsigned int *infoCount, nvmlProcessInfo_t *infos);
  3375. /**
  3376. * Check if the GPU devices are on the same physical board.
  3377. *
  3378. * For all fully supported products.
  3379. *
  3380. * @param device1 The first GPU device
  3381. * @param device2 The second GPU device
  3382. * @param onSameBoard Reference in which to return the status.
  3383. * Non-zero indicates that the GPUs are on the same board.
  3384. *
  3385. * @return
  3386. * - \ref NVML_SUCCESS if \a onSameBoard has been set
  3387. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3388. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a dev1 or \a dev2 are invalid or \a onSameBoard is NULL
  3389. * - \ref NVML_ERROR_NOT_SUPPORTED if this check is not supported by the device
  3390. * - \ref NVML_ERROR_GPU_IS_LOST if the either GPU has fallen off the bus or is otherwise inaccessible
  3391. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3392. */
  3393. nvmlReturn_t DECLDIR nvmlDeviceOnSameBoard(nvmlDevice_t device1, nvmlDevice_t device2, int *onSameBoard);
  3394. /**
  3395. * Retrieves the root/admin permissions on the target API. See \a nvmlRestrictedAPI_t for the list of supported APIs.
  3396. * If an API is restricted only root users can call that API. See \a nvmlDeviceSetAPIRestriction to change current permissions.
  3397. *
  3398. * For all fully supported products.
  3399. *
  3400. * @param device The identifier of the target device
  3401. * @param apiType Target API type for this operation
  3402. * @param isRestricted Reference in which to return the current restriction
  3403. * NVML_FEATURE_ENABLED indicates that the API is root-only
  3404. * NVML_FEATURE_DISABLED indicates that the API is accessible to all users
  3405. *
  3406. * @return
  3407. * - \ref NVML_SUCCESS if \a isRestricted has been set
  3408. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3409. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a apiType incorrect or \a isRestricted is NULL
  3410. * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device or the device does not support
  3411. * the feature that is being queried (E.G. Enabling/disabling Auto Boosted clocks is
  3412. * not supported by the device)
  3413. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3414. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3415. *
  3416. * @see nvmlRestrictedAPI_t
  3417. */
  3418. nvmlReturn_t DECLDIR nvmlDeviceGetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t *isRestricted);
  3419. /**
  3420. * Gets recent samples for the GPU.
  3421. *
  3422. * For Kepler &tm; or newer fully supported devices.
  3423. *
  3424. * Based on type, this method can be used to fetch the power, utilization or clock samples maintained in the buffer by
  3425. * the driver.
  3426. *
  3427. * Power, Utilization and Clock samples are returned as type "unsigned int" for the union nvmlValue_t.
  3428. *
  3429. * To get the size of samples that user needs to allocate, the method is invoked with samples set to NULL.
  3430. * The returned samplesCount will provide the number of samples that can be queried. The user needs to
  3431. * allocate the buffer with size as samplesCount * sizeof(nvmlSample_t).
  3432. *
  3433. * lastSeenTimeStamp represents CPU timestamp in microseconds. Set it to 0 to fetch all the samples maintained by the
  3434. * underlying buffer. Set lastSeenTimeStamp to one of the timeStamps retrieved from the date of the previous query
  3435. * to get more recent samples.
  3436. *
  3437. * This method fetches the number of entries which can be accommodated in the provided samples array, and the
  3438. * reference samplesCount is updated to indicate how many samples were actually retrieved. The advantage of using this
  3439. * method for samples in contrast to polling via existing methods is to get get higher frequency data at lower polling cost.
  3440. *
  3441. * @param device The identifier for the target device
  3442. * @param type Type of sampling event
  3443. * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp.
  3444. * @param sampleValType Output parameter to represent the type of sample value as described in nvmlSampleVal_t
  3445. * @param sampleCount Reference to provide the number of elements which can be queried in samples array
  3446. * @param samples Reference in which samples are returned
  3447. * @return
  3448. * - \ref NVML_SUCCESS if samples are successfully retrieved
  3449. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3450. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a samplesCount is NULL or
  3451. * reference to \a sampleCount is 0 for non null \a samples
  3452. * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
  3453. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3454. * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
  3455. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3456. */
  3457. nvmlReturn_t DECLDIR nvmlDeviceGetSamples(nvmlDevice_t device, nvmlSamplingType_t type, unsigned long long lastSeenTimeStamp,
  3458. nvmlValueType_t *sampleValType, unsigned int *sampleCount, nvmlSample_t *samples);
  3459. /**
  3460. * Gets Total, Available and Used size of BAR1 memory.
  3461. *
  3462. * BAR1 is used to map the FB (device memory) so that it can be directly accessed by the CPU or by 3rd party
  3463. * devices (peer-to-peer on the PCIE bus).
  3464. *
  3465. * For Kepler &tm; or newer fully supported devices.
  3466. *
  3467. * @param device The identifier of the target device
  3468. * @param bar1Memory Reference in which BAR1 memory
  3469. * information is returned.
  3470. *
  3471. * @return
  3472. * - \ref NVML_SUCCESS if BAR1 memory is successfully retrieved
  3473. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3474. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a bar1Memory is NULL
  3475. * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
  3476. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3477. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3478. *
  3479. */
  3480. nvmlReturn_t DECLDIR nvmlDeviceGetBAR1MemoryInfo(nvmlDevice_t device, nvmlBAR1Memory_t *bar1Memory);
  3481. /**
  3482. * Gets the duration of time during which the device was throttled (lower than requested clocks) due to power
  3483. * or thermal constraints.
  3484. *
  3485. * The method is important to users who are tying to understand if their GPUs throttle at any point during their applications. The
  3486. * difference in violation times at two different reference times gives the indication of GPU throttling event.
  3487. *
  3488. * Violation for thermal capping is not supported at this time.
  3489. *
  3490. * For Kepler &tm; or newer fully supported devices.
  3491. *
  3492. * @param device The identifier of the target device
  3493. * @param perfPolicyType Represents Performance policy which can trigger GPU throttling
  3494. * @param violTime Reference to which violation time related information is returned
  3495. *
  3496. *
  3497. * @return
  3498. * - \ref NVML_SUCCESS if violation time is successfully retrieved
  3499. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3500. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a perfPolicyType is invalid, or \a violTime is NULL
  3501. * - \ref NVML_ERROR_NOT_SUPPORTED if this query is not supported by the device
  3502. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3503. *
  3504. */
  3505. nvmlReturn_t DECLDIR nvmlDeviceGetViolationStatus(nvmlDevice_t device, nvmlPerfPolicyType_t perfPolicyType, nvmlViolationTime_t *violTime);
  3506. /**
  3507. * @}
  3508. */
  3509. /** @addtogroup nvmlAccountingStats
  3510. * @{
  3511. */
  3512. /**
  3513. * Queries the state of per process accounting mode.
  3514. *
  3515. * For Kepler &tm; or newer fully supported devices.
  3516. *
  3517. * See \ref nvmlDeviceGetAccountingStats for more details.
  3518. * See \ref nvmlDeviceSetAccountingMode
  3519. *
  3520. * @param device The identifier of the target device
  3521. * @param mode Reference in which to return the current accounting mode
  3522. *
  3523. * @return
  3524. * - \ref NVML_SUCCESS if the mode has been successfully retrieved
  3525. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3526. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode are NULL
  3527. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  3528. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3529. */
  3530. nvmlReturn_t DECLDIR nvmlDeviceGetAccountingMode(nvmlDevice_t device, nvmlEnableState_t *mode);
  3531. /**
  3532. * Queries process's accounting stats.
  3533. *
  3534. * For Kepler &tm; or newer fully supported devices.
  3535. *
  3536. * Accounting stats capture GPU utilization and other statistics across the lifetime of a process.
  3537. * Accounting stats can be queried during life time of the process and after its termination.
  3538. * The time field in \ref nvmlAccountingStats_t is reported as 0 during the lifetime of the process and
  3539. * updated to actual running time after its termination.
  3540. * Accounting stats are kept in a circular buffer, newly created processes overwrite information about old
  3541. * processes.
  3542. *
  3543. * See \ref nvmlAccountingStats_t for description of each returned metric.
  3544. * List of processes that can be queried can be retrieved from \ref nvmlDeviceGetAccountingPids.
  3545. *
  3546. * @note Accounting Mode needs to be on. See \ref nvmlDeviceGetAccountingMode.
  3547. * @note Only compute and graphics applications stats can be queried. Monitoring applications stats can't be
  3548. * queried since they don't contribute to GPU utilization.
  3549. * @note In case of pid collision stats of only the latest process (that terminated last) will be reported
  3550. *
  3551. * @warning On Kepler devices per process statistics are accurate only if there's one process running on a GPU.
  3552. *
  3553. * @param device The identifier of the target device
  3554. * @param pid Process Id of the target process to query stats for
  3555. * @param stats Reference in which to return the process's accounting stats
  3556. *
  3557. * @return
  3558. * - \ref NVML_SUCCESS if stats have been successfully retrieved
  3559. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3560. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a stats are NULL
  3561. * - \ref NVML_ERROR_NOT_FOUND if process stats were not found
  3562. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature or accounting mode is disabled
  3563. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3564. *
  3565. * @see nvmlDeviceGetAccountingBufferSize
  3566. */
  3567. nvmlReturn_t DECLDIR nvmlDeviceGetAccountingStats(nvmlDevice_t device, unsigned int pid, nvmlAccountingStats_t *stats);
  3568. /**
  3569. * Queries list of processes that can be queried for accounting stats. The list of processes returned
  3570. * can be in running or terminated state.
  3571. *
  3572. * For Kepler &tm; or newer fully supported devices.
  3573. *
  3574. * To just query the number of processes ready to be queried, call this function with *count = 0 and
  3575. * pids=NULL. The return code will be NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if list is empty.
  3576. *
  3577. * For more details see \ref nvmlDeviceGetAccountingStats.
  3578. *
  3579. * @note In case of PID collision some processes might not be accessible before the circular buffer is full.
  3580. *
  3581. * @param device The identifier of the target device
  3582. * @param count Reference in which to provide the \a pids array size, and
  3583. * to return the number of elements ready to be queried
  3584. * @param pids Reference in which to return list of process ids
  3585. *
  3586. * @return
  3587. * - \ref NVML_SUCCESS if pids were successfully retrieved
  3588. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3589. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a count is NULL
  3590. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature or accounting mode is disabled
  3591. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a count is too small (\a count is set to
  3592. * expected value)
  3593. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3594. *
  3595. * @see nvmlDeviceGetAccountingBufferSize
  3596. */
  3597. nvmlReturn_t DECLDIR nvmlDeviceGetAccountingPids(nvmlDevice_t device, unsigned int *count, unsigned int *pids);
  3598. /**
  3599. * Returns the number of processes that the circular buffer with accounting pids can hold.
  3600. *
  3601. * For Kepler &tm; or newer fully supported devices.
  3602. *
  3603. * This is the maximum number of processes that accounting information will be stored for before information
  3604. * about oldest processes will get overwritten by information about new processes.
  3605. *
  3606. * @param device The identifier of the target device
  3607. * @param bufferSize Reference in which to provide the size (in number of elements)
  3608. * of the circular buffer for accounting stats.
  3609. *
  3610. * @return
  3611. * - \ref NVML_SUCCESS if buffer size was successfully retrieved
  3612. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3613. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a bufferSize is NULL
  3614. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature or accounting mode is disabled
  3615. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3616. *
  3617. * @see nvmlDeviceGetAccountingStats
  3618. * @see nvmlDeviceGetAccountingPids
  3619. */
  3620. nvmlReturn_t DECLDIR nvmlDeviceGetAccountingBufferSize(nvmlDevice_t device, unsigned int *bufferSize);
  3621. /** @} */
  3622. /** @addtogroup nvmlDeviceQueries
  3623. * @{
  3624. */
  3625. /**
  3626. * Returns the list of retired pages by source, including pages that are pending retirement
  3627. * The address information provided from this API is the hardware address of the page that was retired. Note
  3628. * that this does not match the virtual address used in CUDA, but will match the address information in XID 63
  3629. *
  3630. * For Kepler &tm; or newer fully supported devices.
  3631. *
  3632. * @param device The identifier of the target device
  3633. * @param cause Filter page addresses by cause of retirement
  3634. * @param pageCount Reference in which to provide the \a addresses buffer size, and
  3635. * to return the number of retired pages that match \a cause
  3636. * Set to 0 to query the size without allocating an \a addresses buffer
  3637. * @param addresses Buffer to write the page addresses into
  3638. *
  3639. * @return
  3640. * - \ref NVML_SUCCESS if \a pageCount was populated and \a addresses was filled
  3641. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a pageCount indicates the buffer is not large enough to store all the
  3642. * matching page addresses. \a pageCount is set to the needed size.
  3643. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3644. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a pageCount is NULL, \a cause is invalid, or
  3645. * \a addresses is NULL
  3646. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  3647. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3648. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3649. */
  3650. nvmlReturn_t DECLDIR nvmlDeviceGetRetiredPages(nvmlDevice_t device, nvmlPageRetirementCause_t cause,
  3651. unsigned int *pageCount, unsigned long long *addresses);
  3652. /**
  3653. * Check if any pages are pending retirement and need a reboot to fully retire.
  3654. *
  3655. * For Kepler &tm; or newer fully supported devices.
  3656. *
  3657. * @param device The identifier of the target device
  3658. * @param isPending Reference in which to return the pending status
  3659. *
  3660. * @return
  3661. * - \ref NVML_SUCCESS if \a isPending was populated
  3662. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3663. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a isPending is NULL
  3664. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  3665. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3666. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3667. */
  3668. nvmlReturn_t DECLDIR nvmlDeviceGetRetiredPagesPendingStatus(nvmlDevice_t device, nvmlEnableState_t *isPending);
  3669. /** @} */
  3670. /***************************************************************************************************/
  3671. /** @defgroup nvmlUnitCommands Unit Commands
  3672. * This chapter describes NVML operations that change the state of the unit. For S-class products.
  3673. * Each of these requires root/admin access. Non-admin users will see an NVML_ERROR_NO_PERMISSION
  3674. * error code when invoking any of these methods.
  3675. * @{
  3676. */
  3677. /***************************************************************************************************/
  3678. /**
  3679. * Set the LED state for the unit. The LED can be either green (0) or amber (1).
  3680. *
  3681. * For S-class products.
  3682. * Requires root/admin permissions.
  3683. *
  3684. * This operation takes effect immediately.
  3685. *
  3686. *
  3687. * <b>Current S-Class products don't provide unique LEDs for each unit. As such, both front
  3688. * and back LEDs will be toggled in unison regardless of which unit is specified with this command.</b>
  3689. *
  3690. * See \ref nvmlLedColor_t for available colors.
  3691. *
  3692. * @param unit The identifier of the target unit
  3693. * @param color The target LED color
  3694. *
  3695. * @return
  3696. * - \ref NVML_SUCCESS if the LED color has been set
  3697. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3698. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a unit or \a color is invalid
  3699. * - \ref NVML_ERROR_NOT_SUPPORTED if this is not an S-class product
  3700. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3701. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3702. *
  3703. * @see nvmlUnitGetLedState()
  3704. */
  3705. nvmlReturn_t DECLDIR nvmlUnitSetLedState(nvmlUnit_t unit, nvmlLedColor_t color);
  3706. /** @} */
  3707. /***************************************************************************************************/
  3708. /** @defgroup nvmlDeviceCommands Device Commands
  3709. * This chapter describes NVML operations that change the state of the device.
  3710. * Each of these requires root/admin access. Non-admin users will see an NVML_ERROR_NO_PERMISSION
  3711. * error code when invoking any of these methods.
  3712. * @{
  3713. */
  3714. /***************************************************************************************************/
  3715. /**
  3716. * Set the persistence mode for the device.
  3717. *
  3718. * For all products.
  3719. * For Linux only.
  3720. * Requires root/admin permissions.
  3721. *
  3722. * The persistence mode determines whether the GPU driver software is torn down after the last client
  3723. * exits.
  3724. *
  3725. * This operation takes effect immediately. It is not persistent across reboots. After each reboot the
  3726. * persistence mode is reset to "Disabled".
  3727. *
  3728. * See \ref nvmlEnableState_t for available modes.
  3729. *
  3730. * @param device The identifier of the target device
  3731. * @param mode The target persistence mode
  3732. *
  3733. * @return
  3734. * - \ref NVML_SUCCESS if the persistence mode was set
  3735. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3736. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode is invalid
  3737. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3738. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3739. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3740. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3741. *
  3742. * @see nvmlDeviceGetPersistenceMode()
  3743. */
  3744. nvmlReturn_t DECLDIR nvmlDeviceSetPersistenceMode(nvmlDevice_t device, nvmlEnableState_t mode);
  3745. /**
  3746. * Set the compute mode for the device.
  3747. *
  3748. * For all products.
  3749. * Requires root/admin permissions.
  3750. *
  3751. * The compute mode determines whether a GPU can be used for compute operations and whether it can
  3752. * be shared across contexts.
  3753. *
  3754. * This operation takes effect immediately. Under Linux it is not persistent across reboots and
  3755. * always resets to "Default". Under windows it is persistent.
  3756. *
  3757. * Under windows compute mode may only be set to DEFAULT when running in WDDM
  3758. *
  3759. * See \ref nvmlComputeMode_t for details on available compute modes.
  3760. *
  3761. * @param device The identifier of the target device
  3762. * @param mode The target compute mode
  3763. *
  3764. * @return
  3765. * - \ref NVML_SUCCESS if the compute mode was set
  3766. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3767. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode is invalid
  3768. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3769. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3770. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3771. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3772. *
  3773. * @see nvmlDeviceGetComputeMode()
  3774. */
  3775. nvmlReturn_t DECLDIR nvmlDeviceSetComputeMode(nvmlDevice_t device, nvmlComputeMode_t mode);
  3776. /**
  3777. * Set the ECC mode for the device.
  3778. *
  3779. * For Kepler &tm; or newer fully supported devices.
  3780. * Only applicable to devices with ECC.
  3781. * Requires \a NVML_INFOROM_ECC version 1.0 or higher.
  3782. * Requires root/admin permissions.
  3783. *
  3784. * The ECC mode determines whether the GPU enables its ECC support.
  3785. *
  3786. * This operation takes effect after the next reboot.
  3787. *
  3788. * See \ref nvmlEnableState_t for details on available modes.
  3789. *
  3790. * @param device The identifier of the target device
  3791. * @param ecc The target ECC mode
  3792. *
  3793. * @return
  3794. * - \ref NVML_SUCCESS if the ECC mode was set
  3795. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3796. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a ecc is invalid
  3797. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3798. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3799. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3800. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3801. *
  3802. * @see nvmlDeviceGetEccMode()
  3803. */
  3804. nvmlReturn_t DECLDIR nvmlDeviceSetEccMode(nvmlDevice_t device, nvmlEnableState_t ecc);
  3805. /**
  3806. * Clear the ECC error and other memory error counts for the device.
  3807. *
  3808. * For Kepler &tm; or newer fully supported devices.
  3809. * Only applicable to devices with ECC.
  3810. * Requires \a NVML_INFOROM_ECC version 2.0 or higher to clear aggregate location-based ECC counts.
  3811. * Requires \a NVML_INFOROM_ECC version 1.0 or higher to clear all other ECC counts.
  3812. * Requires root/admin permissions.
  3813. * Requires ECC Mode to be enabled.
  3814. *
  3815. * Sets all of the specified ECC counters to 0, including both detailed and total counts.
  3816. *
  3817. * This operation takes effect immediately.
  3818. *
  3819. * See \ref nvmlMemoryErrorType_t for details on available counter types.
  3820. *
  3821. * @param device The identifier of the target device
  3822. * @param counterType Flag that indicates which type of errors should be cleared.
  3823. *
  3824. * @return
  3825. * - \ref NVML_SUCCESS if the error counts were cleared
  3826. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3827. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a counterType is invalid
  3828. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3829. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3830. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3831. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3832. *
  3833. * @see
  3834. * - nvmlDeviceGetDetailedEccErrors()
  3835. * - nvmlDeviceGetTotalEccErrors()
  3836. */
  3837. nvmlReturn_t DECLDIR nvmlDeviceClearEccErrorCounts(nvmlDevice_t device, nvmlEccCounterType_t counterType);
  3838. /**
  3839. * Set the driver model for the device.
  3840. *
  3841. * For Fermi &tm; or newer fully supported devices.
  3842. * For windows only.
  3843. * Requires root/admin permissions.
  3844. *
  3845. * On Windows platforms the device driver can run in either WDDM or WDM (TCC) mode. If a display is attached
  3846. * to the device it must run in WDDM mode.
  3847. *
  3848. * It is possible to force the change to WDM (TCC) while the display is still attached with a force flag (nvmlFlagForce).
  3849. * This should only be done if the host is subsequently powered down and the display is detached from the device
  3850. * before the next reboot.
  3851. *
  3852. * This operation takes effect after the next reboot.
  3853. *
  3854. * Windows driver model may only be set to WDDM when running in DEFAULT compute mode.
  3855. *
  3856. * Change driver model to WDDM is not supported when GPU doesn't support graphics acceleration or
  3857. * will not support it after reboot. See \ref nvmlDeviceSetGpuOperationMode.
  3858. *
  3859. * See \ref nvmlDriverModel_t for details on available driver models.
  3860. * See \ref nvmlFlagDefault and \ref nvmlFlagForce
  3861. *
  3862. * @param device The identifier of the target device
  3863. * @param driverModel The target driver model
  3864. * @param flags Flags that change the default behavior
  3865. *
  3866. * @return
  3867. * - \ref NVML_SUCCESS if the driver model has been set
  3868. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3869. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a driverModel is invalid
  3870. * - \ref NVML_ERROR_NOT_SUPPORTED if the platform is not windows or the device does not support this feature
  3871. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3872. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3873. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3874. *
  3875. * @see nvmlDeviceGetDriverModel()
  3876. */
  3877. nvmlReturn_t DECLDIR nvmlDeviceSetDriverModel(nvmlDevice_t device, nvmlDriverModel_t driverModel, unsigned int flags);
  3878. /**
  3879. * Set clocks that applications will lock to.
  3880. *
  3881. * Sets the clocks that compute and graphics applications will be running at.
  3882. * e.g. CUDA driver requests these clocks during context creation which means this property
  3883. * defines clocks at which CUDA applications will be running unless some overspec event
  3884. * occurs (e.g. over power, over thermal or external HW brake).
  3885. *
  3886. * Can be used as a setting to request constant performance.
  3887. *
  3888. * On Pascal and newer hardware, this will automatically disable automatic boosting of clocks.
  3889. *
  3890. * On K80 and newer Kepler and Maxwell GPUs, users desiring fixed performance should also call
  3891. * \ref nvmlDeviceSetAutoBoostedClocksEnabled to prevent clocks from automatically boosting
  3892. * above the clock value being set.
  3893. *
  3894. * For Kepler &tm; or newer non-GeForce fully supported devices and Maxwell or newer GeForce devices.
  3895. * Requires root/admin permissions.
  3896. *
  3897. * See \ref nvmlDeviceGetSupportedMemoryClocks and \ref nvmlDeviceGetSupportedGraphicsClocks
  3898. * for details on how to list available clocks combinations.
  3899. *
  3900. * After system reboot or driver reload applications clocks go back to their default value.
  3901. * See \ref nvmlDeviceResetApplicationsClocks.
  3902. *
  3903. * @param device The identifier of the target device
  3904. * @param memClockMHz Requested memory clock in MHz
  3905. * @param graphicsClockMHz Requested graphics clock in MHz
  3906. *
  3907. * @return
  3908. * - \ref NVML_SUCCESS if new settings were successfully set
  3909. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3910. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a memClockMHz and \a graphicsClockMHz
  3911. * is not a valid clock combination
  3912. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3913. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  3914. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3915. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3916. */
  3917. nvmlReturn_t DECLDIR nvmlDeviceSetApplicationsClocks(nvmlDevice_t device, unsigned int memClockMHz, unsigned int graphicsClockMHz);
  3918. /**
  3919. * Set new power limit of this device.
  3920. *
  3921. * For Kepler &tm; or newer fully supported devices.
  3922. * Requires root/admin permissions.
  3923. *
  3924. * See \ref nvmlDeviceGetPowerManagementLimitConstraints to check the allowed ranges of values.
  3925. *
  3926. * \note Limit is not persistent across reboots or driver unloads.
  3927. * Enable persistent mode to prevent driver from unloading when no application is using the device.
  3928. *
  3929. * @param device The identifier of the target device
  3930. * @param limit Power management limit in milliwatts to set
  3931. *
  3932. * @return
  3933. * - \ref NVML_SUCCESS if \a limit has been set
  3934. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3935. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a defaultLimit is out of range
  3936. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  3937. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3938. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3939. *
  3940. * @see nvmlDeviceGetPowerManagementLimitConstraints
  3941. * @see nvmlDeviceGetPowerManagementDefaultLimit
  3942. */
  3943. nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit);
  3944. /**
  3945. * Sets new GOM. See \a nvmlGpuOperationMode_t for details.
  3946. *
  3947. * For GK110 M-class and X-class Tesla &tm; products from the Kepler family.
  3948. * Modes \ref NVML_GOM_LOW_DP and \ref NVML_GOM_ALL_ON are supported on fully supported GeForce products.
  3949. * Not supported on Quadro &reg; and Tesla &tm; C-class products.
  3950. * Requires root/admin permissions.
  3951. *
  3952. * Changing GOMs requires a reboot.
  3953. * The reboot requirement might be removed in the future.
  3954. *
  3955. * Compute only GOMs don't support graphics acceleration. Under windows switching to these GOMs when
  3956. * pending driver model is WDDM is not supported. See \ref nvmlDeviceSetDriverModel.
  3957. *
  3958. * @param device The identifier of the target device
  3959. * @param mode Target GOM
  3960. *
  3961. * @return
  3962. * - \ref NVML_SUCCESS if \a mode has been set
  3963. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3964. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a mode incorrect
  3965. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support GOM or specific mode
  3966. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3967. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3968. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3969. *
  3970. * @see nvmlGpuOperationMode_t
  3971. * @see nvmlDeviceGetGpuOperationMode
  3972. */
  3973. nvmlReturn_t DECLDIR nvmlDeviceSetGpuOperationMode(nvmlDevice_t device, nvmlGpuOperationMode_t mode);
  3974. /**
  3975. * Changes the root/admin restructions on certain APIs. See \a nvmlRestrictedAPI_t for the list of supported APIs.
  3976. * This method can be used by a root/admin user to give non-root/admin access to certain otherwise-restricted APIs.
  3977. * The new setting lasts for the lifetime of the NVIDIA driver; it is not persistent. See \a nvmlDeviceGetAPIRestriction
  3978. * to query the current restriction settings.
  3979. *
  3980. * For Kepler &tm; or newer fully supported devices.
  3981. * Requires root/admin permissions.
  3982. *
  3983. * @param device The identifier of the target device
  3984. * @param apiType Target API type for this operation
  3985. * @param isRestricted The target restriction
  3986. *
  3987. * @return
  3988. * - \ref NVML_SUCCESS if \a isRestricted has been set
  3989. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  3990. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a apiType incorrect
  3991. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support changing API restrictions or the device does not support
  3992. * the feature that api restrictions are being set for (E.G. Enabling/disabling auto
  3993. * boosted clocks is not supported by the device)
  3994. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  3995. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  3996. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  3997. *
  3998. * @see nvmlRestrictedAPI_t
  3999. */
  4000. nvmlReturn_t DECLDIR nvmlDeviceSetAPIRestriction(nvmlDevice_t device, nvmlRestrictedAPI_t apiType, nvmlEnableState_t isRestricted);
  4001. /**
  4002. * @}
  4003. */
  4004. /** @addtogroup nvmlAccountingStats
  4005. * @{
  4006. */
  4007. /**
  4008. * Enables or disables per process accounting.
  4009. *
  4010. * For Kepler &tm; or newer fully supported devices.
  4011. * Requires root/admin permissions.
  4012. *
  4013. * @note This setting is not persistent and will default to disabled after driver unloads.
  4014. * Enable persistence mode to be sure the setting doesn't switch off to disabled.
  4015. *
  4016. * @note Enabling accounting mode has no negative impact on the GPU performance.
  4017. *
  4018. * @note Disabling accounting clears all accounting pids information.
  4019. *
  4020. * See \ref nvmlDeviceGetAccountingMode
  4021. * See \ref nvmlDeviceGetAccountingStats
  4022. * See \ref nvmlDeviceClearAccountingPids
  4023. *
  4024. * @param device The identifier of the target device
  4025. * @param mode The target accounting mode
  4026. *
  4027. * @return
  4028. * - \ref NVML_SUCCESS if the new mode has been set
  4029. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4030. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a mode are invalid
  4031. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4032. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  4033. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4034. */
  4035. nvmlReturn_t DECLDIR nvmlDeviceSetAccountingMode(nvmlDevice_t device, nvmlEnableState_t mode);
  4036. /**
  4037. * Clears accounting information about all processes that have already terminated.
  4038. *
  4039. * For Kepler &tm; or newer fully supported devices.
  4040. * Requires root/admin permissions.
  4041. *
  4042. * See \ref nvmlDeviceGetAccountingMode
  4043. * See \ref nvmlDeviceGetAccountingStats
  4044. * See \ref nvmlDeviceSetAccountingMode
  4045. *
  4046. * @param device The identifier of the target device
  4047. *
  4048. * @return
  4049. * - \ref NVML_SUCCESS if accounting information has been cleared
  4050. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4051. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device are invalid
  4052. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4053. * - \ref NVML_ERROR_NO_PERMISSION if the user doesn't have permission to perform this operation
  4054. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4055. */
  4056. nvmlReturn_t DECLDIR nvmlDeviceClearAccountingPids(nvmlDevice_t device);
  4057. /** @} */
  4058. /***************************************************************************************************/
  4059. /** @defgroup NvLink NvLink Methods
  4060. * This chapter describes methods that NVML can perform on NVLINK enabled devices.
  4061. * @{
  4062. */
  4063. /***************************************************************************************************/
  4064. /**
  4065. * Retrieves the state of the device's NvLink for the link specified
  4066. *
  4067. * For Pascal &tm; or newer fully supported devices.
  4068. *
  4069. * @param device The identifier of the target device
  4070. * @param link Specifies the NvLink link to be queried
  4071. * @param isActive \a nvmlEnableState_t where NVML_FEATURE_ENABLED indicates that
  4072. * the link is active and NVML_FEATURE_DISABLED indicates it
  4073. * is inactive
  4074. *
  4075. * @return
  4076. * - \ref NVML_SUCCESS if \a isActive has been set
  4077. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4078. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a link is invalid or \a isActive is NULL
  4079. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4080. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4081. */
  4082. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkState(nvmlDevice_t device, unsigned int link, nvmlEnableState_t *isActive);
  4083. /**
  4084. * Retrieves the version of the device's NvLink for the link specified
  4085. *
  4086. * For Pascal &tm; or newer fully supported devices.
  4087. *
  4088. * @param device The identifier of the target device
  4089. * @param link Specifies the NvLink link to be queried
  4090. * @param version Requested NvLink version
  4091. *
  4092. * @return
  4093. * - \ref NVML_SUCCESS if \a version has been set
  4094. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4095. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a link is invalid or \a version is NULL
  4096. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4097. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4098. */
  4099. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkVersion(nvmlDevice_t device, unsigned int link, unsigned int *version);
  4100. /**
  4101. * Retrieves the requested capability from the device's NvLink for the link specified
  4102. * Please refer to the \a nvmlNvLinkCapability_t structure for the specific caps that can be queried
  4103. * The return value should be treated as a boolean.
  4104. *
  4105. * For Pascal &tm; or newer fully supported devices.
  4106. *
  4107. * @param device The identifier of the target device
  4108. * @param link Specifies the NvLink link to be queried
  4109. * @param capability Specifies the \a nvmlNvLinkCapability_t to be queried
  4110. * @param capResult A boolean for the queried capability indicating that feature is available
  4111. *
  4112. * @return
  4113. * - \ref NVML_SUCCESS if \a capResult has been set
  4114. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4115. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a link, or \a capability is invalid or \a capResult is NULL
  4116. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4117. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4118. */
  4119. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkCapability(nvmlDevice_t device, unsigned int link,
  4120. nvmlNvLinkCapability_t capability, unsigned int *capResult);
  4121. /**
  4122. * Retrieves the PCI information for the remote node on a NvLink link
  4123. * Note: pciSubSystemId is not filled in this function and is indeterminate
  4124. *
  4125. * For Pascal &tm; or newer fully supported devices.
  4126. *
  4127. * @param device The identifier of the target device
  4128. * @param link Specifies the NvLink link to be queried
  4129. * @param pci \a nvmlPciInfo_t of the remote node for the specified link
  4130. *
  4131. * @return
  4132. * - \ref NVML_SUCCESS if \a pci has been set
  4133. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4134. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a link is invalid or \a pci is NULL
  4135. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4136. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4137. */
  4138. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkRemotePciInfo(nvmlDevice_t device, unsigned int link, nvmlPciInfo_t *pci);
  4139. /**
  4140. * Retrieves the specified error counter value
  4141. * Please refer to \a nvmlNvLinkErrorCounter_t for error counters that are available
  4142. *
  4143. * For Pascal &tm; or newer fully supported devices.
  4144. *
  4145. * @param device The identifier of the target device
  4146. * @param link Specifies the NvLink link to be queried
  4147. * @param counter Specifies the NvLink counter to be queried
  4148. * @param counterValue Returned counter value
  4149. *
  4150. * @return
  4151. * - \ref NVML_SUCCESS if \a counter has been set
  4152. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4153. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a link, or \a counter is invalid or \a counterValue is NULL
  4154. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4155. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4156. */
  4157. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkErrorCounter(nvmlDevice_t device, unsigned int link,
  4158. nvmlNvLinkErrorCounter_t counter, unsigned long long *counterValue);
  4159. /**
  4160. * Resets all error counters to zero
  4161. * Please refer to \a nvmlNvLinkErrorCounter_t for the list of error counters that are reset
  4162. *
  4163. * For Pascal &tm; or newer fully supported devices.
  4164. *
  4165. * @param device The identifier of the target device
  4166. * @param link Specifies the NvLink link to be queried
  4167. *
  4168. * @return
  4169. * - \ref NVML_SUCCESS if the reset is successful
  4170. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4171. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device or \a link is invalid
  4172. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4173. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4174. */
  4175. nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkErrorCounters(nvmlDevice_t device, unsigned int link);
  4176. /**
  4177. * Set the NVLINK utilization counter control information for the specified counter, 0 or 1.
  4178. * Please refer to \a nvmlNvLinkUtilizationControl_t for the structure definition. Performs a reset
  4179. * of the counters if the reset parameter is non-zero.
  4180. *
  4181. * For Pascal &tm; or newer fully supported devices.
  4182. *
  4183. * @param device The identifier of the target device
  4184. * @param counter Specifies the counter that should be set (0 or 1).
  4185. * @param link Specifies the NvLink link to be queried
  4186. * @param control A reference to the \a nvmlNvLinkUtilizationControl_t to set
  4187. * @param reset Resets the counters on set if non-zero
  4188. *
  4189. * @return
  4190. * - \ref NVML_SUCCESS if the control has been set successfully
  4191. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4192. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a counter, \a link, or \a control is invalid
  4193. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4194. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4195. */
  4196. nvmlReturn_t DECLDIR nvmlDeviceSetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter,
  4197. nvmlNvLinkUtilizationControl_t *control, unsigned int reset);
  4198. /**
  4199. * Get the NVLINK utilization counter control information for the specified counter, 0 or 1.
  4200. * Please refer to \a nvmlNvLinkUtilizationControl_t for the structure definition
  4201. *
  4202. * For Pascal &tm; or newer fully supported devices.
  4203. *
  4204. * @param device The identifier of the target device
  4205. * @param counter Specifies the counter that should be set (0 or 1).
  4206. * @param link Specifies the NvLink link to be queried
  4207. * @param control A reference to the \a nvmlNvLinkUtilizationControl_t to place information
  4208. *
  4209. * @return
  4210. * - \ref NVML_SUCCESS if the control has been set successfully
  4211. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4212. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a counter, \a link, or \a control is invalid
  4213. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4214. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4215. */
  4216. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationControl(nvmlDevice_t device, unsigned int link, unsigned int counter,
  4217. nvmlNvLinkUtilizationControl_t *control);
  4218. /**
  4219. * Retrieve the NVLINK utilization counter based on the current control for a specified counter.
  4220. * In general it is good practice to use \a nvmlDeviceSetNvLinkUtilizationControl
  4221. * before reading the utilization counters as they have no default state
  4222. *
  4223. * For Pascal &tm; or newer fully supported devices.
  4224. *
  4225. * @param device The identifier of the target device
  4226. * @param link Specifies the NvLink link to be queried
  4227. * @param counter Specifies the counter that should be read (0 or 1).
  4228. * @param rxcounter Receive counter return value
  4229. * @param txcounter Transmit counter return value
  4230. *
  4231. * @return
  4232. * - \ref NVML_SUCCESS if \a rxcounter and \a txcounter have been successfully set
  4233. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4234. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a counter, or \a link is invalid or \a rxcounter or \a txcounter are NULL
  4235. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4236. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4237. */
  4238. nvmlReturn_t DECLDIR nvmlDeviceGetNvLinkUtilizationCounter(nvmlDevice_t device, unsigned int link, unsigned int counter,
  4239. unsigned long long *rxcounter, unsigned long long *txcounter);
  4240. /**
  4241. * Freeze the NVLINK utilization counters
  4242. * Both the receive and transmit counters are operated on by this function
  4243. *
  4244. * For Pascal &tm; or newer fully supported devices.
  4245. *
  4246. * @param device The identifier of the target device
  4247. * @param link Specifies the NvLink link to be queried
  4248. * @param counter Specifies the counter that should be frozen (0 or 1).
  4249. * @param freeze NVML_FEATURE_ENABLED = freeze the receive and transmit counters
  4250. * NVML_FEATURE_DISABLED = unfreeze the receive and transmit counters
  4251. *
  4252. * @return
  4253. * - \ref NVML_SUCCESS if counters were successfully frozen or unfrozen
  4254. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4255. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a link, \a counter, or \a freeze is invalid
  4256. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4257. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4258. */
  4259. nvmlReturn_t DECLDIR nvmlDeviceFreezeNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link,
  4260. unsigned int counter, nvmlEnableState_t freeze);
  4261. /**
  4262. * Reset the NVLINK utilization counters
  4263. * Both the receive and transmit counters are operated on by this function
  4264. *
  4265. * For Pascal &tm; or newer fully supported devices.
  4266. *
  4267. * @param device The identifier of the target device
  4268. * @param link Specifies the NvLink link to be reset
  4269. * @param counter Specifies the counter that should be reset (0 or 1)
  4270. *
  4271. * @return
  4272. * - \ref NVML_SUCCESS if counters were successfully reset
  4273. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4274. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device, \a link, or \a counter is invalid
  4275. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4276. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4277. */
  4278. nvmlReturn_t DECLDIR nvmlDeviceResetNvLinkUtilizationCounter (nvmlDevice_t device, unsigned int link, unsigned int counter);
  4279. /** @} */
  4280. /***************************************************************************************************/
  4281. /** @defgroup nvmlEvents Event Handling Methods
  4282. * This chapter describes methods that NVML can perform against each device to register and wait for
  4283. * some event to occur.
  4284. * @{
  4285. */
  4286. /***************************************************************************************************/
  4287. /**
  4288. * Create an empty set of events.
  4289. * Event set should be freed by \ref nvmlEventSetFree
  4290. *
  4291. * For Fermi &tm; or newer fully supported devices.
  4292. * @param set Reference in which to return the event handle
  4293. *
  4294. * @return
  4295. * - \ref NVML_SUCCESS if the event has been set
  4296. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4297. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a set is NULL
  4298. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4299. *
  4300. * @see nvmlEventSetFree
  4301. */
  4302. nvmlReturn_t DECLDIR nvmlEventSetCreate(nvmlEventSet_t *set);
  4303. /**
  4304. * Starts recording of events on a specified devices and add the events to specified \ref nvmlEventSet_t
  4305. *
  4306. * For Fermi &tm; or newer fully supported devices.
  4307. * Ecc events are available only on ECC enabled devices (see \ref nvmlDeviceGetTotalEccErrors)
  4308. * Power capping events are available only on Power Management enabled devices (see \ref nvmlDeviceGetPowerManagementMode)
  4309. *
  4310. * For Linux only.
  4311. *
  4312. * \b IMPORTANT: Operations on \a set are not thread safe
  4313. *
  4314. * This call starts recording of events on specific device.
  4315. * All events that occurred before this call are not recorded.
  4316. * Checking if some event occurred can be done with \ref nvmlEventSetWait
  4317. *
  4318. * If function reports NVML_ERROR_UNKNOWN, event set is in undefined state and should be freed.
  4319. * If function reports NVML_ERROR_NOT_SUPPORTED, event set can still be used. None of the requested eventTypes
  4320. * are registered in that case.
  4321. *
  4322. * @param device The identifier of the target device
  4323. * @param eventTypes Bitmask of \ref nvmlEventType to record
  4324. * @param set Set to which add new event types
  4325. *
  4326. * @return
  4327. * - \ref NVML_SUCCESS if the event has been set
  4328. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4329. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a eventTypes is invalid or \a set is NULL
  4330. * - \ref NVML_ERROR_NOT_SUPPORTED if the platform does not support this feature or some of requested event types
  4331. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  4332. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4333. *
  4334. * @see nvmlEventType
  4335. * @see nvmlDeviceGetSupportedEventTypes
  4336. * @see nvmlEventSetWait
  4337. * @see nvmlEventSetFree
  4338. */
  4339. nvmlReturn_t DECLDIR nvmlDeviceRegisterEvents(nvmlDevice_t device, unsigned long long eventTypes, nvmlEventSet_t set);
  4340. /**
  4341. * Returns information about events supported on device
  4342. *
  4343. * For Fermi &tm; or newer fully supported devices.
  4344. *
  4345. * Events are not supported on Windows. So this function returns an empty mask in \a eventTypes on Windows.
  4346. *
  4347. * @param device The identifier of the target device
  4348. * @param eventTypes Reference in which to return bitmask of supported events
  4349. *
  4350. * @return
  4351. * - \ref NVML_SUCCESS if the eventTypes has been set
  4352. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4353. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a eventType is NULL
  4354. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  4355. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4356. *
  4357. * @see nvmlEventType
  4358. * @see nvmlDeviceRegisterEvents
  4359. */
  4360. nvmlReturn_t DECLDIR nvmlDeviceGetSupportedEventTypes(nvmlDevice_t device, unsigned long long *eventTypes);
  4361. /**
  4362. * Waits on events and delivers events
  4363. *
  4364. * For Fermi &tm; or newer fully supported devices.
  4365. *
  4366. * If some events are ready to be delivered at the time of the call, function returns immediately.
  4367. * If there are no events ready to be delivered, function sleeps till event arrives
  4368. * but not longer than specified timeout. This function in certain conditions can return before
  4369. * specified timeout passes (e.g. when interrupt arrives)
  4370. *
  4371. * In case of xid error, the function returns the most recent xid error type seen by the system. If there are multiple
  4372. * xid errors generated before nvmlEventSetWait is invoked then the last seen xid error type is returned for all
  4373. * xid error events.
  4374. *
  4375. * @param set Reference to set of events to wait on
  4376. * @param data Reference in which to return event data
  4377. * @param timeoutms Maximum amount of wait time in milliseconds for registered event
  4378. *
  4379. * @return
  4380. * - \ref NVML_SUCCESS if the data has been set
  4381. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4382. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a data is NULL
  4383. * - \ref NVML_ERROR_TIMEOUT if no event arrived in specified timeout or interrupt arrived
  4384. * - \ref NVML_ERROR_GPU_IS_LOST if a GPU has fallen off the bus or is otherwise inaccessible
  4385. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4386. *
  4387. * @see nvmlEventType
  4388. * @see nvmlDeviceRegisterEvents
  4389. */
  4390. nvmlReturn_t DECLDIR nvmlEventSetWait(nvmlEventSet_t set, nvmlEventData_t * data, unsigned int timeoutms);
  4391. /**
  4392. * Releases events in the set
  4393. *
  4394. * For Fermi &tm; or newer fully supported devices.
  4395. *
  4396. * @param set Reference to events to be released
  4397. *
  4398. * @return
  4399. * - \ref NVML_SUCCESS if the event has been successfully released
  4400. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4401. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4402. *
  4403. * @see nvmlDeviceRegisterEvents
  4404. */
  4405. nvmlReturn_t DECLDIR nvmlEventSetFree(nvmlEventSet_t set);
  4406. /** @} */
  4407. /***************************************************************************************************/
  4408. /** @defgroup nvmlZPI Drain states
  4409. * This chapter describes methods that NVML can perform against each device to control their drain state
  4410. * and recognition by NVML and NVIDIA kernel driver. These methods can be used with out-of-band tools to
  4411. * power on/off GPUs, enable robust reset scenarios, etc.
  4412. * @{
  4413. */
  4414. /***************************************************************************************************/
  4415. /**
  4416. * Modify the drain state of a GPU. This method forces a GPU to no longer accept new incoming requests.
  4417. * Any new NVML process will no longer see this GPU. Persistence mode for this GPU must be turned off before
  4418. * this call is made.
  4419. * Must be called as administrator.
  4420. * For Linux only.
  4421. *
  4422. * For Pascal &tm; or newer fully supported devices.
  4423. * Some Kepler devices supported.
  4424. *
  4425. * @param pciInfo The PCI address of the GPU drain state to be modified
  4426. * @param newState The drain state that should be entered, see \ref nvmlEnableState_t
  4427. *
  4428. * @return
  4429. * - \ref NVML_SUCCESS if counters were successfully reset
  4430. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4431. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a nvmlIndex or \a newState is invalid
  4432. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4433. * - \ref NVML_ERROR_NO_PERMISSION if the calling process has insufficient permissions to perform operation
  4434. * - \ref NVML_ERROR_IN_USE if the device has persistence mode turned on
  4435. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4436. */
  4437. nvmlReturn_t DECLDIR nvmlDeviceModifyDrainState (nvmlPciInfo_t *pciInfo, nvmlEnableState_t newState);
  4438. /**
  4439. * Query the drain state of a GPU. This method is used to check if a GPU is in a currently draining
  4440. * state.
  4441. * For Linux only.
  4442. *
  4443. * For Pascal &tm; or newer fully supported devices.
  4444. * Some Kepler devices supported.
  4445. *
  4446. * @param pciInfo The PCI address of the GPU drain state to be queried
  4447. * @param currentState The current drain state for this GPU, see \ref nvmlEnableState_t
  4448. *
  4449. * @return
  4450. * - \ref NVML_SUCCESS if counters were successfully reset
  4451. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4452. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a nvmlIndex or \a currentState is invalid
  4453. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4454. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4455. */
  4456. nvmlReturn_t DECLDIR nvmlDeviceQueryDrainState (nvmlPciInfo_t *pciInfo, nvmlEnableState_t *currentState);
  4457. /**
  4458. * This method will remove the specified GPU from the view of both NVML and the NVIDIA kernel driver
  4459. * as long as no other processes are attached. If other processes are attached, this call will return
  4460. * NVML_ERROR_IN_USE and the GPU will be returned to its original "draining" state. Note: the
  4461. * only situation where a process can still be attached after nvmlDeviceModifyDrainState() is called
  4462. * to initiate the draining state is if that process was using, and is still using, a GPU before the
  4463. * call was made. Also note, persistence mode counts as an attachment to the GPU thus it must be disabled
  4464. * prior to this call.
  4465. *
  4466. * For long-running NVML processes please note that this will change the enumeration of current GPUs.
  4467. * For example, if there are four GPUs present and GPU1 is removed, the new enumeration will be 0-2.
  4468. * Also, device handles after the removed GPU will not be valid and must be re-established.
  4469. * Must be run as administrator.
  4470. * For Linux only.
  4471. *
  4472. * For Pascal &tm; or newer fully supported devices.
  4473. * Some Kepler devices supported.
  4474. *
  4475. * @param pciInfo The PCI address of the GPU to be removed
  4476. *
  4477. * @return
  4478. * - \ref NVML_SUCCESS if counters were successfully reset
  4479. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4480. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a nvmlIndex is invalid
  4481. * - \ref NVML_ERROR_NOT_SUPPORTED if the device doesn't support this feature
  4482. * - \ref NVML_ERROR_IN_USE if the device is still in use and cannot be removed
  4483. */
  4484. nvmlReturn_t DECLDIR nvmlDeviceRemoveGpu (nvmlPciInfo_t *pciInfo);
  4485. /**
  4486. * Request the OS and the NVIDIA kernel driver to rediscover a portion of the PCI subsystem looking for GPUs that
  4487. * were previously removed. The portion of the PCI tree can be narrowed by specifying a domain, bus, and device.
  4488. * If all are zeroes then the entire PCI tree will be searched. Please note that for long-running NVML processes
  4489. * the enumeration will change based on how many GPUs are discovered and where they are inserted in bus order.
  4490. *
  4491. * In addition, all newly discovered GPUs will be initialized and their ECC scrubbed which may take several seconds
  4492. * per GPU. Also, all device handles are no longer guaranteed to be valid post discovery.
  4493. *
  4494. * Must be run as administrator.
  4495. * For Linux only.
  4496. *
  4497. * For Pascal &tm; or newer fully supported devices.
  4498. * Some Kepler devices supported.
  4499. *
  4500. * @param pciInfo The PCI tree to be searched. Only the domain, bus, and device
  4501. * fields are used in this call.
  4502. *
  4503. * @return
  4504. * - \ref NVML_SUCCESS if counters were successfully reset
  4505. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4506. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a pciInfo is invalid
  4507. * - \ref NVML_ERROR_NOT_SUPPORTED if the operating system does not support this feature
  4508. * - \ref NVML_ERROR_OPERATING_SYSTEM if the operating system is denying this feature
  4509. * - \ref NVML_ERROR_NO_PERMISSION if the calling process has insufficient permissions to perform operation
  4510. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4511. */
  4512. nvmlReturn_t DECLDIR nvmlDeviceDiscoverGpus (nvmlPciInfo_t *pciInfo);
  4513. /** @} */
  4514. /***************************************************************************************************/
  4515. /** @defgroup nvmlFieldValueQueries Field Value Queries
  4516. * This chapter describes NVML operations that are associated with retrieving Field Values from NVML
  4517. * @{
  4518. */
  4519. /***************************************************************************************************/
  4520. /**
  4521. * Request values for a list of fields for a device. This API allows multiple fields to be queried at once.
  4522. * If any of the underlying fieldIds are populated by the same driver call, the results for those field IDs
  4523. * will be populated from a single call rather than making a driver call for each fieldId.
  4524. *
  4525. * @param device The device handle of the GPU to request field values for
  4526. * @param valuesCount Number of entries in values that should be retrieved
  4527. * @param values Array of \a valuesCount structures to hold field values.
  4528. * Each value's fieldId must be populated prior to this call
  4529. *
  4530. * @return
  4531. * - \ref NVML_SUCCESS if any values in \a values were populated. Note that you must
  4532. * check the nvmlReturn field of each value for each individual
  4533. * status
  4534. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a values is NULL
  4535. */
  4536. nvmlReturn_t DECLDIR nvmlDeviceGetFieldValues(nvmlDevice_t device, int valuesCount, nvmlFieldValue_t *values);
  4537. /** @} */
  4538. /***************************************************************************************************/
  4539. /** @defgroup nvmlGridQueries Grid Queries
  4540. * This chapter describes NVML operations that are associated with NVIDIA GRID products.
  4541. * @{
  4542. */
  4543. /***************************************************************************************************/
  4544. /**
  4545. * This method is used to get the virtualization mode corresponding to the GPU.
  4546. *
  4547. * For Kepler &tm; or newer fully supported devices.
  4548. *
  4549. * @param device Identifier of the target device
  4550. * @param pVirtualMode Reference to virtualization mode. One of NVML_GPU_VIRTUALIZATION_?
  4551. *
  4552. * @return
  4553. * - \ref NVML_SUCCESS if \a pVirtualMode is fetched
  4554. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4555. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pVirtualMode is NULL
  4556. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  4557. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4558. */
  4559. nvmlReturn_t DECLDIR nvmlDeviceGetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t *pVirtualMode);
  4560. /** @} */
  4561. /***************************************************************************************************/
  4562. /** @defgroup nvmlGridCommands Grid Commands
  4563. * This chapter describes NVML operations that are associated with NVIDIA GRID products.
  4564. * @{
  4565. */
  4566. /***************************************************************************************************/
  4567. /**
  4568. * This method is used to set the virtualization mode corresponding to the GPU.
  4569. *
  4570. * For Kepler &tm; or newer fully supported devices.
  4571. *
  4572. * @param device Identifier of the target device
  4573. * @param virtualMode virtualization mode. One of NVML_GPU_VIRTUALIZATION_?
  4574. *
  4575. * @return
  4576. * - \ref NVML_SUCCESS if \a pVirtualMode is set
  4577. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4578. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid or \a pVirtualMode is NULL
  4579. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  4580. * - \ref NVML_ERROR_NOT_SUPPORTED if setting of virtualization mode is not supported.
  4581. * - \ref NVML_ERROR_NO_PERMISSION if setting of virtualization mode is not allowed for this client.
  4582. */
  4583. nvmlReturn_t DECLDIR nvmlDeviceSetVirtualizationMode(nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode);
  4584. /** @} */
  4585. /***************************************************************************************************/
  4586. /** @defgroup nvmlVgpu vGPU Management
  4587. * @{
  4588. *
  4589. * Set of APIs supporting GRID vGPU
  4590. */
  4591. /***************************************************************************************************/
  4592. /**
  4593. * Retrieve the supported vGPU types on a physical GPU (device).
  4594. *
  4595. * An array of supported vGPU types for the physical GPU indicated by \a device is returned in the caller-supplied buffer
  4596. * pointed at by \a vgpuTypeIds. The element count of nvmlVgpuTypeId_t array is passed in \a vgpuCount, and \a vgpuCount
  4597. * is used to return the number of vGPU types written to the buffer.
  4598. *
  4599. * If the supplied buffer is not large enough to accomodate the vGPU type array, the function returns
  4600. * NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlVgpuTypeId_t array required in \a vgpuCount.
  4601. * To query the number of vGPU types supported for the GPU, call this function with *vgpuCount = 0.
  4602. * The code will return NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if no vGPU types are supported.
  4603. *
  4604. * @param device The identifier of the target device
  4605. * @param vgpuCount Pointer to caller-supplied array size, and returns number of vGPU types
  4606. * @param vgpuTypeIds Pointer to caller-supplied array in which to return list of vGPU types
  4607. *
  4608. * @return
  4609. * - \ref NVML_SUCCESS successful completion
  4610. * - \ref NVML_ERROR_INSUFFICIENT_SIZE \a vgpuTypeIds buffer is too small, array element count is returned in \a vgpuCount
  4611. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuCount is NULL or \a device is invalid
  4612. * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
  4613. * - \ref NVML_ERROR_VGPU_ECC_NOT_SUPPORTED if ECC is enabled on the device
  4614. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4615. */
  4616. nvmlReturn_t DECLDIR nvmlDeviceGetSupportedVgpus(nvmlDevice_t device, unsigned int *vgpuCount, nvmlVgpuTypeId_t *vgpuTypeIds);
  4617. /**
  4618. * Retrieve the currently creatable vGPU types on a physical GPU (device).
  4619. *
  4620. * An array of creatable vGPU types for the physical GPU indicated by \a device is returned in the caller-supplied buffer
  4621. * pointed at by \a vgpuTypeIds. The element count of nvmlVgpuTypeId_t array is passed in \a vgpuCount, and \a vgpuCount
  4622. * is used to return the number of vGPU types written to the buffer.
  4623. *
  4624. * The creatable vGPU types for a device may differ over time, as there may be restrictions on what type of vGPU types
  4625. * can concurrently run on a device. For example, if only one vGPU type is allowed at a time on a device, then the creatable
  4626. * list will be restricted to whatever vGPU type is already running on the device.
  4627. *
  4628. * If the supplied buffer is not large enough to accomodate the vGPU type array, the function returns
  4629. * NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlVgpuTypeId_t array required in \a vgpuCount.
  4630. * To query the number of vGPU types createable for the GPU, call this function with *vgpuCount = 0.
  4631. * The code will return NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if no vGPU types are creatable.
  4632. *
  4633. * @param device The identifier of the target device
  4634. * @param vgpuCount Pointer to caller-supplied array size, and returns number of vGPU types
  4635. * @param vgpuTypeIds Pointer to caller-supplied array in which to return list of vGPU types
  4636. *
  4637. * @return
  4638. * - \ref NVML_SUCCESS successful completion
  4639. * - \ref NVML_ERROR_INSUFFICIENT_SIZE \a vgpuTypeIds buffer is too small, array element count is returned in \a vgpuCount
  4640. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuCount is NULL
  4641. * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
  4642. * - \ref NVML_ERROR_VGPU_ECC_NOT_SUPPORTED if ECC is enabled on the device
  4643. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4644. */
  4645. nvmlReturn_t DECLDIR nvmlDeviceGetCreatableVgpus(nvmlDevice_t device, unsigned int *vgpuCount, nvmlVgpuTypeId_t *vgpuTypeIds);
  4646. /**
  4647. * Retrieve the class of a vGPU type. It will not exceed 64 characters in length (including the NUL terminator).
  4648. * See \ref nvmlConstants::NVML_DEVICE_NAME_BUFFER_SIZE.
  4649. *
  4650. * For Kepler &tm; or newer fully supported devices.
  4651. *
  4652. * @param vgpuTypeId Handle to vGPU type
  4653. * @param vgpuTypeClass Pointer to string array to return class in
  4654. * @param size Size of string
  4655. *
  4656. * @return
  4657. * - \ref NVML_SUCCESS successful completion
  4658. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a vgpuTypeClass is NULL
  4659. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4660. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4661. */
  4662. nvmlReturn_t DECLDIR nvmlVgpuTypeGetClass(nvmlVgpuTypeId_t vgpuTypeId, char *vgpuTypeClass, unsigned int *size);
  4663. /**
  4664. * Retrieve the vGPU type name.
  4665. *
  4666. * The name is an alphanumeric string that denotes a particular vGPU, e.g. GRID M60-2Q. It will not
  4667. * exceed 64 characters in length (including the NUL terminator). See \ref
  4668. * nvmlConstants::NVML_DEVICE_NAME_BUFFER_SIZE.
  4669. *
  4670. * For Kepler &tm; or newer fully supported devices.
  4671. *
  4672. * @param vgpuTypeId Handle to vGPU type
  4673. * @param vgpuTypeName Pointer to buffer to return name
  4674. * @param size Size of buffer
  4675. *
  4676. * @return
  4677. * - \ref NVML_SUCCESS successful completion
  4678. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a name is NULL
  4679. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4680. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4681. */
  4682. nvmlReturn_t DECLDIR nvmlVgpuTypeGetName(nvmlVgpuTypeId_t vgpuTypeId, char *vgpuTypeName, unsigned int *size);
  4683. /**
  4684. * Retrieve the device ID of a vGPU type.
  4685. *
  4686. * For Kepler &tm; or newer fully supported devices.
  4687. *
  4688. * @param vgpuTypeId Handle to vGPU type
  4689. * @param deviceID Device ID and vendor ID of the device contained in single 32 bit value
  4690. * @param subsystemID Subsytem ID and subsytem vendor ID of the device contained in single 32 bit value
  4691. *
  4692. * @return
  4693. * - \ref NVML_SUCCESS successful completion
  4694. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4695. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a deviceId or \a subsystemID are NULL
  4696. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4697. */
  4698. nvmlReturn_t DECLDIR nvmlVgpuTypeGetDeviceID(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long *deviceID, unsigned long long *subsystemID);
  4699. /**
  4700. * Retrieve the vGPU framebuffer size in bytes.
  4701. *
  4702. * For Kepler &tm; or newer fully supported devices.
  4703. *
  4704. * @param vgpuTypeId Handle to vGPU type
  4705. * @param fbSize Pointer to framebuffer size in bytes
  4706. *
  4707. * @return
  4708. * - \ref NVML_SUCCESS successful completion
  4709. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4710. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a fbSize is NULL
  4711. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4712. */
  4713. nvmlReturn_t DECLDIR nvmlVgpuTypeGetFramebufferSize(nvmlVgpuTypeId_t vgpuTypeId, unsigned long long *fbSize);
  4714. /**
  4715. * Retrieve count of vGPU's supported display heads.
  4716. *
  4717. * For Kepler &tm; or newer fully supported devices.
  4718. *
  4719. * @param vgpuTypeId Handle to vGPU type
  4720. * @param numDisplayHeads Pointer to number of display heads
  4721. *
  4722. * @return
  4723. * - \ref NVML_SUCCESS successful completion
  4724. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4725. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a numDisplayHeads is NULL
  4726. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4727. */
  4728. nvmlReturn_t DECLDIR nvmlVgpuTypeGetNumDisplayHeads(nvmlVgpuTypeId_t vgpuTypeId, unsigned int *numDisplayHeads);
  4729. /**
  4730. * Retrieve vGPU display head's maximum supported resolution.
  4731. *
  4732. * For Kepler &tm; or newer fully supported devices.
  4733. *
  4734. * @param vgpuTypeId Handle to vGPU type
  4735. * @param displayIndex Zero-based index of display head
  4736. * @param xdim Pointer to maximum number of pixels in X dimension
  4737. * @param ydim Pointer to maximum number of pixels in Y dimension
  4738. *
  4739. * @return
  4740. * - \ref NVML_SUCCESS successful completion
  4741. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4742. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a xdim or \a ydim are NULL, or \a displayIndex
  4743. * is out of range.
  4744. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4745. */
  4746. nvmlReturn_t DECLDIR nvmlVgpuTypeGetResolution(nvmlVgpuTypeId_t vgpuTypeId, unsigned int displayIndex, unsigned int *xdim, unsigned int *ydim);
  4747. /**
  4748. * Retrieve license requirements for a vGPU type
  4749. *
  4750. * The license type and version required to run the specified vGPU type is returned as an alphanumeric string, in the form
  4751. * "<license name>,<version>", for example "GRID-Virtual-PC,2.0". If a vGPU is runnable with* more than one type of license,
  4752. * the licenses are delimited by a semicolon, for example "GRID-Virtual-PC,2.0;GRID-Virtual-WS,2.0;GRID-Virtual-WS-Ext,2.0".
  4753. *
  4754. * The total length of the returned string will not exceed 128 characters, including the NUL terminator.
  4755. * See \ref nvmlVgpuConstants::NVML_GRID_LICENSE_BUFFER_SIZE.
  4756. *
  4757. * For Kepler &tm; or newer fully supported devices.
  4758. *
  4759. * @param vgpuTypeId Handle to vGPU type
  4760. * @param vgpuTypeLicenseString Pointer to buffer to return license info
  4761. * @param size Size of \a vgpuTypeLicenseString buffer
  4762. *
  4763. * @return
  4764. * - \ref NVML_SUCCESS successful completion
  4765. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4766. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid, or \a vgpuTypeLicenseString is NULL
  4767. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4768. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4769. */
  4770. nvmlReturn_t DECLDIR nvmlVgpuTypeGetLicense(nvmlVgpuTypeId_t vgpuTypeId, char *vgpuTypeLicenseString, unsigned int size);
  4771. /**
  4772. * Retrieve the static frame rate limit value of the vGPU type
  4773. *
  4774. * For Kepler &tm; or newer fully supported devices.
  4775. *
  4776. * @param vgpuTypeId Handle to vGPU type
  4777. * @param frameRateLimit Reference to return the frame rate limit value
  4778. * @return
  4779. * - \ref NVML_SUCCESS successful completion
  4780. * - \ref NVML_ERROR_NOT_SUPPORTED if frame rate limiter is turned off for the vGPU type
  4781. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4782. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a frameRateLimit is NULL
  4783. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4784. */
  4785. nvmlReturn_t DECLDIR nvmlVgpuTypeGetFrameRateLimit(nvmlVgpuTypeId_t vgpuTypeId, unsigned int *frameRateLimit);
  4786. /**
  4787. * Retrieve the maximum number of vGPU instances creatable on a device for given vGPU type
  4788. *
  4789. * For Kepler &tm; or newer fully supported devices.
  4790. *
  4791. * @param device The identifier of the target device
  4792. * @param vgpuTypeId Handle to vGPU type
  4793. * @param vgpuInstanceCount Pointer to get the max number of vGPU instances
  4794. * that can be created on a deicve for given vgpuTypeId
  4795. * @return
  4796. * - \ref NVML_SUCCESS successful completion
  4797. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4798. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuTypeId is invalid or is not supported on target device,
  4799. * or \a vgpuInstanceCount is NULL
  4800. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4801. */
  4802. nvmlReturn_t DECLDIR nvmlVgpuTypeGetMaxInstances(nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, unsigned int *vgpuInstanceCount);
  4803. /**
  4804. * Retrieve the active vGPU instances on a device.
  4805. *
  4806. * An array of active vGPU instances is returned in the caller-supplied buffer pointed at by \a vgpuInstances. The
  4807. * array elememt count is passed in \a vgpuCount, and \a vgpuCount is used to return the number of vGPU instances
  4808. * written to the buffer.
  4809. *
  4810. * If the supplied buffer is not large enough to accomodate the vGPU instance array, the function returns
  4811. * NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlVgpuInstance_t array required in \a vgpuCount.
  4812. * To query the number of active vGPU instances, call this function with *vgpuCount = 0. The code will return
  4813. * NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if no vGPU Types are supported.
  4814. *
  4815. * For Kepler &tm; or newer fully supported devices.
  4816. *
  4817. * @param device The identifier of the target device
  4818. * @param vgpuCount Pointer which passes in the array size as well as get
  4819. * back the number of types
  4820. * @param vgpuInstances Pointer to array in which to return list of vGPU instances
  4821. *
  4822. * @return
  4823. * - \ref NVML_SUCCESS successful completion
  4824. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4825. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, or \a vgpuCount is NULL
  4826. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4827. * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
  4828. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4829. */
  4830. nvmlReturn_t DECLDIR nvmlDeviceGetActiveVgpus(nvmlDevice_t device, unsigned int *vgpuCount, nvmlVgpuInstance_t *vgpuInstances);
  4831. /**
  4832. * Retrieve the VM ID associated with a vGPU instance.
  4833. *
  4834. * The VM ID is returned as a string, not exceeding 80 characters in length (including the NUL terminator).
  4835. * See \ref nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE.
  4836. *
  4837. * The format of the VM ID varies by platform, and is indicated by the type identifier returned in \a vmIdType.
  4838. *
  4839. * For Kepler &tm; or newer fully supported devices.
  4840. *
  4841. * @param vgpuInstance Identifier of the target vGPU instance
  4842. * @param vmId Pointer to caller-supplied buffer to hold VM ID
  4843. * @param size Size of buffer in bytes
  4844. * @param vmIdType Pointer to hold VM ID type
  4845. *
  4846. * @return
  4847. * - \ref NVML_SUCCESS successful completion
  4848. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4849. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a vmId or \a vmIdType are NULL
  4850. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4851. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4852. */
  4853. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetVmID(nvmlVgpuInstance_t vgpuInstance, char *vmId, unsigned int size, nvmlVgpuVmIdType_t *vmIdType);
  4854. /**
  4855. * Retrieve the UUID of a vGPU instance.
  4856. *
  4857. * The UUID is a globally unique identifier associated with the vGPU, and is returned as a 5-part hexadecimal string,
  4858. * not exceeding 80 characters in length (including the NULL terminator).
  4859. * See \ref nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE.
  4860. *
  4861. * For Kepler &tm; or newer fully supported devices.
  4862. *
  4863. * @param vgpuInstance Identifier of the target vGPU instance
  4864. * @param uuid Pointer to caller-supplied buffer to hold vGPU UUID
  4865. * @param size Size of buffer in bytes
  4866. *
  4867. * @return
  4868. * - \ref NVML_SUCCESS successful completion
  4869. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4870. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a uuid is NULL
  4871. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a size is too small
  4872. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4873. */
  4874. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetUUID(nvmlVgpuInstance_t vgpuInstance, char *uuid, unsigned int size);
  4875. /**
  4876. * Retrieve the NVIDIA driver version installed in the VM associated with a vGPU.
  4877. *
  4878. * The version is returned as an alphanumeric string in the caller-supplied buffer \a version. The length of the version
  4879. * string will not exceed 80 characters in length (including the NUL terminator).
  4880. * See \ref nvmlConstants::NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE.
  4881. *
  4882. * nvmlVgpuInstanceGetVmDriverVersion() may be called at any time for a vGPU instance. The guest VM driver version is
  4883. * returned as "Unknown" if no NVIDIA driver is installed in the VM, or the VM has not yet booted to the point where the
  4884. * NVIDIA driver is loaded and initialized.
  4885. *
  4886. * For Kepler &tm; or newer fully supported devices.
  4887. *
  4888. * @param vgpuInstance Identifier of the target vGPU instance
  4889. * @param version Caller-supplied buffer to return driver version string
  4890. * @param length Size of \a version buffer
  4891. *
  4892. * @return
  4893. * - \ref NVML_SUCCESS if \a version has been set
  4894. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4895. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid
  4896. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a length is too small
  4897. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4898. */
  4899. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetVmDriverVersion(nvmlVgpuInstance_t vgpuInstance, char* version, unsigned int length);
  4900. /**
  4901. * Retrieve the framebuffer usage in bytes.
  4902. *
  4903. * Framebuffer usage is the amont of vGPU framebuffer memory that is currently in use by the VM.
  4904. *
  4905. * For Kepler &tm; or newer fully supported devices.
  4906. *
  4907. * @param vgpuInstance The identifier of the target instance
  4908. * @param fbUsage Pointer to framebuffer usage in bytes
  4909. *
  4910. * @return
  4911. * - \ref NVML_SUCCESS successful completion
  4912. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4913. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a fbUsage is NULL
  4914. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4915. */
  4916. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFbUsage(nvmlVgpuInstance_t vgpuInstance, unsigned long long *fbUsage);
  4917. /**
  4918. * Retrieve the current licensing state of the vGPU instance.
  4919. *
  4920. * If the vGPU is currently licensed, \a licensed is set to 1, otherwise it is set to 0.
  4921. *
  4922. * For Kepler &tm; or newer fully supported devices.
  4923. *
  4924. * @param vgpuInstance Identifier of the target vGPU instance
  4925. * @param licensed Reference to return the licensing status
  4926. *
  4927. * @return
  4928. * - \ref NVML_SUCCESS if \a licensed has been set
  4929. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4930. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a licensed is NULL
  4931. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4932. */
  4933. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetLicenseStatus(nvmlVgpuInstance_t vgpuInstance, unsigned int *licensed);
  4934. /**
  4935. * Retrieve the vGPU type of a vGPU instance.
  4936. *
  4937. * Returns the vGPU type ID of vgpu assigned to the vGPU instance.
  4938. *
  4939. * For Kepler &tm; or newer fully supported devices.
  4940. *
  4941. * @param vgpuInstance Identifier of the target vGPU instance
  4942. * @param vgpuTypeId Reference to return the vgpuTypeId
  4943. *
  4944. * @return
  4945. * - \ref NVML_SUCCESS if \a vgpuTypeId has been set
  4946. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4947. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a vgpuTypeId is NULL
  4948. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4949. */
  4950. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetType(nvmlVgpuInstance_t vgpuInstance, nvmlVgpuTypeId_t *vgpuTypeId);
  4951. /**
  4952. * Retrieve the frame rate limit set for the vGPU instance.
  4953. *
  4954. * Returns the value of the frame rate limit set for the vGPU instance
  4955. *
  4956. * For Kepler &tm; or newer fully supported devices.
  4957. *
  4958. * @param vgpuInstance Identifier of the target vGPU instance
  4959. * @param frameRateLimit Reference to return the frame rate limit
  4960. *
  4961. * @return
  4962. * - \ref NVML_SUCCESS if \a frameRateLimit has been set
  4963. * - \ref NVML_ERROR_NOT_SUPPORTED if frame rate limiter is turned off for the vGPU type
  4964. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4965. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a frameRateLimit is NULL
  4966. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4967. */
  4968. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetFrameRateLimit(nvmlVgpuInstance_t vgpuInstance, unsigned int *frameRateLimit);
  4969. /**
  4970. * Retrieve the encoder Capacity of a vGPU instance, in macroblocks per second.
  4971. *
  4972. * For Maxwell &tm; or newer fully supported devices.
  4973. *
  4974. * @param vgpuInstance Identifier of the target vGPU instance
  4975. * @param encoderCapacity Reference to an unsigned int for the encoder capacity
  4976. *
  4977. * @return
  4978. * - \ref NVML_SUCCESS if \a encoderCapacity has been retrived
  4979. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4980. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid, or \a encoderQueryType is invalid
  4981. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4982. */
  4983. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int *encoderCapacity);
  4984. /**
  4985. * Set the encoder Capacity of a vGPU instance, in macroblocks per second.
  4986. *
  4987. * For Maxwell &tm; or newer fully supported devices.
  4988. *
  4989. * @param vgpuInstance Identifier of the target vGPU instance
  4990. * @param encoderCapacity Unsigned int for the encoder capacity value
  4991. *
  4992. * @return
  4993. * - \ref NVML_SUCCESS if \a encoderCapacity has been set
  4994. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  4995. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a vgpuInstance is invalid
  4996. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  4997. */
  4998. nvmlReturn_t DECLDIR nvmlVgpuInstanceSetEncoderCapacity(nvmlVgpuInstance_t vgpuInstance, unsigned int encoderCapacity);
  4999. /**
  5000. * Retrieves current utilization for vGPUs on a physical GPU (device).
  5001. *
  5002. * For Kepler &tm; or newer fully supported devices.
  5003. *
  5004. * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for vGPU instances running
  5005. * on a device. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer
  5006. * pointed at by \a utilizationSamples. One utilization sample structure is returned per vGPU instance, and includes the
  5007. * CPU timestamp at which the samples were recorded. Individual utilization values are returned as "unsigned int" values
  5008. * in nvmlValue_t unions. The function sets the caller-supplied \a sampleValType to NVML_VALUE_TYPE_UNSIGNED_INT to
  5009. * indicate the returned value type.
  5010. *
  5011. * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with
  5012. * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance
  5013. * count in \a vgpuInstanceSamplesCount, or NVML_SUCCESS if the current vGPU instance count is zero. The caller should allocate
  5014. * a buffer of size vgpuInstanceSamplesCount * sizeof(nvmlVgpuInstanceUtilizationSample_t). Invoke the function again with
  5015. * the allocated buffer passed in \a utilizationSamples, and \a vgpuInstanceSamplesCount set to the number of entries the
  5016. * buffer is sized for.
  5017. *
  5018. * On successful return, the function updates \a vgpuInstanceSampleCount with the number of vGPU utilization sample
  5019. * structures that were actually written. This may differ from a previously read value as vGPU instances are created or
  5020. * destroyed.
  5021. *
  5022. * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
  5023. * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp
  5024. * to a timeStamp retrieved from a previous query to read utilization since the previous query.
  5025. *
  5026. * @param device The identifier for the target device
  5027. * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp.
  5028. * @param sampleValType Pointer to caller-supplied buffer to hold the type of returned sample values
  5029. * @param vgpuInstanceSamplesCount Pointer to caller-supplied array size, and returns number of vGPU instances
  5030. * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU utilization samples are returned
  5031. * @return
  5032. * - \ref NVML_SUCCESS if utilization samples are successfully retrieved
  5033. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  5034. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuInstanceSamplesCount or \a sampleValType is
  5035. * NULL, or a sample count of 0 is passed with a non-NULL \a utilizationSamples
  5036. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuInstanceSamplesCount is too small to return samples for all
  5037. * vGPU instances currently executing on the device
  5038. * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
  5039. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  5040. * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
  5041. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5042. */
  5043. nvmlReturn_t DECLDIR nvmlDeviceGetVgpuUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp,
  5044. nvmlValueType_t *sampleValType, unsigned int *vgpuInstanceSamplesCount,
  5045. nvmlVgpuInstanceUtilizationSample_t *utilizationSamples);
  5046. /**
  5047. * Retrieves current utilization for processes running on vGPUs on a physical GPU (device).
  5048. *
  5049. * For Maxwell &tm; or newer fully supported devices.
  5050. *
  5051. * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running on
  5052. * vGPU instances active on a device. Utilization values are returned as an array of utilization sample structures in the
  5053. * caller-supplied buffer pointed at by \a utilizationSamples. One utilization sample structure is returned per process running
  5054. * on vGPU instances, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which
  5055. * the samples were recorded. Individual utilization values are returned as "unsigned int" values.
  5056. *
  5057. * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with
  5058. * \a utilizationSamples set to NULL. The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU instance
  5059. * count in \a vgpuProcessSamplesCount. The caller should allocate a buffer of size
  5060. * vgpuProcessSamplesCount * sizeof(nvmlVgpuProcessUtilizationSample_t). Invoke the function again with
  5061. * the allocated buffer passed in \a utilizationSamples, and \a vgpuProcessSamplesCount set to the number of entries the
  5062. * buffer is sized for.
  5063. *
  5064. * On successful return, the function updates \a vgpuSubProcessSampleCount with the number of vGPU sub process utilization sample
  5065. * structures that were actually written. This may differ from a previously read value depending on the number of processes that are active
  5066. * in any given sample period.
  5067. *
  5068. * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
  5069. * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp
  5070. * to a timeStamp retrieved from a previous query to read utilization since the previous query.
  5071. *
  5072. * @param device The identifier for the target device
  5073. * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp.
  5074. * @param vgpuProcessSamplesCount Pointer to caller-supplied array size, and returns number of processes running on vGPU instances
  5075. * @param utilizationSamples Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned
  5076. * @return
  5077. * - \ref NVML_SUCCESS if utilization samples are successfully retrieved
  5078. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  5079. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a vgpuProcessSamplesCount or a sample count of 0 is
  5080. * passed with a non-NULL \a utilizationSamples
  5081. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if supplied \a vgpuProcessSamplesCount is too small to return samples for all
  5082. * vGPU instances currently executing on the device
  5083. * - \ref NVML_ERROR_NOT_SUPPORTED if vGPU is not supported by the device
  5084. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  5085. * - \ref NVML_ERROR_NOT_FOUND if sample entries are not found
  5086. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5087. */
  5088. nvmlReturn_t DECLDIR nvmlDeviceGetVgpuProcessUtilization(nvmlDevice_t device, unsigned long long lastSeenTimeStamp,
  5089. unsigned int *vgpuProcessSamplesCount,
  5090. nvmlVgpuProcessUtilizationSample_t *utilizationSamples);
  5091. /**
  5092. * Retrieve the GRID licensable features.
  5093. *
  5094. * Identifies whether the system supports GRID Software Licensing. If it does, return the list of licensable feature(s)
  5095. * and their current license status.
  5096. *
  5097. * @param device Identifier of the target device
  5098. * @param pGridLicensableFeatures Pointer to structure in which GRID licensable features are returned
  5099. *
  5100. * @return
  5101. * - \ref NVML_SUCCESS if licensable features are successfully retrieved
  5102. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a pGridLicensableFeatures is NULL
  5103. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5104. */
  5105. nvmlReturn_t DECLDIR nvmlDeviceGetGridLicensableFeatures(nvmlDevice_t device, nvmlGridLicensableFeatures_t *pGridLicensableFeatures);
  5106. /**
  5107. * Retrieves the current encoder statistics of a vGPU Instance
  5108. *
  5109. * For Maxwell &tm; or newer fully supported devices.
  5110. *
  5111. * @param vgpuInstance Identifier of the target vGPU instance
  5112. * @param sessionCount Reference to an unsigned int for count of active encoder sessions
  5113. * @param averageFps Reference to an unsigned int for trailing average FPS of all active sessions
  5114. * @param averageLatency Reference to an unsigned int for encode latency in microseconds
  5115. *
  5116. * @return
  5117. * - \ref NVML_SUCCESS if \a sessionCount, \a averageFps and \a averageLatency is fetched
  5118. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  5119. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount , or \a averageFps or \a averageLatency is NULL
  5120. * or \a vgpuInstance is invalid.
  5121. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5122. */
  5123. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderStats(nvmlVgpuInstance_t vgpuInstance, unsigned int *sessionCount,
  5124. unsigned int *averageFps, unsigned int *averageLatency);
  5125. /**
  5126. * Retrieves information about all active encoder sessions on a vGPU Instance.
  5127. *
  5128. * An array of active encoder sessions is returned in the caller-supplied buffer pointed at by \a sessionInfo. The
  5129. * array elememt count is passed in \a sessionCount, and \a sessionCount is used to return the number of sessions
  5130. * written to the buffer.
  5131. *
  5132. * If the supplied buffer is not large enough to accomodate the active session array, the function returns
  5133. * NVML_ERROR_INSUFFICIENT_SIZE, with the element count of nvmlEncoderSessionInfo_t array required in \a sessionCount.
  5134. * To query the number of active encoder sessions, call this function with *sessionCount = 0. The code will return
  5135. * NVML_SUCCESS with number of active encoder sessions updated in *sessionCount.
  5136. *
  5137. * For Maxwell &tm; or newer fully supported devices.
  5138. *
  5139. * @param vgpuInstance Identifier of the target vGPU instance
  5140. * @param sessionCount Reference to caller supplied array size, and returns
  5141. * the number of sessions.
  5142. * @param sessionInfo Reference to caller supplied array in which the list
  5143. * of session information us returned.
  5144. *
  5145. * @return
  5146. * - \ref NVML_SUCCESS if \a sessionInfo is fetched
  5147. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  5148. * - \ref NVML_ERROR_INSUFFICIENT_SIZE if \a sessionCount is too small, array element count is
  5149. returned in \a sessionCount
  5150. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a sessionCount is NULL or \a vgpuInstance is invalid..
  5151. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5152. */
  5153. nvmlReturn_t DECLDIR nvmlVgpuInstanceGetEncoderSessions(nvmlVgpuInstance_t vgpuInstance, unsigned int *sessionCount, nvmlEncoderSessionInfo_t *sessionInfo);
  5154. /**
  5155. * Retrieves the current utilization and process ID
  5156. *
  5157. * For Maxwell &tm; or newer fully supported devices.
  5158. *
  5159. * Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running.
  5160. * Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at
  5161. * by \a utilization. One utilization sample structure is returned per process running, that had some non-zero utilization
  5162. * during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values
  5163. * are returned as "unsigned int" values.
  5164. *
  5165. * To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with
  5166. * \a utilization set to NULL. The caller should allocate a buffer of size
  5167. * processSamplesCount * sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed
  5168. * in \a utilization, and \a processSamplesCount set to the number of entries the buffer is sized for.
  5169. *
  5170. * On successful return, the function updates \a processSamplesCount with the number of process utilization sample
  5171. * structures that were actually written. This may differ from a previously read value as instances are created or
  5172. * destroyed.
  5173. *
  5174. * lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0
  5175. * to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp
  5176. * to a timeStamp retrieved from a previous query to read utilization since the previous query.
  5177. *
  5178. * @param device The identifier of the target device
  5179. * @param utilization Pointer to caller-supplied buffer in which guest process utilization samples are returned
  5180. * @param processSamplesCount Pointer to caller-supplied array size, and returns number of processes running
  5181. * @param lastSeenTimeStamp Return only samples with timestamp greater than lastSeenTimeStamp.
  5182. * @return
  5183. * - \ref NVML_SUCCESS if \a utilization has been populated
  5184. * - \ref NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
  5185. * - \ref NVML_ERROR_INVALID_ARGUMENT if \a device is invalid, \a utilization is NULL, or \a samplingPeriodUs is NULL
  5186. * - \ref NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
  5187. * - \ref NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
  5188. * - \ref NVML_ERROR_UNKNOWN on any unexpected error
  5189. */
  5190. nvmlReturn_t DECLDIR nvmlDeviceGetProcessUtilization(nvmlDevice_t device, nvmlProcessUtilizationSample_t *utilization,
  5191. unsigned int *processSamplesCount, unsigned long long lastSeenTimeStamp);
  5192. /** @} */
  5193. /**
  5194. * NVML API versioning support
  5195. */
  5196. #if defined(__NVML_API_VERSION_INTERNAL)
  5197. #undef nvmlDeviceGetPciInfo
  5198. #undef nvmlDeviceGetCount
  5199. #undef nvmlDeviceGetHandleByIndex
  5200. #undef nvmlDeviceGetHandleByPciBusId
  5201. #undef nvmlInit
  5202. #endif
  5203. #ifdef __cplusplus
  5204. }
  5205. #endif
  5206. #endif