Skip to main content

VgpuInstance

Struct VgpuInstance 

Source
pub struct VgpuInstance<'dev> { /* private fields */ }

Implementations§

Source§

impl<'dev> VgpuInstance<'dev>

Source

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).

Source

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
  • Uninitialized if the library has not been successfully initialized
  • NotFound if self does not match a valid active vGPU instance on the system
  • Unknown on any unexpected error
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • InvalidArg if self is invalid
  • NotFound if self does not match a valid active vGPU instance on the system
  • Unknown, on any unexpected error
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • InvalidArg if self is invalid
  • NotFound if self does not match a valid active vGPU instance on the system
  • Unknown, on any unexpected error
§Platform Support

For Maxwell or newer fully supported devices

Source

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

Source

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 initialized
  • NoPermission, if the user doesn’t have permission to perform this operation
  • NotSupported, 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.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
  • NotSupported, if the vGPU doesn’t support this feature or accounting mode is disabled
  • DriverNotLoaded, driver is not running on the vGPU instance
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
  • NotSupported, if the vGPU doesn’t support this feature or accounting mode is disabled
Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

pub fn encoder_sessions(&self) -> Result<Vec<EncoderSessionInfo>, NvmlError>

Retrieves information about all active encoder sessions on a vGPU Instance.

§Errors
  • Uninitialized, if the library has not been successfully initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

pub fn encoder_stats(&self) -> Result<EncoderStats, NvmlError>

Retrieves the current encoder statistics of a vGPU Instance

§Errors
  • Uninitialized, if the library has not been successfully initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotSupported, if frame rate limiter is turned off for the vGPU type
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
  • DriverNotLoaded, driver is not running on the vGPU instance
Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
  • DriverNotLoaded, driver is not running on the vGPU instance
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
  • NotSupported, on any hypervisor other than KVM
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support
Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Kepler or newer fully supported devices.

Source

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 initialized
  • NotFound, if the vGPU does not match a valid active vGPU instance on the system
§Platform Support

For Maxwell or newer fully supported devices.

Trait Implementations§

Source§

impl<'dev> Debug for VgpuInstance<'dev>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'dev> !RefUnwindSafe for VgpuInstance<'dev>

§

impl<'dev> !UnwindSafe for VgpuInstance<'dev>

§

impl<'dev> Freeze for VgpuInstance<'dev>

§

impl<'dev> Send for VgpuInstance<'dev>

§

impl<'dev> Sync for VgpuInstance<'dev>

§

impl<'dev> Unpin for VgpuInstance<'dev>

§

impl<'dev> UnsafeUnpin for VgpuInstance<'dev>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.