Skip to content

Commit 30ed0fa

Browse files
authored
adding vgpu_driver_capabilities() (#87)
Adds function to get the loaded vGPU list of capabilities
1 parent 2527a7e commit 30ed0fa

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

nvml-wrapper/src/lib.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,33 @@ impl Nvml {
973973
ExcludedDeviceInfo::try_from(info)
974974
}
975975
}
976+
977+
/**
978+
Gets the loaded vGPU list of capabilities
979+
980+
# Errors
981+
982+
* `Uninitialized`, if the library has not been successfully initialized
983+
* `Unknown`, on any unexpected error
984+
985+
# Device Support
986+
987+
Supports all devices.
988+
*/
989+
#[doc(alias = "nvmlGetVgpuDriverCapabilities")]
990+
pub fn vgpu_driver_capabilities(
991+
&self,
992+
capability: nvmlVgpuDriverCapability_t,
993+
) -> Result<u32, NvmlError> {
994+
let sym = nvml_sym(self.lib.nvmlGetVgpuDriverCapabilities.as_ref())?;
995+
996+
unsafe {
997+
let mut mask: u32 = mem::zeroed();
998+
999+
nvml_try(sym(capability, &mut mask))?;
1000+
Ok(mask)
1001+
}
1002+
}
9761003
}
9771004

9781005
/// This `Drop` implementation ignores errors! Use the `.shutdown()` method on
@@ -1239,4 +1266,10 @@ mod test {
12391266
test(3, || nvml.excluded_device_info(0))
12401267
}
12411268
}
1269+
1270+
#[test]
1271+
fn vgpu_driver_capabilities() {
1272+
let nvml = nvml();
1273+
test(3, || nvml.vgpu_driver_capabilities(1))
1274+
}
12421275
}

0 commit comments

Comments
 (0)