Skip to main content

OwnedGpuInstance

Struct OwnedGpuInstance 

Source
pub struct OwnedGpuInstance(/* private fields */);

Implementations§

Source§

impl OwnedGpuInstance

Source

pub const unsafe fn from_raw(handle: nvmlGpuInstance_t) -> Self

Source

pub const fn as_gpu_instance(&self) -> &GpuInstance

Source

pub fn into_inner(self) -> GpuInstance

Methods from Deref<Target = GpuInstance>§

Source

pub fn as_raw(&self) -> nvmlGpuInstance_t

Source

pub fn is_null(&self) -> bool

Source

pub fn info(&self) -> Result<GpuInstanceInfo>

Returns GPU instance information.

For Ampere or newer fully supported devices. Supported on Linux only.

§Errors

Returns an error if the handle or output arguments are rejected by NVML, if the current process does not have permission to query the instance, or if NVML has not been initialized.

Source

pub fn parent_device(&self) -> Result<Device>

Source

pub fn id(&self) -> Result<u32>

Source

pub fn profile_id(&self) -> Result<u32>

Source

pub fn compute_instance_profile_info( &self, profile: u32, engine_profile: ComputeInstanceEngineProfile, ) -> Result<ComputeInstanceProfileInfo>

Versioned wrapper that requests compute-instance profile information using the latest supported NVML output layout.

This wrapper sets the version field on the output structure before calling NVML.

For Ampere or newer fully supported devices. Supported on Linux only.

§Errors

Returns an error if the GPU instance, profile, engine profile, or structure version is invalid, if the profile is not supported, if the current process does not have permission to perform the operation, or if NVML has not been initialized.

Source

pub fn compute_instance_remaining_capacity( &self, profile_id: u32, ) -> Result<u32>

Returns compute instance profile capacity.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

§Errors

Returns an error if the GPU instance or profile_id is invalid, if the profile is not supported, if the current process does not have permission to perform the operation, or if NVML has not been initialized.

Source

pub fn compute_instance_possible_placements( &self, profile_id: u32, ) -> Result<Vec<ComputeInstancePlacement>>

Returns compute instance placements.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

A placement represents the location of a compute instance within a GPU instance. Returns all possible placements for the given profile. A created compute instance occupies compute slices described by its placement. Creating a compute instance fails if its placement overlaps already occupied compute slices.

§Errors

Returns an error if the GPU instance or profile_id is invalid, if MIG mode is not enabled or the profile is not supported, if the current process does not have permission to perform the operation, or if NVML has not been initialized.

Source

pub fn compute_instance_by_id(&self, id: u32) -> Result<ComputeInstance>

Returns compute instance for the given instance ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

§Errors

Returns an error if the GPU instance or ID is invalid, if the compute instance is not found, if MIG mode is not enabled, if the current process lacks permission, or if NVML has not been initialized.

Source

pub fn create_compute_instance( &self, profile_id: u32, ) -> Result<OwnedComputeInstance>

Creates a compute instance.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

If the parent device is unbound or reset, or if the parent GPU instance or compute instance is destroyed, the compute instance handle becomes invalid. The compute instance must be recreated to acquire a valid handle.

§Errors

Returns an error if the requested compute instance cannot be created, if the GPU instance or profile_id is invalid, if the profile is not supported, if the current process lacks permission, or if NVML has not been initialized.

Source

pub fn create_compute_instance_with_placement( &self, profile_id: u32, placement: ComputeInstancePlacement, ) -> Result<OwnedComputeInstance>

Creates a compute instance with the specified placement.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

If the parent device is unbound or reset, or if the parent GPU instance or compute instance is destroyed, the compute instance handle becomes invalid. The compute instance must be recreated to acquire a valid handle.

§Errors

Returns an error if the requested compute instance cannot be created, if the GPU instance, profile_id, or placement is invalid, if the profile is not supported, if the current process lacks permission, or if NVML has not been initialized.

Source

pub fn compute_instances(&self, profile_id: u32) -> Result<Vec<ComputeInstance>>

Returns compute instances for the given profile ID.

For Ampere or newer fully supported devices. Supported on Linux only. Requires privileged access.

§Errors

Returns an error if the GPU instance or profile_id is invalid, if the profile is not supported, if the current process lacks permission, or if NVML has not been initialized.

Source

pub fn creatable_vgpus(&self) -> Result<Vec<VgpuTypeId>>

Query the currently creatable vGPU types on a specific GPU instance.

Returns the vGPU types that can currently be created for this GPU instance. This wrapper performs the NVML size query internally and returns the results as a Vec.

The creatable vGPU types may differ over time, as there may be restrictions on what type of vGPUs can concurrently run on the device.

§Errors

Returns an error if NVML rejects the versioned request, if the intermediate size query reports a larger buffer requirement than expected, if this GPU instance or query arguments are invalid, if the host or GPU does not support vGPU creation, if NVML has not been initialized, or if NVML reports an unexpected failure.

Source

pub fn active_vgpus(&self) -> Result<Vec<VgpuInstance>>

Returns the active vGPU instances within a GPU instance.

This wrapper performs the NVML size query internally and returns the active vGPU instances as a Vec.

§Errors

Returns an error if NVML rejects the versioned request, if the intermediate size query reports a larger buffer requirement than expected, if this GPU instance or query arguments are invalid, if the host or GPU does not support vGPU queries, if NVML has not been initialized, or if NVML reports an unexpected failure.

Source

pub fn vgpu_heterogeneous_mode(&self) -> Result<EnableState>

Returns the vGPU heterogeneous mode for the GPU instance.

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

On success, returns the current vGPU heterogeneous mode as EnableState::Enabled or EnableState::Disabled.

For Blackwell &tm GB20x; or newer fully supported devices.

§Errors

Returns an error if NVML rejects the versioned request, if this GPU instance or query arguments are invalid, if the host, GPU, or MIG mode does not support the query, if NVML has not been initialized, or if NVML reports an unexpected failure.

Source

pub fn vgpu_type_creatable_placements( &self, vgpu_type_id: VgpuTypeId, ) -> Result<Vec<VgpuPlacementId>>

Query the creatable vGPU placement ID of the vGPU type within a GPU instance.

For Blackwell &tm GB20x; or newer fully supported devices.

The returned placement IDs correspond to the given vgpu_type_id. This wrapper performs the NVML size query internally and returns the placement IDs as a Vec. The creatable vGPU placement IDs may differ over time, as there may be restrictions on what type of vGPU the vGPU instance is running.

§Errors

Returns an error if NVML rejects the versioned request, if the intermediate size query reports a larger buffer requirement than expected, if this GPU instance or query arguments are invalid, if the host or GPU does not support the query or vGPU heterogeneous mode is disabled, if NVML has not been initialized, or if NVML reports an unexpected failure.

Source

pub fn vgpu_scheduler_state( &self, engine: VgpuSchedulerEngine, ) -> Result<VgpuSchedulerState>

Returns the vGPU scheduler state for the given GPU instance. The returned scheduler-state details are not relevant when the scheduler policy is best effort.

For Blackwell &tm GB20x; or newer fully supported devices.

§Errors

Returns an error if this GPU instance or query arguments are invalid, if the host or GPU does not support vGPU scheduler queries, if NVML has not been initialized, or if NVML reports an unexpected failure.

Source

pub fn vgpu_scheduler_log( &self, engine: VgpuSchedulerEngine, ) -> Result<VgpuSchedulerLog>

Returns the vGPU scheduler logs for this GPU instance. The number of returned elements never exceeds NVML_SCHEDULER_SW_MAX_LOG_ENTRIES.

To get the entire logs, call this method at least 5 times a second.

For Blackwell &tm GB20x; or newer fully supported devices.

§Errors

Returns an error if this GPU instance or query arguments are invalid, if the host or GPU does not support vGPU scheduler queries, if NVML has not been initialized, or if NVML reports an unexpected failure.

Trait Implementations§

Source§

impl Debug for OwnedGpuInstance

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for OwnedGpuInstance

Source§

type Target = GpuInstance

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl Drop for OwnedGpuInstance

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

type Error = Infallible

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.