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