File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed
Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -1900,6 +1900,35 @@ impl<'nvml> Device<'nvml> {
19001900 }
19011901 }
19021902
1903+ /**
1904+ Sets fan control policy.
1905+
1906+ You can determine valid fan indices using [`Self::num_fans()`].
1907+
1908+ # Errors
1909+
1910+ * `Uninitialized`, if the library has not been successfully initialized
1911+ * `InvalidArg`, if this `Device` is invalid or `fan_idx` is invalid
1912+ * `NotSupported`, if this `Device` does not have a fan
1913+ * `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
1914+ * `UnexpectedVariant`, for which you can read the docs for
1915+ * `Unknown`, on any unexpected error
1916+
1917+ # Device Support
1918+
1919+ Supports Maxwell or newer fully supported discrete devices with fans.
1920+ */
1921+ #[ doc( alias = "nvmlDeviceSetFanControlPolicy" ) ]
1922+ pub fn set_fan_control_policy (
1923+ & mut self ,
1924+ fan_idx : u32 ,
1925+ policy : FanControlPolicy ,
1926+ ) -> Result < ( ) , NvmlError > {
1927+ let sym = nvml_sym ( self . nvml . lib . nvmlDeviceSetFanControlPolicy . as_ref ( ) ) ?;
1928+
1929+ unsafe { nvml_try ( sym ( self . device , fan_idx, policy. as_c ( ) ) ) }
1930+ }
1931+
19031932 /**
19041933 Sets the speed of a specified fan.
19051934
Original file line number Diff line number Diff line change @@ -376,7 +376,7 @@ impl TryFrom<nvmlFanControlPolicy_t> for FanControlPolicy {
376376 fn try_from ( value : nvmlFanControlPolicy_t ) -> Result < Self , Self :: Error > {
377377 match value {
378378 NVML_FAN_POLICY_TEMPERATURE_CONTINOUS_SW => Ok ( Self :: TemperatureContinousSw ) ,
379- NVML_FAN_POLICY_MANUAL => Ok ( Self :: TemperatureContinousSw ) ,
379+ NVML_FAN_POLICY_MANUAL => Ok ( Self :: Manual ) ,
380380 _ => Err ( NvmlError :: UnexpectedVariant ( value) ) ,
381381 }
382382 }
Original file line number Diff line number Diff line change @@ -90,7 +90,6 @@ nvmlDevicePowerSmoothingSetState
9090nvmlDevicePowerSmoothingUpdatePresetProfileParam
9191nvmlDeviceSetConfComputeUnprotectedMemSize
9292nvmlDeviceSetDramEncryptionMode
93- nvmlDeviceSetFanControlPolicy
9493nvmlDeviceSetMigMode
9594nvmlDeviceSetNvlinkBwMode
9695nvmlDeviceSetNvLinkDeviceLowPowerThreshold
You can’t perform that action at this time.
0 commit comments