NVML API Reference Guide (PDF) - vR515 (older) - Last updated May 4, 2022 - Send Feedback

2.22. vGPU APIs

This chapter describes operations that are associated with NVIDIA vGPU Software products.

Functions

nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4 ( nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures )
nvmlReturn_t nvmlDeviceGetGspFirmwareMode ( nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode )
nvmlReturn_t nvmlDeviceGetGspFirmwareVersion ( nvmlDevice_t device, char* version )
nvmlReturn_t nvmlDeviceGetHostVgpuMode ( nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode )
nvmlReturn_t nvmlDeviceGetProcessUtilization ( nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp )
nvmlReturn_t nvmlDeviceGetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode )
nvmlReturn_t nvmlDeviceSetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode )

Functions

nvmlReturn_t nvmlDeviceGetGridLicensableFeatures_v4 ( nvmlDevice_t device, nvmlGridLicensableFeatures_t* pGridLicensableFeatures )
Parameters
device
Identifier of the target device
pGridLicensableFeatures
Pointer to structure in which vGPU software licensable features are returned
Returns

Description

Retrieve the vGPU Software licensable features.

Identifies whether the system supports vGPU Software Licensing. If it does, return the list of licensable feature(s) and their current license status.

nvmlReturn_t nvmlDeviceGetGspFirmwareMode ( nvmlDevice_t device, unsigned int* isEnabled, unsigned int* defaultMode )
Parameters
device
Device handle
isEnabled
Pointer to specify if GSP firmware is enabled
defaultMode
Pointer to specify if GSP firmware is supported by default on device
Returns

Description

Retrieve GSP firmware mode.

The caller passes in integer pointers. GSP firmware enablement and default mode information is returned with corresponding parameters. The return value in isEnabled and defaultMode should be treated as boolean.

nvmlReturn_t nvmlDeviceGetGspFirmwareVersion ( nvmlDevice_t device, char* version )
Parameters
device
Device handle
version
The retrieved GSP firmware version
Returns

Description

Retrieve GSP firmware version.

The caller passes in buffer via version and corresponding GSP firmware numbered version is returned with the same parameter in string format.

nvmlReturn_t nvmlDeviceGetHostVgpuMode ( nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode )
Parameters
device
The identifier of the target device
pHostVgpuMode
Reference in which to return the current vGPU mode
Returns

Description

Queries if SR-IOV host operation is supported on a vGPU supported device.

Checks whether SR-IOV host capability is supported by the device and the driver, and indicates device is in SR-IOV mode if both of these conditions are true.

nvmlReturn_t nvmlDeviceGetProcessUtilization ( nvmlDevice_t device, nvmlProcessUtilizationSample_t* utilization, unsigned int* processSamplesCount, unsigned long long lastSeenTimeStamp )
Parameters
device
The identifier of the target device
utilization
Pointer to caller-supplied buffer in which guest process utilization samples are returned
processSamplesCount
Pointer to caller-supplied array size, and returns number of processes running
lastSeenTimeStamp
Return only samples with timestamp greater than lastSeenTimeStamp.
Returns

Description

Retrieves the current utilization and process ID

For Maxwell or newer fully supported devices.

Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, and video decoder for processes running. Utilization values are returned as an array of utilization sample structures in the caller-supplied buffer pointed at by utilization. One utilization sample structure is returned per process running, that had some non-zero utilization during the last sample period. It includes the CPU timestamp at which the samples were recorded. Individual utilization values are returned as "unsigned int" values.

To read utilization values, first determine the size of buffer required to hold the samples by invoking the function with utilization set to NULL. The caller should allocate a buffer of size processSamplesCount * sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the allocated buffer passed in utilization, and processSamplesCount set to the number of entries the buffer is sized for.

On successful return, the function updates processSamplesCount with the number of process utilization sample structures that were actually written. This may differ from a previously read value as instances are created or destroyed.

lastSeenTimeStamp represents the CPU timestamp in microseconds at which utilization samples were last read. Set it to 0 to read utilization based on all the samples maintained by the driver's internal sample buffer. Set lastSeenTimeStamp to a timeStamp retrieved from a previous query to read utilization since the previous query.

Note:

On MIG-enabled GPUs, querying process utilization is not currently supported.

nvmlReturn_t nvmlDeviceGetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode )
Parameters
device
Identifier of the target device
pVirtualMode
Reference to virtualization mode. One of NVML_GPU_VIRTUALIZATION_?
Returns

Description

This method is used to get the virtualization mode corresponding to the GPU.

For Kepler or newer fully supported devices.

nvmlReturn_t nvmlDeviceSetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode )
Parameters
device
Identifier of the target device
virtualMode
virtualization mode. One of NVML_GPU_VIRTUALIZATION_?
Returns

Description

This method is used to set the virtualization mode corresponding to the GPU.

For Kepler or newer fully supported devices.


NVML API Reference Guide (PDF) - vR515 (older) - Last updated May 4, 2022 - Send Feedback