pub struct OwnedGpuInstance(/* private fields */);Implementations§
Source§impl OwnedGpuInstance
impl OwnedGpuInstance
pub const unsafe fn from_raw(handle: nvmlGpuInstance_t) -> Self
pub const fn as_gpu_instance(&self) -> &GpuInstance
pub fn into_inner(self) -> GpuInstance
Methods from Deref<Target = GpuInstance>§
pub fn as_raw(&self) -> nvmlGpuInstance_t
pub fn is_null(&self) -> bool
Sourcepub fn info(&self) -> Result<GpuInstanceInfo>
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.
pub fn parent_device(&self) -> Result<Device>
pub fn id(&self) -> Result<u32>
pub fn profile_id(&self) -> Result<u32>
Sourcepub fn compute_instance_profile_info(
&self,
profile: u32,
engine_profile: ComputeInstanceEngineProfile,
) -> Result<ComputeInstanceProfileInfo>
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.
Sourcepub fn compute_instance_remaining_capacity(
&self,
profile_id: u32,
) -> Result<u32>
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.
Sourcepub fn compute_instance_possible_placements(
&self,
profile_id: u32,
) -> Result<Vec<ComputeInstancePlacement>>
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.
Sourcepub fn compute_instance_by_id(&self, id: u32) -> Result<ComputeInstance>
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.
Sourcepub fn create_compute_instance(
&self,
profile_id: u32,
) -> Result<OwnedComputeInstance>
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.
Sourcepub fn create_compute_instance_with_placement(
&self,
profile_id: u32,
placement: ComputeInstancePlacement,
) -> Result<OwnedComputeInstance>
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.
Sourcepub fn compute_instances(&self, profile_id: u32) -> Result<Vec<ComputeInstance>>
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.
Sourcepub fn creatable_vgpus(&self) -> Result<Vec<VgpuTypeId>>
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.
Sourcepub fn active_vgpus(&self) -> Result<Vec<VgpuInstance>>
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.
Sourcepub fn vgpu_heterogeneous_mode(&self) -> Result<EnableState>
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.
Sourcepub fn vgpu_type_creatable_placements(
&self,
vgpu_type_id: VgpuTypeId,
) -> Result<Vec<VgpuPlacementId>>
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.
Sourcepub fn vgpu_scheduler_state(
&self,
engine: VgpuSchedulerEngine,
) -> Result<VgpuSchedulerState>
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.
Sourcepub fn vgpu_scheduler_log(
&self,
engine: VgpuSchedulerEngine,
) -> Result<VgpuSchedulerLog>
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.