NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
GPU Resource Manager API

Detailed Description

Manages GPU resources.

For related information, see Discrete GPU in the Development Guide.

General usage notes:

Data Structures

struct  NvRmGpuLibOpenAttrRec
 
struct  NvRmGpuLibDeviceListEntryRec
 
struct  NvRmGpuDeviceOpenAttrRec
 
struct  NvRmGpuClockGetEntryRec
 
struct  NvRmGpuClockSetEntryRec
 
struct  NvRmGpuClockRangeRec
 
struct  NvRmGpuClockPointRec
 
struct  NvRmGpuClockDomainInfoRec
 
struct  NvRmGpuDeviceEventSessionOpenAttrRec
 Holds the events for which to listen. More...
 
struct  NvRmGpuDeviceEventInfoRec
 

Macros

#define NVRM_GPU_DEFINE_LIB_OPEN_ATTR(x)   NvRmGpuLibOpenAttr x = { 0 }
 
#define NVRM_GPU_DEVICE_INDEX_DEFAULT   (-1)
 
#define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR(x)   NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false }
 
#define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT   "p"
 NvRmGpuDevice subinterface for application-driven GPU clock frequency management. More...
 
#define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR(x)   NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 }
 

Typedefs

typedef struct NvRmGpuLibRec NvRmGpuLib
 Handle type. More...
 
typedef struct NvRmGpuDeviceRec NvRmGpuDevice
 Handle type. More...
 
typedef struct
NvRmGpuLibOpenAttrRec 
NvRmGpuLibOpenAttr
 
typedef struct
NvRmGpuLibDeviceListEntryRec 
NvRmGpuLibDeviceListEntry
 
typedef struct
NvRmGpuDeviceOpenAttrRec 
NvRmGpuDeviceOpenAttr
 
typedef struct
NvRmGpuClockAsyncNotImplemented * 
NvRmGpuClockAsyncReqHandle
 
typedef enum NvRmGpuClockDomain NvRmGpuClockDomain
 Clock domains. More...
 
typedef enum NvRmGpuClockType NvRmGpuClockType
 
typedef struct
NvRmGpuClockGetEntryRec 
NvRmGpuClockGetEntry
 
typedef struct
NvRmGpuClockSetEntryRec 
NvRmGpuClockSetEntry
 
typedef struct NvRmGpuClockRangeRec NvRmGpuClockRange
 
typedef struct NvRmGpuClockPointRec NvRmGpuClockPoint
 
typedef struct
NvRmGpuClockDomainInfoRec 
NvRmGpuClockDomainInfo
 
typedef struct
NvRmGpuDeviceEventSessionRec 
NvRmGpuDeviceEventSession
 
typedef struct
NvRmGpuDeviceEventSessionOpenAttrRec 
NvRmGpuDeviceEventSessionOpenAttr
 Holds the events for which to listen. More...
 
typedef struct
NvRmGpuDeviceEventInfoRec 
NvRmGpuDeviceEventInfo
 

Enumerations

enum  NvRmGpuDeviceState {
  NvRmGpuLibDeviceState_Detached,
  NvRmGpuLibDeviceState_Attached
}
 
enum  NvRmGpuSyncType {
  NvRmGpuSyncType_Default,
  NvRmGpuSyncType_SyncFd,
  NvRmGpuSyncType_Syncpoint
}
 
enum  NvRmGpuClockDomain {
  NvRmGpuClockDomain_MCLK = 0,
  NvRmGpuClockDomain_GPCCLK,
  NvRmGpuClockDomain_Count
}
 Clock domains. More...
 
enum  NvRmGpuClockType {
  NvRmGpuClockType_Target = 1,
  NvRmGpuClockType_Actual,
  NvRmGpuClockType_Effective
}
 
enum  NvRmGpuDeviceVoltage {
  NvRmGpuDeviceVoltage_Core = 1,
  NvRmGpuDeviceVoltage_SRAM,
  NvRmGpuDeviceVoltage_Bus
}
 
enum  NvRmGpuDeviceCurrent { NvRmGpuDeviceCurrent_Bus = 1 }
 
enum  NvRmGpuDevicePower { NvRmGpuDevicePower_Bus = 1 }
 
enum  NvRmGpuDeviceTemperature { NvRmGpuDeviceTemperature_InternalSensor = 1 }
 
enum  NvRmGpuDeviceEventId {
  NvRmGpuDeviceEventId_VfUpdate = 0,
  NvRmGpuDeviceEventId_AlarmTargetVfNotPossible,
  NvRmGpuDeviceEventId_AlarmLocalTargetVfNotPossible,
  NvRmGpuDeviceEventId_AlarmClockArbiterFailed,
  NvRmGpuDeviceEventId_AlarmVfTableUpdateFailed,
  NvRmGpuDeviceEventId_AlarmThermalAboveThreshold,
  NvRmGpuDeviceEventId_AlarmPowerAboveThreshold,
  NvRmGpuDeviceEventId_AlarmGpuLost,
  NvRmGpuDeviceEventId_Count
}
 Holds information about the GPU device event. More...
 

Functions

NvRmGpuLibNvRmGpuLibOpen (const NvRmGpuLibOpenAttr *attr)
 Opens a new instance of the library. More...
 
void NvRmGpuLibClose (NvRmGpuLib *hlib)
 Closes the library and releases all resources. More...
 
const NvRmGpuLibDeviceListEntryNvRmGpuLibListDevices (NvRmGpuLib *hlib, size_t *pnumDevices)
 Returns a pointer to the device array. More...
 
NvError NvRmGpuLibAttachDevice (NvRmGpuLib *const hlib, const int deviceIndex)
 Power up and attach a GPU. More...
 
NvError NvRmGpuLibDetachDevice (NvRmGpuLib *const hlib, const int deviceIndex)
 Detach and power down a GPU. More...
 
NvError NvRmGpuDeviceOpen (NvRmGpuLib *hLib, int deviceIndex, const NvRmGpuDeviceOpenAttr *attr, NvRmGpuDevice **phDevice)
 Opens the GPU device. More...
 
void NvRmGpuDeviceClose (NvRmGpuDevice *hDevice)
 Closes the GPU device. More...
 
NvError NvRmGpuClockGetDomains (NvRmGpuDevice *hDevice, const NvRmGpuClockDomainInfo **infos, size_t *pNumDomains)
 Gets configurable clock domains. More...
 
NvError NvRmGpuClockGetPoints (NvRmGpuDevice *hDevice, NvRmGpuClockDomain domain, NvRmGpuClockPoint *pClkPoints, size_t *pNumPoints)
 Gets VF points for a given clock domain. More...
 
NvError NvRmGpuClockSet (NvRmGpuDevice *hDevice, const NvRmGpuClockSetEntry *pClkSetEntries, size_t numEntries, NvRmGpuClockAsyncReqHandle *phReq)
 Sets a clock request. More...
 
NvError NvRmGpuClockWaitAsyncReq (NvRmGpuDevice *hDevice, const NvRmGpuClockAsyncReqHandle *phReqs, size_t numEntries, uint32_t timeoutMs)
 Waits for completion of one or more asynchronous requests. More...
 
NvError NvRmGpuClockCloseAsyncReq (NvRmGpuDevice *hDevice, NvRmGpuClockAsyncReqHandle hReq)
 Closes an asynchronous request handle. More...
 
NvError NvRmGpuClockWaitAnyEvent (NvRmGpuDevice *hDevice, uint32_t timeoutMs)
 Waits on any clock update event. More...
 
NvError NvRmGpuClockGet (NvRmGpuDevice *hDevice, NvRmGpuClockGetEntry *pClkGetEntries, size_t numEntries)
 Gets clock state(s). More...
 
NvError NvRmGpuDeviceGetLoad (NvRmGpuDevice *hDevice, uint32_t *pLoadPerMille)
 Gets gpu load. More...
 
NvError NvRmGpuDeviceListVoltageSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceVoltage **pSensors, size_t *numSensors)
 Gets a list of the available voltage sensors. More...
 
NvError NvRmGpuDeviceGetVoltage (NvRmGpuDevice *hDevice, NvRmGpuDeviceVoltage which, uint64_t *pVoltageMicroVolt)
 Gets the current voltage. More...
 
NvError NvRmGpuDeviceListCurrentSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceCurrent **pSensors, size_t *numSensors)
 Gets a list of the available current sensors. More...
 
NvError NvRmGpuDeviceGetCurrent (NvRmGpuDevice *hDevice, NvRmGpuDeviceCurrent which, uint64_t *pCurrentMicroAmpere)
 Gets the current drawn by the GPU. More...
 
NvError NvRmGpuDeviceListPowerSensors (NvRmGpuDevice *hDevice, const NvRmGpuDevicePower **pSensors, size_t *numSensors)
 Gets a list of the available power sensors. More...
 
NvError NvRmGpuDeviceGetPower (NvRmGpuDevice *hDevice, NvRmGpuDevicePower which, uint64_t *pPowerMicroWatt)
 Gets the power consumed by the GPU. More...
 
NvError NvRmGpuDeviceListTemperatureSensors (NvRmGpuDevice *hDevice, const NvRmGpuDeviceTemperature **pSensors, size_t *numSensors)
 Gets the list of available temperature sensors. More...
 
NvError NvRmGpuDeviceGetTemperature (NvRmGpuDevice *hDevice, NvRmGpuDeviceTemperature which, int32_t *pTemperatureMilliCelsius)
 Gets the temperature. More...
 
NvError NvRmGpuDeviceThermalAlertSetLimit (NvRmGpuDevice *hDevice, int32_t temperature_mC)
 Sets the thermal alert limit. More...
 
static void NvRmGpuDeviceEventSessionOpenAttrSetAllEvents (NvRmGpuDeviceEventSessionOpenAttr *attr)
 
NvError NvRmGpuDeviceEventSessionOpen (NvRmGpuDevice *hDevice, const NvRmGpuDeviceEventSessionOpenAttr *attr, NvRmGpuDeviceEventSession **phSession)
 Opens the session to monitor device events. More...
 
NvError NvRmGpuDeviceEventSessionRead (NvRmGpuDeviceEventSession *hSession, NvRmGpuDeviceEventInfo *pEventInfo, uint32_t timeoutMs)
 Reads detailed event information from the event session. More...
 
void NvRmGpuDeviceEventSessionClose (NvRmGpuDeviceEventSession *hSession)
 Closes the event session. More...
 

Macro Definition Documentation

#define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT   "p"

NvRmGpuDevice subinterface for application-driven GPU clock frequency management.

  • The lifespan of GPU clock requests is tied to the NvRmGpuDevice instance. All requests are canceled when the NvRmGpuDevice handle is closed.
  • The clock requests of all NvRmGpuDevice instances are coalesced. Generally, given that thermal and power limits are not exceeded, the actual clock frequency will be at least the greatest requested. The exact selection algorithm depends on the global clock management driver policy. The selection algorithm is run by the "clock arbiter".
  • Each clock domain has VF points, defined as frequencies for which voltage is optimal. The clock arbiter will try to program frequencies which correspond to VF points.
  • A single clock request can set target frequencies for multiple clock domains
  • Clock requests can be either synchronous or asynchronous. In asynchronous mode a request handle is allocated and can be used to wait for request completion. This request handle must be freed by application.
  • It is possible to wait for any clock change event, in order to detect clock changes that originated from other applications or thermal conditions.

Definition at line 237 of file nvrm_gpu.h.

#define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR (   x)    NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 }

Definition at line 616 of file nvrm_gpu.h.

#define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR (   x)    NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false }

Definition at line 185 of file nvrm_gpu.h.

#define NVRM_GPU_DEFINE_LIB_OPEN_ATTR (   x)    NvRmGpuLibOpenAttr x = { 0 }

Definition at line 92 of file nvrm_gpu.h.

#define NVRM_GPU_DEVICE_INDEX_DEFAULT   (-1)

Definition at line 156 of file nvrm_gpu.h.

Typedef Documentation

typedef struct NvRmGpuClockAsyncNotImplemented* NvRmGpuClockAsyncReqHandle

Definition at line 238 of file nvrm_gpu.h.

Clock domains.

typedef struct NvRmGpuDeviceRec NvRmGpuDevice

Handle type.

Definition at line 81 of file nvrm_gpu.h.

typedef struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession

Definition at line 605 of file nvrm_gpu.h.

Holds the events for which to listen.

typedef struct NvRmGpuLibRec NvRmGpuLib

Handle type.

Definition at line 79 of file nvrm_gpu.h.

Enumeration Type Documentation

Clock domains.

Enumerator
NvRmGpuClockDomain_MCLK 

Memory clock.

NvRmGpuClockDomain_GPCCLK 

Main graphics core clock.

NvRmGpuClockDomain_Count 

Definition at line 244 of file nvrm_gpu.h.

Enumerator
NvRmGpuClockType_Target 

Target clock frequency requested by application.

NvRmGpuClockType_Actual 

Actual clock frequency programmed (including PLL constraints).

NvRmGpuClockType_Effective 

Effective clock, measured from hardware.

Definition at line 251 of file nvrm_gpu.h.

Enumerator
NvRmGpuDeviceCurrent_Bus 

Definition at line 473 of file nvrm_gpu.h.

Holds information about the GPU device event.

Enumerator
NvRmGpuDeviceEventId_VfUpdate 

VF update occurred for a clock domain, either because one session changed target frequency or because of thermal or power conditions.

NvRmGpuDeviceEventId_AlarmTargetVfNotPossible 

One clock domain frequency is below target.

NvRmGpuDeviceEventId_AlarmLocalTargetVfNotPossible 

One clock domain frequency is below local target frequency requested by one session.

NvRmGpuDeviceEventId_AlarmClockArbiterFailed 

Clock Arbiter failed.

NvRmGpuDeviceEventId_AlarmVfTableUpdateFailed 

Vf table update failed.

NvRmGpuDeviceEventId_AlarmThermalAboveThreshold 

Temperature above threshold.

NvRmGpuDeviceEventId_AlarmPowerAboveThreshold 

Power above threshold.

NvRmGpuDeviceEventId_AlarmGpuLost 

GPU lost (non-recoverable).

NvRmGpuDeviceEventId_Count 

Number of events.

Definition at line 582 of file nvrm_gpu.h.

Enumerator
NvRmGpuDevicePower_Bus 

Definition at line 505 of file nvrm_gpu.h.

Enumerator
NvRmGpuLibDeviceState_Detached 
NvRmGpuLibDeviceState_Attached 

Definition at line 106 of file nvrm_gpu.h.

Enumerator
NvRmGpuDeviceTemperature_InternalSensor 

Definition at line 538 of file nvrm_gpu.h.

Enumerator
NvRmGpuDeviceVoltage_Core 
NvRmGpuDeviceVoltage_SRAM 
NvRmGpuDeviceVoltage_Bus 

Definition at line 440 of file nvrm_gpu.h.

Enumerator
NvRmGpuSyncType_Default 
NvRmGpuSyncType_SyncFd 
NvRmGpuSyncType_Syncpoint 

Definition at line 158 of file nvrm_gpu.h.

Function Documentation

NvError NvRmGpuClockCloseAsyncReq ( NvRmGpuDevice hDevice,
NvRmGpuClockAsyncReqHandle  hReq 
)

Closes an asynchronous request handle.

Frees all resources related to an asynchronous request. It is not mandatory to wait for request completion, before closing the handle.

Parameters
hDeviceGPU device handle.
hReqRequest handle obtained from NvRmGpuClockSet.
Returns
NvSuccess indicates that handle was closed.
NvError NvRmGpuClockGet ( NvRmGpuDevice hDevice,
NvRmGpuClockGetEntry pClkGetEntries,
size_t  numEntries 
)

Gets clock state(s).

Parameters
[in]hDeviceGPU device handle
[out]pClkGetEntriesArray of clock entries. For each entry, the clock domain and clock types MUST be set, and the associated frequency will be returned on a successful call. It is allowed to mix several clocks domains and clock types in the same request.
[out]numEntriesNumber of entries to query
Returns
NvSuccess indicates that request was successful.
NvError NvRmGpuClockGetDomains ( NvRmGpuDevice hDevice,
const NvRmGpuClockDomainInfo **  infos,
size_t *  pNumDomains 
)

Gets configurable clock domains.

Parameters
[in]hDeviceGPU device handle.
[out]infosArray of configurable clock domains. This list is valid only during the life-time of the hDevice handle.
[out]pNumDomainsNumber of domains in array.
Returns
NvSuccess indicates that request was successful.
NvError NvRmGpuClockGetPoints ( NvRmGpuDevice hDevice,
NvRmGpuClockDomain  domain,
NvRmGpuClockPoint pClkPoints,
size_t *  pNumPoints 
)

Gets VF points for a given clock domain.

For information about VF points, see NvRmGpuClockAsyncReqHandle.

Parameters
[in]hDeviceGPU device handle.
[in]domainClock domain to query.
[in,out]pClkPointsArray of optimal Voltage/Frequency points. The allocated array must contain space for at least NvRmGpuClockDomainInfo::maxVfPoints (as retrieved by NvRmGpuClockGetDomains())
[out]pNumPointsNumber of VF points. May vary depending on thermal conditions, and be lower than maxPoints.
Returns
NvSuccess indicates that request was successful.
NvError NvRmGpuClockSet ( NvRmGpuDevice hDevice,
const NvRmGpuClockSetEntry pClkSetEntries,
size_t  numEntries,
NvRmGpuClockAsyncReqHandle phReq 
)

Sets a clock request.

Parameters
[in]hDeviceGPU device handle.
[in]pClkSetEntriesArray of entries. Each entry specifies target frequency for one clock domain. If a clock domain appears multiple times, then only last entry will be taken into account.
[in]numEntriesNumber of entries in the pClkSetEntries array.
[in,out]phReqA pointer to request handle.
  • (in) If NULL, the request is synchronous and function waits until all clocks are programmed. Otherwise, the request is asynchronous and is assigned a request handle. The application may wait for asynchronous request completion using NvRmGpuClockWaitAsync(). The request handle MUST be freed by the application using NvRmGpuClockCloseAsyncReq().
    • (out) The request handle that was assigned to this asynchronous request.
Returns
NvSuccess indicates that the request has completed in the synchronous case, and that the request was successfully submitted in the asynchronous case. NvError_Busy indicates that an asynchronous request could not be submitted, and application should try again.
Note
  • A subsequent clock request to a domain supersedes the previous request
  • Actual frequency might differ depending on global policies, requests from other NvRmGpuDevice instances, or thermal conditions.
  • If specified target frequency is not a VF point, clock arbiter will try to program the clocks with first VF point that is greater than or equal to specified target frequency (assuming a single application)
  • All clock requests will be cancelled when hDevice is closed.
NvError NvRmGpuClockWaitAnyEvent ( NvRmGpuDevice hDevice,
uint32_t  timeoutMs 
)

Waits on any clock update event.

Parameters
hDeviceGPU device handle
timeoutMsTimeout value in milliseconds. NV_WAIT_INFINITE for no timeout.
Returns
NvSuccess indicates that we received a clock change event. NvError_Timeout indicates that timeout was reached.
Note
If several clock changes occurred between two calls to this function, then a single event will be reported.
NvError NvRmGpuClockWaitAsyncReq ( NvRmGpuDevice hDevice,
const NvRmGpuClockAsyncReqHandle phReqs,
size_t  numEntries,
uint32_t  timeoutMs 
)

Waits for completion of one or more asynchronous requests.

Parameters
hDeviceGPU device handle.
phReqsArray of request handles.
numEntriesNumber of entries in array.
timeoutMsTimeout value in milliseconds. Set this value as follows:
  • timeoutMs = <positive integer> for time-limited polling, where the function returns when the request completes or when the timeout expires, whichever comes first.
  • timeoutMs = 0 specifies open-ended polling, where the function returns only when the request has completed.
Returns
NvSuccess indicates that requests have completed. NvError_Timeout indicates that timeout was reached.
void NvRmGpuDeviceClose ( NvRmGpuDevice hDevice)

Closes the GPU device.

void NvRmGpuDeviceEventSessionClose ( NvRmGpuDeviceEventSession hSession)

Closes the event session.

Parameters
hSessionEvent session handle
Returns
NvSuccess on successful operation.
NvError NvRmGpuDeviceEventSessionOpen ( NvRmGpuDevice hDevice,
const NvRmGpuDeviceEventSessionOpenAttr attr,
NvRmGpuDeviceEventSession **  phSession 
)

Opens the session to monitor device events.

Parameters
[in]hDeviceGPU device handle.
[in]attrEvent session attributes, including event filter.
[out]phSessionA pointer to the event session handle.
Returns
NvSuccess if event session could be created.
NvError NvRmGpuDeviceEventSessionRead ( NvRmGpuDeviceEventSession hSession,
NvRmGpuDeviceEventInfo pEventInfo,
uint32_t  timeoutMs 
)

Reads detailed event information from the event session.

Parameters
[in]hSessionEvent session handle
[out]pEventInfoDetailed event information
[in]timeoutMsTimeout value in milliseconds. NVRM_GPU_CLK_WAIT_INFINITE to wait infinitely.
Returns
NvSuccess indicates that one event occurred, and detailed information has been updated in pEventInfo. NvError_Timeout indicates that timeout was reached.
Note
If several identical events occur between two calls to this function, then a single event will be reported. After this call, related event information is cleared.
NvError NvRmGpuDeviceGetCurrent ( NvRmGpuDevice hDevice,
NvRmGpuDeviceCurrent  which,
uint64_t *  pCurrentMicroAmpere 
)

Gets the current drawn by the GPU.

Parameters
[in]hDeviceGPU device handle.
[in]whichThe current to query.
[out]pCurrentMicroAmpereCurrent in microamperes.
Returns
: NvSuccess or NvError_NotSupported
NvError NvRmGpuDeviceGetLoad ( NvRmGpuDevice hDevice,
uint32_t *  pLoadPerMille 
)

Gets gpu load.

Parameters
[in]hDeviceGPU device handle
[out]pLoadPerMilleGPU load in permille
Returns
NvSuccess indicates that request was successful.
NvError NvRmGpuDeviceGetPower ( NvRmGpuDevice hDevice,
NvRmGpuDevicePower  which,
uint64_t *  pPowerMicroWatt 
)

Gets the power consumed by the GPU.

Parameters
[in]hDeviceGPU device handle.
[in]whichThe Power to query.
[out]pPowerMicroWattPower in microwatts.
Returns
: NvSuccess or NvError_NotSupported.
NvError NvRmGpuDeviceGetTemperature ( NvRmGpuDevice hDevice,
NvRmGpuDeviceTemperature  which,
int32_t *  pTemperatureMilliCelsius 
)

Gets the temperature.

Parameters
[in]hDeviceGPU device handle.
[in]whichTemperature sensor to query.
[out]pTemperatureMilliCelsiusTemperature in millidegrees Celsius.
Returns
: NvSuccess or NvError_NotSupported
NvError NvRmGpuDeviceGetVoltage ( NvRmGpuDevice hDevice,
NvRmGpuDeviceVoltage  which,
uint64_t *  pVoltageMicroVolt 
)

Gets the current voltage.

Parameters
[in]hDeviceGPU device handle
[in]whichThe voltage to query
[out]pVoltageMicroVoltVoltage in microvolts.
Returns
: NvSuccess or NvError_NotSupported
NvError NvRmGpuDeviceListCurrentSensors ( NvRmGpuDevice hDevice,
const NvRmGpuDeviceCurrent **  pSensors,
size_t *  numSensors 
)

Gets a list of the available current sensors.

Parameters
[in]hDeviceGPU device handle.
[out]pSensorsList of available sensors (may be NULL if no sensor is available).
[out]numSensorsNumber of sensors available.
Returns
: NvSuccess on successful operation.
NvError NvRmGpuDeviceListPowerSensors ( NvRmGpuDevice hDevice,
const NvRmGpuDevicePower **  pSensors,
size_t *  numSensors 
)

Gets a list of the available power sensors.

Parameters
[in]hDeviceGPU device handle.
[out]pSensorsList of available sensors (may be NULL if no sensor is available).
[out]numSensorsNumber of sensors available.
Returns
: NvSuccess on successful operation.
NvError NvRmGpuDeviceListTemperatureSensors ( NvRmGpuDevice hDevice,
const NvRmGpuDeviceTemperature **  pSensors,
size_t *  numSensors 
)

Gets the list of available temperature sensors.

Parameters
[in]hDeviceGPU device handle
[out]pSensorsList of available sensors (may be NULL if no sensor is available).
[out]numSensorsNumber of sensors available.
Returns
: NvSuccess on successful operation.
NvError NvRmGpuDeviceListVoltageSensors ( NvRmGpuDevice hDevice,
const NvRmGpuDeviceVoltage **  pSensors,
size_t *  numSensors 
)

Gets a list of the available voltage sensors.

Parameters
[in]hDeviceGPU device handle
[out]pSensorsList of available sensors (may be NULL if no sensor is available)
[out]numSensorsNumber of sensors available
Returns
: NvSuccess on successful operation.
NvError NvRmGpuDeviceOpen ( NvRmGpuLib hLib,
int  deviceIndex,
const NvRmGpuDeviceOpenAttr attr,
NvRmGpuDevice **  phDevice 
)

Opens the GPU device.

Note
Do not assume that the device indexes are sequential and start from zero. Use the NVRM_GPU_DEVICE_INDEX_DEFAULT for the primary GPU when the system has more than one GPU.
Only attached GPUs can be opened. A detached GPU can be attached with help of NvRmGpuLibAttachDevice(deviceIndex).
NvError NvRmGpuDeviceThermalAlertSetLimit ( NvRmGpuDevice hDevice,
int32_t  temperature_mC 
)

Sets the thermal alert limit.

Parameters
hDeviceGPU device handle.
temperature_mCThermal temperature alert limit value in millidegrees Celsius.
Returns
NvSuccess indicates that request was successful.
NvError NvRmGpuLibAttachDevice ( NvRmGpuLib *const  hlib,
const int  deviceIndex 
)

Power up and attach a GPU.

hlib: handle to nvrm gpu lib. deviceIndex: GPU device index.

Returns NvSuccess on a succesful GPU attach. Returns NvError otherwise.

void NvRmGpuLibClose ( NvRmGpuLib hlib)

Closes the library and releases all resources.

NvError NvRmGpuLibDetachDevice ( NvRmGpuLib *const  hlib,
const int  deviceIndex 
)

Detach and power down a GPU.

hlib: handle to nvrm gpu lib. deviceIndex: GPU device index.

Returns NvSuccess on a succesful GPU power-off. Returns NvError otherwise.

const NvRmGpuLibDeviceListEntry* NvRmGpuLibListDevices ( NvRmGpuLib hlib,
size_t *  pnumDevices 
)

Returns a pointer to the device array.

The size of the array is returned in pnumDevices. pnumDevices must be non-NULL.

The returned pointer is valid until the library is closed. The caller must not attempt to free the pointer.

Remarks:

  • The first device listed will always be considered the primary GPU.
  • The device index numbers returned will be non-negative, unique and in ascending order. Numbering may be discontiguous, and specifically, the index numbers will likely not start at 0.
  • Negative index numbers are reserved for pseudo indexes used by NvRmGpuDeviceOpen().
NvRmGpuLib* NvRmGpuLibOpen ( const NvRmGpuLibOpenAttr attr)

Opens a new instance of the library.

There can be multiple concurrent instances.