![]() |
NVIDIA DRIVE OS Linux SDK API Reference5.1.6.0 Release |
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 } |
Functions | |
NvRmGpuLib * | NvRmGpuLibOpen (const NvRmGpuLibOpenAttr *attr) |
Opens a new instance of the library. More... | |
NvError | NvRmGpuLibClose (NvRmGpuLib *hlib) |
Closes the library and releases all resources. More... | |
const NvRmGpuLibDeviceListEntry * | NvRmGpuLibListDevices (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... | |
NvError | 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... | |
NvError | NvRmGpuDeviceEventSessionClose (NvRmGpuDeviceEventSession *hSession) |
Closes the event session. More... | |
#define NVRM_GPU_CLOCK_ASYNC_REQ_HANDLE_PRIFMT "p" |
NvRmGpuDevice subinterface for application-driven GPU clock frequency management.
Definition at line 245 of file nvrm_gpu.h.
#define NVRM_GPU_DEFINE_DEVICE_EVENT_SESSION_ATTR | ( | x | ) | NvRmGpuDeviceEventSessionOpenAttr x = { NULL, 0 } |
Definition at line 624 of file nvrm_gpu.h.
#define NVRM_GPU_DEFINE_DEVICE_OPEN_ATTR | ( | x | ) | NvRmGpuDeviceOpenAttr x = { NvRmGpuSyncType_Default, false } |
Definition at line 190 of file nvrm_gpu.h.
#define NVRM_GPU_DEFINE_LIB_OPEN_ATTR | ( | x | ) | NvRmGpuLibOpenAttr x = { 0 } |
Definition at line 94 of file nvrm_gpu.h.
#define NVRM_GPU_DEVICE_INDEX_DEFAULT (-1) |
Definition at line 161 of file nvrm_gpu.h.
typedef struct NvRmGpuClockAsyncNotImplemented* NvRmGpuClockAsyncReqHandle |
Definition at line 246 of file nvrm_gpu.h.
typedef enum NvRmGpuClockDomain NvRmGpuClockDomain |
Clock domains.
typedef struct NvRmGpuClockDomainInfoRec NvRmGpuClockDomainInfo |
typedef struct NvRmGpuClockGetEntryRec NvRmGpuClockGetEntry |
typedef struct NvRmGpuClockPointRec NvRmGpuClockPoint |
typedef struct NvRmGpuClockRangeRec NvRmGpuClockRange |
typedef struct NvRmGpuClockSetEntryRec NvRmGpuClockSetEntry |
typedef enum NvRmGpuClockType NvRmGpuClockType |
typedef struct NvRmGpuDeviceRec NvRmGpuDevice |
Device handle type.
Definition at line 83 of file nvrm_gpu.h.
typedef struct NvRmGpuDeviceEventInfoRec NvRmGpuDeviceEventInfo |
typedef struct NvRmGpuDeviceEventSessionRec NvRmGpuDeviceEventSession |
Definition at line 613 of file nvrm_gpu.h.
Holds the events for which to listen.
typedef struct NvRmGpuDeviceOpenAttrRec NvRmGpuDeviceOpenAttr |
typedef struct NvRmGpuLibRec NvRmGpuLib |
Library handle type.
Definition at line 81 of file nvrm_gpu.h.
typedef struct NvRmGpuLibDeviceListEntryRec NvRmGpuLibDeviceListEntry |
typedef struct NvRmGpuLibOpenAttrRec NvRmGpuLibOpenAttr |
enum NvRmGpuClockDomain |
Clock domains.
Enumerator | |
---|---|
NvRmGpuClockDomain_MCLK |
Memory clock. |
NvRmGpuClockDomain_GPCCLK |
Main graphics core clock. |
NvRmGpuClockDomain_Count |
Definition at line 252 of file nvrm_gpu.h.
enum NvRmGpuClockType |
Definition at line 259 of file nvrm_gpu.h.
enum NvRmGpuDeviceCurrent |
Enumerator | |
---|---|
NvRmGpuDeviceCurrent_Bus |
Definition at line 481 of file nvrm_gpu.h.
enum NvRmGpuDeviceEventId |
Holds information about the GPU device event.
Definition at line 590 of file nvrm_gpu.h.
enum NvRmGpuDevicePower |
Enumerator | |
---|---|
NvRmGpuDevicePower_Bus |
Definition at line 513 of file nvrm_gpu.h.
enum NvRmGpuDeviceState |
Enumerator | |
---|---|
NvRmGpuLibDeviceState_Detached | |
NvRmGpuLibDeviceState_Attached |
Definition at line 111 of file nvrm_gpu.h.
Enumerator | |
---|---|
NvRmGpuDeviceTemperature_InternalSensor |
Definition at line 546 of file nvrm_gpu.h.
enum NvRmGpuDeviceVoltage |
Enumerator | |
---|---|
NvRmGpuDeviceVoltage_Core | |
NvRmGpuDeviceVoltage_SRAM | |
NvRmGpuDeviceVoltage_Bus |
Definition at line 448 of file nvrm_gpu.h.
enum NvRmGpuSyncType |
Enumerator | |
---|---|
NvRmGpuSyncType_Default | |
NvRmGpuSyncType_SyncFd | |
NvRmGpuSyncType_Syncpoint |
Definition at line 163 of file nvrm_gpu.h.
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.
hDevice | GPU device handle. |
hReq | Request handle obtained from NvRmGpuClockSet. |
NvError NvRmGpuClockGet | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuClockGetEntry * | pClkGetEntries, | ||
size_t | numEntries | ||
) |
Gets clock state(s).
[in] | hDevice | GPU device handle |
[out] | pClkGetEntries | Array 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] | numEntries | Number of entries to query |
NvError NvRmGpuClockGetDomains | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockDomainInfo ** | infos, | ||
size_t * | pNumDomains | ||
) |
Gets configurable clock domains.
[in] | hDevice | GPU device handle. |
[out] | infos | Array of configurable clock domains. This list is valid only during the life-time of the hDevice handle. |
[out] | pNumDomains | Number of domains in array. |
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.
[in] | hDevice | GPU device handle. |
[in] | domain | Clock domain to query. |
[in,out] | pClkPoints | Array of optimal Voltage/Frequency points. The allocated array must contain space for at least NvRmGpuClockDomainInfo::maxVfPoints (as retrieved by NvRmGpuClockGetDomains()) |
[out] | pNumPoints | Number of VF points. May vary depending on thermal conditions, and be lower than maxPoints. |
NvError NvRmGpuClockSet | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockSetEntry * | pClkSetEntries, | ||
size_t | numEntries, | ||
NvRmGpuClockAsyncReqHandle * | phReq | ||
) |
Sets a clock request.
[in] | hDevice | GPU device handle. |
[in] | pClkSetEntries | Array 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] | numEntries | Number of entries in the pClkSetEntries array. |
[in,out] | phReq | A pointer to request handle.
|
NvError NvRmGpuClockWaitAnyEvent | ( | NvRmGpuDevice * | hDevice, |
uint32_t | timeoutMs | ||
) |
Waits on any clock update event.
hDevice | GPU device handle |
timeoutMs | Timeout value in milliseconds. NV_WAIT_INFINITE for no timeout. |
NvError NvRmGpuClockWaitAsyncReq | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuClockAsyncReqHandle * | phReqs, | ||
size_t | numEntries, | ||
uint32_t | timeoutMs | ||
) |
Waits for completion of one or more asynchronous requests.
hDevice | GPU device handle. |
phReqs | Array of request handles. |
numEntries | Number of entries in array. |
timeoutMs | Timeout value in milliseconds. Set this value as follows:
|
NvError NvRmGpuDeviceClose | ( | NvRmGpuDevice * | hDevice | ) |
Closes the GPU device.
NvError NvRmGpuDeviceEventSessionClose | ( | NvRmGpuDeviceEventSession * | hSession | ) |
Closes the event session.
hSession | Event session handle |
NvError NvRmGpuDeviceEventSessionOpen | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceEventSessionOpenAttr * | attr, | ||
NvRmGpuDeviceEventSession ** | phSession | ||
) |
Opens the session to monitor device events.
[in] | hDevice | GPU device handle. |
[in] | attr | Event session attributes, including event filter. |
[out] | phSession | A pointer to the event session handle. |
|
inlinestatic |
Definition at line 627 of file nvrm_gpu.h.
References NvRmGpuDeviceEventSessionOpenAttrRec::filterList, NvRmGpuDeviceEventSessionOpenAttrRec::filterListSize, NvRmGpuDeviceEventId_AlarmClockArbiterFailed, NvRmGpuDeviceEventId_AlarmGpuLost, NvRmGpuDeviceEventId_AlarmLocalTargetVfNotPossible, NvRmGpuDeviceEventId_AlarmPowerAboveThreshold, NvRmGpuDeviceEventId_AlarmTargetVfNotPossible, NvRmGpuDeviceEventId_AlarmThermalAboveThreshold, NvRmGpuDeviceEventId_AlarmVfTableUpdateFailed, and NvRmGpuDeviceEventId_VfUpdate.
NvError NvRmGpuDeviceEventSessionRead | ( | NvRmGpuDeviceEventSession * | hSession, |
NvRmGpuDeviceEventInfo * | pEventInfo, | ||
uint32_t | timeoutMs | ||
) |
Reads detailed event information from the event session.
[in] | hSession | Event session handle |
[out] | pEventInfo | Detailed event information |
[in] | timeoutMs | Timeout value in milliseconds. NVRM_GPU_CLK_WAIT_INFINITE to wait infinitely. |
NvError NvRmGpuDeviceGetCurrent | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceCurrent | which, | ||
uint64_t * | pCurrentMicroAmpere | ||
) |
Gets the current drawn by the GPU.
[in] | hDevice | GPU device handle. |
[in] | which | The current to query. |
[out] | pCurrentMicroAmpere | Current in microamperes. |
NvError NvRmGpuDeviceGetLoad | ( | NvRmGpuDevice * | hDevice, |
uint32_t * | pLoadPerMille | ||
) |
Gets gpu load.
[in] | hDevice | GPU device handle |
[out] | pLoadPerMille | GPU load in permille |
NvError NvRmGpuDeviceGetPower | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDevicePower | which, | ||
uint64_t * | pPowerMicroWatt | ||
) |
Gets the power consumed by the GPU.
[in] | hDevice | GPU device handle. |
[in] | which | The Power to query. |
[out] | pPowerMicroWatt | Power in microwatts. |
NvError NvRmGpuDeviceGetTemperature | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceTemperature | which, | ||
int32_t * | pTemperatureMilliCelsius | ||
) |
Gets the temperature.
[in] | hDevice | GPU device handle. |
[in] | which | Temperature sensor to query. |
[out] | pTemperatureMilliCelsius | Temperature in millidegrees Celsius. |
NvError NvRmGpuDeviceGetVoltage | ( | NvRmGpuDevice * | hDevice, |
NvRmGpuDeviceVoltage | which, | ||
uint64_t * | pVoltageMicroVolt | ||
) |
Gets the current voltage.
[in] | hDevice | GPU device handle |
[in] | which | The voltage to query |
[out] | pVoltageMicroVolt | Voltage in microvolts. |
NvError NvRmGpuDeviceListCurrentSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceCurrent ** | pSensors, | ||
size_t * | numSensors | ||
) |
Gets a list of the available current sensors.
[in] | hDevice | GPU device handle. |
[out] | pSensors | List of available sensors (may be NULL if no sensor is available). |
[out] | numSensors | Number of sensors available. |
NvError NvRmGpuDeviceListPowerSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDevicePower ** | pSensors, | ||
size_t * | numSensors | ||
) |
Gets a list of the available power sensors.
[in] | hDevice | GPU device handle. |
[out] | pSensors | List of available sensors (may be NULL if no sensor is available). |
[out] | numSensors | Number of sensors available. |
NvError NvRmGpuDeviceListTemperatureSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceTemperature ** | pSensors, | ||
size_t * | numSensors | ||
) |
Gets the list of available temperature sensors.
[in] | hDevice | GPU device handle |
[out] | pSensors | List of available sensors (may be NULL if no sensor is available). |
[out] | numSensors | Number of sensors available. |
NvError NvRmGpuDeviceListVoltageSensors | ( | NvRmGpuDevice * | hDevice, |
const NvRmGpuDeviceVoltage ** | pSensors, | ||
size_t * | numSensors | ||
) |
Gets a list of the available voltage sensors.
[in] | hDevice | GPU device handle |
[out] | pSensors | List of available sensors (may be NULL if no sensor is available) |
[out] | numSensors | Number of sensors available |
NvError NvRmGpuDeviceOpen | ( | NvRmGpuLib * | hLib, |
int | deviceIndex, | ||
const NvRmGpuDeviceOpenAttr * | attr, | ||
NvRmGpuDevice ** | phDevice | ||
) |
Opens the GPU device.
NvError NvRmGpuDeviceThermalAlertSetLimit | ( | NvRmGpuDevice * | hDevice, |
int32_t | temperature_mC | ||
) |
Sets the thermal alert limit.
hDevice | GPU device handle. |
temperature_mC | Thermal temperature alert limit value in millidegrees Celsius. |
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.
NvError 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:
NvRmGpuLib* NvRmGpuLibOpen | ( | const NvRmGpuLibOpenAttr * | attr | ) |
Opens a new instance of the library.
There can be multiple concurrent instances.