pub struct VgpuInstance<'dev> { /* private fields */ }Implementations§
Source§impl<'dev> VgpuInstance<'dev>
impl<'dev> VgpuInstance<'dev>
Sourcepub fn new(instance: nvmlVgpuInstance_t, device: &'dev Device<'dev>) -> Self
pub fn new(instance: nvmlVgpuInstance_t, device: &'dev Device<'dev>) -> Self
Create a new vGPU instance wrapper from a raw vGPU instance ID.
You probably don’t need to use this yourself, but rather through
Device::active_vgpus (Linux only).
Sourcepub fn vm_id(&self) -> Result<VmId, NvmlError>
pub fn vm_id(&self) -> Result<VmId, NvmlError>
Retrieve the VM ID associated with a vGPU instance.
The VM ID is returned as a string, not exceeding 80 characters in length (including the NUL terminator). See nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE.
The format of the VM ID varies by platform, and is indicated by the type identifier returned in vmIdType.
§Errors
Uninitializedif the library has not been successfully initializedNotFoundif self does not match a valid active vGPU instance on the systemUnknownon any unexpected error
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn fb_usage(&self) -> Result<u64, NvmlError>
pub fn fb_usage(&self) -> Result<u64, NvmlError>
Retrieve the framebuffer usage in bytes.
Framebuffer usage is the amount of vGPU framebuffer memory that is currently in use by the VM
§Errors
Uninitialized, if the library has not been successfully initializedInvalidArgif self is invalidNotFoundif self does not match a valid active vGPU instance on the systemUnknown, on any unexpected error
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn instance_type(&self) -> Result<VgpuType<'dev>, NvmlError>
pub fn instance_type(&self) -> Result<VgpuType<'dev>, NvmlError>
Retrieve the vGPU type of a vGPU instance
Returns the vGPU type ID of vgpu assigned to the vGPU instance.
§Errors
Uninitialized, if the library has not been successfully initializedInvalidArgif self is invalidNotFoundif self does not match a valid active vGPU instance on the systemUnknown, on any unexpected error
§Platform Support
For Maxwell or newer fully supported devices
Sourcepub fn accounting_pids(&self) -> Result<Vec<u32>, NvmlError>
pub fn accounting_pids(&self) -> Result<Vec<u32>, NvmlError>
Get the list of process ids running on this vGPU instance for stats purpose
see crate::device::Device::vgpu_accounting_pids for details
Sourcepub fn clear_accounting_pids(&self) -> Result<(), NvmlError>
pub fn clear_accounting_pids(&self) -> Result<(), NvmlError>
Clears accounting information of the vGPU instance that have already terminated.
§Errors
Uninitialized, if the library has not been successfully initializedNoPermission, if the user doesn’t have permission to perform this operationNotSupported, if the vGPU doesn’t support this feature or accounting mode is disabled
§Platform Support
For Maxwell or newer fully supported devices. Requires root/admin permissions.
Sourcepub fn accounting_mode(&self) -> Result<bool, NvmlError>
pub fn accounting_mode(&self) -> Result<bool, NvmlError>
Queries the state of per process accounting mode on vGPU.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the systemNotSupported, if the vGPU doesn’t support this feature or accounting mode is disabledDriverNotLoaded, driver is not running on the vGPU instance
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn ecc_mode(&self) -> Result<bool, NvmlError>
pub fn ecc_mode(&self) -> Result<bool, NvmlError>
Retrieve the current ECC mode of vGPU instance.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the systemNotSupported, if the vGPU doesn’t support this feature or accounting mode is disabled
Sourcepub fn encoder_capacity(&self) -> Result<u32, NvmlError>
pub fn encoder_capacity(&self) -> Result<u32, NvmlError>
Retrieve the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn encoder_sessions(&self) -> Result<Vec<EncoderSessionInfo>, NvmlError>
pub fn encoder_sessions(&self) -> Result<Vec<EncoderSessionInfo>, NvmlError>
Sourcepub fn encoder_stats(&self) -> Result<EncoderStats, NvmlError>
pub fn encoder_stats(&self) -> Result<EncoderStats, NvmlError>
Sourcepub fn fbc_sessions(&self) -> Result<Vec<FbcSessionInfo>, NvmlError>
pub fn fbc_sessions(&self) -> Result<Vec<FbcSessionInfo>, NvmlError>
Retrieves information about active frame buffer capture sessions on a vGPU Instance.
hResolution, vResolution, averageFPS and averageLatency data for a FBC session returned in sessionInfo may be zero if there are no new frames captured since the session started.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn fbc_stats(&self) -> Result<FbcStats, NvmlError>
pub fn fbc_stats(&self) -> Result<FbcStats, NvmlError>
Retrieves the active frame buffer capture sessions statistics of a vGPU Instance
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn frame_rate_limit(&self) -> Result<u32, NvmlError>
pub fn frame_rate_limit(&self) -> Result<u32, NvmlError>
Retrieve the frame rate limit set for the vGPU instance.
Returns the value of the frame rate limit set for the vGPU instance
§Errors
Uninitialized, if the library has not been successfully initializedNotSupported, if frame rate limiter is turned off for the vGPU typeNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn gpu_instance_id(&self) -> Result<u32, NvmlError>
pub fn gpu_instance_id(&self) -> Result<u32, NvmlError>
Retrieve the GPU Instance ID for the given vGPU Instance. The API will return a valid GPU Instance ID for MIG backed vGPU Instance, else INVALID_GPU_INSTANCE_ID is returned.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn gpu_pci_id(&self) -> Result<String, NvmlError>
pub fn gpu_pci_id(&self) -> Result<String, NvmlError>
Retrieves the PCI Id of the given vGPU Instance i.e. the PCI Id of the GPU as seen inside the VM.
The vGPU PCI id is returned as “00000000:00:00.0” if NVIDIA driver is not installed on the vGPU instance.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the systemDriverNotLoaded, driver is not running on the vGPU instance
Sourcepub fn license_info_v2(&self) -> Result<VgpuLicenseInfo, NvmlError>
pub fn license_info_v2(&self) -> Result<VgpuLicenseInfo, NvmlError>
Query the license information of the vGPU instance.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the systemDriverNotLoaded, driver is not running on the vGPU instance
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn mdev_uuid(&self) -> Result<String, NvmlError>
pub fn mdev_uuid(&self) -> Result<String, NvmlError>
Retrieve the MDEV UUID of a vGPU instance.
The MDEV UUID is a globally unique identifier of the mdev device assigned to the VM, and is returned as a 5-part hexadecimal string, not exceeding 80 characters in length (including the NULL terminator). MDEV UUID is displayed only on KVM platform. See nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the systemNotSupported, on any hypervisor other than KVM
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn metadata(&self) -> Result<VgpuMetadata, NvmlError>
pub fn metadata(&self) -> Result<VgpuMetadata, NvmlError>
Returns vGPU metadata structure for a running vGPU. The structure contains information about the vGPU and its associated VM such as the currently installed NVIDIA guest driver version, together with host driver version and an opaque data section containing internal state.
May be called at any time for a vGPU instance. Some fields in the returned structure are dependent on information obtained from the guest VM, which may not yet have reached a state where that information is available.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
Sourcepub fn placement_id(&self) -> Result<VgpuPlacementId, NvmlError>
pub fn placement_id(&self) -> Result<VgpuPlacementId, NvmlError>
Query the placement ID of active vGPU instance.
When in vGPU heterogeneous mode, this function returns a valid placement ID as
VgpuPlacementId::id, VgpuPlacementId::version is the version number
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
Sourcepub fn runtime_state_size(&self) -> Result<VgpuRuntimeState, NvmlError>
pub fn runtime_state_size(&self) -> Result<VgpuRuntimeState, NvmlError>
Retrieve the currently used runtime state size of the vGPU instance
This size represents the maximum in-memory data size utilized by a vGPU instance during standard operation. This measurement is exclusive of frame buffer (FB) data size assigned to the vGPU instance.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Maxwell or newer fully supported devices.
Sourcepub fn uuid(&self) -> Result<String, NvmlError>
pub fn uuid(&self) -> Result<String, NvmlError>
Retrieve the UUID of a vGPU instance.
The UUID is a globally unique identifier associated with the vGPU, and is returned as a 5-part hexadecimal string
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn driver_version(&self) -> Result<String, NvmlError>
pub fn driver_version(&self) -> Result<String, NvmlError>
Retrieve the NVIDIA driver version installed in the VM associated with a vGPU.
The version is returned as an alphanumeric string in the caller-supplied buffer version. This may be called at any time for a vGPU instance.
The guest VM driver version is returned as “Not Available” if no NVIDIA driver is installed in the VM, or the VM has not yet booted to the point where the NVIDIA driver is loaded and initialized.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Kepler or newer fully supported devices.
Sourcepub fn set_encoder_capacity(&self, capacity: u32) -> Result<(), NvmlError>
pub fn set_encoder_capacity(&self, capacity: u32) -> Result<(), NvmlError>
Set the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100.
§Errors
Uninitialized, if the library has not been successfully initializedNotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
For Maxwell or newer fully supported devices.