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
- NVML_SUCCESS if licensable features are successfully retrieved
- NVML_ERROR_INVALID_ARGUMENT if pGridLicensableFeatures is NULL
- NVML_ERROR_UNKNOWN on any unexpected error
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
- NVML_SUCCESS if GSP firmware mode is sucessfully retrieved
- NVML_ERROR_INVALID_ARGUMENT if device is invalid or any of isEnabled or defaultMode is NULL
- NVML_ERROR_UNKNOWN on any unexpected error
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
- NVML_SUCCESS if GSP firmware version is sucessfully retrieved
- NVML_ERROR_INVALID_ARGUMENT if device is invalid or GSP version pointer is NULL
- NVML_ERROR_NOT_SUPPORTED if GSP firmware is not enabled for GPU
- NVML_ERROR_UNKNOWN on any unexpected error
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
- NVML_SUCCESS if device's vGPU mode has been successfully retrieved
- NVML_ERROR_INVALID_ARGUMENT if device handle is 0 or pVgpuMode is NULL
- NVML_ERROR_NOT_SUPPORTED if device doesn't support this feature.
- NVML_ERROR_UNKNOWN if any unexpected error occurred
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
- NVML_SUCCESS if utilization has been populated
- NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
- NVML_ERROR_INVALID_ARGUMENT if device is invalid, utilization is NULL, or samplingPeriodUs is NULL
- NVML_ERROR_NOT_SUPPORTED if the device does not support this feature
- NVML_ERROR_NOT_FOUND if sample entries are not found
- NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
- NVML_ERROR_UNKNOWN on any unexpected error
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
- NVML_SUCCESS if pVirtualMode is fetched
- NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
- NVML_ERROR_INVALID_ARGUMENT if device is invalid or pVirtualMode is NULL
- NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
- NVML_ERROR_UNKNOWN on any unexpected error
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
- NVML_SUCCESS if pVirtualMode is set
- NVML_ERROR_UNINITIALIZED if the library has not been successfully initialized
- NVML_ERROR_INVALID_ARGUMENT if device is invalid or pVirtualMode is NULL
- NVML_ERROR_GPU_IS_LOST if the target GPU has fallen off the bus or is otherwise inaccessible
- NVML_ERROR_NOT_SUPPORTED if setting of virtualization mode is not supported.
- NVML_ERROR_NO_PERMISSION if setting of virtualization mode is not allowed for this client.
Description
This method is used to set the virtualization mode corresponding to the GPU.
For Kepler or newer fully supported devices.