NVML API Reference Guide (PDF) - vR550 (older) - Last updated March 12, 2024 - Send Feedback

4.23. 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 nvmlDeviceGetHostVgpuMode ( nvmlDevice_t device, nvmlHostVgpuMode_t* pHostVgpuMode )
nvmlReturn_t nvmlDeviceGetVgpuHeterogeneousMode ( nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode )
nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements ( nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList )
nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements ( nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList )
nvmlReturn_t nvmlDeviceGetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t* pVirtualMode )
nvmlReturn_t nvmlDeviceSetVgpuCapabilities ( nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state )
nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode ( nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode )
nvmlReturn_t nvmlDeviceSetVirtualizationMode ( nvmlDevice_t device, nvmlGpuVirtualizationMode_t virtualMode )
nvmlReturn_t nvmlVgpuInstanceGetPlacementId ( nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement )
nvmlReturn_t nvmlVgpuTypeGetFbReservation ( nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation )
nvmlReturn_t nvmlVgpuTypeGetGspHeapSize ( nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize )

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 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 nvmlDeviceGetVgpuHeterogeneousMode ( nvmlDevice_t device, nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode )
Parameters
device
The identifier of the target device
pHeterogeneousMode
Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t
Returns

Description

Get the vGPU heterogeneous mode for the device.

When in heterogeneous mode, a vGPU can concurrently host timesliced vGPUs with differing framebuffer sizes.

On successful return, the function returns pHeterogeneousMode->mode with the current vGPU heterogeneous mode. pHeterogeneousMode->version is the version number of the structure nvmlVgpuHeterogeneousMode_t, the caller should set the correct version number to retrieve the vGPU heterogeneous mode. pHeterogeneousMode->mode can either be NVML_FEATURE_ENABLED or NVML_FEATURE_DISABLED.

nvmlReturn_t nvmlDeviceGetVgpuTypeCreatablePlacements ( nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList )
Parameters
device
The identifier of the target device
vgpuTypeId
Handle to vGPU type. The vGPU type ID
pPlacementList
Pointer to the list of vGPU placement structure nvmlVgpuPlacementList_t
Returns

Description

Query the creatable vGPU placement ID of the vGPU type.

An array of creatable vGPU placement IDs for the vGPU type ID indicated by vgpuTypeId is returned in the caller-supplied buffer of pPlacementList->placementIds. Memory needed for the placementIds array should be allocated based on maximum instances of a vGPU type which can be queried via nvmlVgpuTypeGetMaxInstances(). The creatable vGPU placement IDs may differ over time, as there may be restrictions on what type of vGPU the vGPU instance is running.

The function will return NVML_ERROR_NOT_SUPPORTED if the device is not in vGPU heterogeneous mode.

nvmlReturn_t nvmlDeviceGetVgpuTypeSupportedPlacements ( nvmlDevice_t device, nvmlVgpuTypeId_t vgpuTypeId, nvmlVgpuPlacementList_t* pPlacementList )
Parameters
device
Identifier of the target device
vgpuTypeId
Handle to vGPU type. The vGPU type ID
pPlacementList
Pointer to the vGPU placement structure nvmlVgpuPlacementList_t
Returns

Description

Query the supported vGPU placement ID of the vGPU type.

An array of supported vGPU placement IDs for the vGPU type ID indicated by vgpuTypeId is returned in the caller-supplied buffer of pPlacementList->placementIds. Memory needed for the placementIds array should be allocated based on maximum instances of a vGPU type which can be queried via nvmlVgpuTypeGetMaxInstances().

This function will return supported placement IDs even if GPU is not in vGPU heterogeneous mode.

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 nvmlDeviceSetVgpuCapabilities ( nvmlDevice_t device, nvmlDeviceVgpuCapability_t capability, nvmlEnableState_t state )
Parameters
device
The identifier of the target device
capability
Specifies the nvmlDeviceVgpuCapability_t to be set
state
The target capability mode
Returns

Description

Set the desirable vGPU capability of a device

Refer to the nvmlDeviceVgpuCapability_t structure for the specific capabilities that can be set. See nvmlEnableState_t for available state.

nvmlReturn_t nvmlDeviceSetVgpuHeterogeneousMode ( nvmlDevice_t device, const nvmlVgpuHeterogeneousMode_t* pHeterogeneousMode )
Parameters
device
Identifier of the target device
pHeterogeneousMode
Pointer to the caller-provided structure of nvmlVgpuHeterogeneousMode_t
Returns

Description

Enable or disable vGPU heterogeneous mode for the device.

When in heterogeneous mode, a vGPU can concurrently host timesliced vGPUs with differing framebuffer sizes.

API would return an appropriate error code upon unsuccessful activation. For example, the heterogeneous mode set will fail with error NVML_ERROR_IN_USE if any vGPU instance is active on the device. The caller of this API is expected to shutdown the vGPU VMs and retry setting the mode. On successful return, the function updates the vGPU heterogeneous mode with the user provided pHeterogeneousMode->mode. pHeterogeneousMode->version is the version number of the structure nvmlVgpuHeterogeneousMode_t, the caller should set the correct version number to set the vGPU heterogeneous mode.

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.

nvmlReturn_t nvmlVgpuInstanceGetPlacementId ( nvmlVgpuInstance_t vgpuInstance, nvmlVgpuPlacementId_t* pPlacement )
Parameters
vgpuInstance
Identifier of the target vGPU instance
pPlacement
Pointer to vGPU placement ID structure nvmlVgpuPlacementId_t
Returns

Description

Query the placement ID of active vGPU instance.

When in vGPU heterogeneous mode, this function returns a valid placement ID as pPlacement->placementId else NVML_INVALID_VGPU_PLACEMENT_ID is returned. pPlacement->version is the version number of the structure nvmlVgpuPlacementId_t, the caller should set the correct version number to get placement id of the vGPU instance vgpuInstance.

nvmlReturn_t nvmlVgpuTypeGetFbReservation ( nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* fbReservation )
Parameters
vgpuTypeId
Handle to vGPU type
fbReservation
Reference to return the framebuffer reservation
Returns

Description

Retrieve the static framebuffer reservation of the vGPU type in bytes

nvmlReturn_t nvmlVgpuTypeGetGspHeapSize ( nvmlVgpuTypeId_t vgpuTypeId, unsigned long long* gspHeapSize )
Parameters
vgpuTypeId
Handle to vGPU type
gspHeapSize
Reference to return the GSP heap size value
Returns

Description

Retrieve the static GSP heap size of the vGPU type in bytes


NVML API Reference Guide (PDF) - vR550 (older) - Last updated March 12, 2024 - Send Feedback