Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,23 @@ jobs:
command: clippy
args: --all-targets --all-features -- -D warnings

rustdoc:
name: Rustdoc
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -D warnings
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: doc
args: --workspace --no-deps --all-features

minimal-versions:
name: Minimal dependency versions
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ This file describes the changes / additions / fixes between wrapper releases, tr
### Documentation

* `Device::set_fan_speed()`, `Device::set_default_fan_speed()` and `Device::set_fan_control_policy()` state that they require root/admin permissions and list `NoPermission` among their errors; the NVML header lists `NoPermission` for none of the three (#64)
* The `UnexpectedVariant` entry in 41 error lists, which ended mid-sentence, now reads "check that error's docs for more info" (#151)
* `FanControlPolicy` links to `Device::fan_control_policy()`; the link pointed at a method that does not exist (#151)
* `DetachGpuState` and `PcieLinkState` no longer have a broken link to `Device::remove()` in docs built for a platform other than Linux (#151)

### Internal

* CI builds the docs with `RUSTDOCFLAGS="-D warnings"` (#151)
* The `basic_usage` example formats byte counts and PCIe transfer rates itself instead of using the `pretty-bytes` dev-dependency, which pulled in `atty` (RUSTSEC-2024-0375: unmaintained; RUSTSEC-2021-0145: potential unaligned read) (#65, #147)

### Rust Version Support
Expand Down
50 changes: 25 additions & 25 deletions nvml-wrapper/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<'nvml> Device<'nvml> {
* does not support the feature that is being queried (e.g. enabling/disabling auto
* boosted clocks is not supported by this `Device`).
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -238,7 +238,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support auto boosted clocks
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -443,7 +443,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1285,7 +1285,7 @@ impl<'nvml> Device<'nvml> {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `IncorrectBits`, if bits are found in a session's info flags that don't
match the flags in this wrapper
* `Uninitialized`, if the library has not been successfully initialized
Expand Down Expand Up @@ -1435,7 +1435,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error
*/
// Checked against local
Expand Down Expand Up @@ -1464,7 +1464,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error
*/
// Checked against local
Expand Down Expand Up @@ -1494,7 +1494,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if the platform is not Windows
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1537,7 +1537,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1769,7 +1769,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1799,7 +1799,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand All @@ -1824,7 +1824,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1854,7 +1854,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -1988,7 +1988,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid or `fan_idx` is invalid
* `NotSupported`, if this `Device` does not have a fan
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2022,7 +2022,7 @@ impl<'nvml> Device<'nvml> {
operation. The NVML header does not list this error for this function.
* `NotSupported`, if this `Device` does not have a fan
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2058,7 +2058,7 @@ impl<'nvml> Device<'nvml> {
operation. The NVML header does not list this error for this function.
* `NotSupported`, if this `Device` does not have a fan
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2087,7 +2087,7 @@ impl<'nvml> Device<'nvml> {
operation. The NVML header does not list this error for this function.
* `NotSupported`, if this `Device` does not have a fan
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2137,7 +2137,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2215,7 +2215,7 @@ impl<'nvml> Device<'nvml> {
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if this `Device` is invalid
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error
*/
// Tested as part of `.running_graphics_processes()`
Expand Down Expand Up @@ -2288,7 +2288,7 @@ impl<'nvml> Device<'nvml> {
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if this `Device` is invalid
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error
*/
#[doc(alias = "nvmlDeviceGetGraphicsRunningProcesses_v2")]
Expand Down Expand Up @@ -3150,7 +3150,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -3183,7 +3183,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Platform Support
Expand Down Expand Up @@ -3525,7 +3525,7 @@ impl<'nvml> Device<'nvml> {
* `InvalidArg`, if this `Device` is invalid
* `NotSupported`, if this `Device` doesn't support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -4162,7 +4162,7 @@ impl<'nvml> Device<'nvml> {

* `InvalidArg`, if either `Device` is invalid
* `NotSupported`, if this `Device` or the OS does not support this feature
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, an error has occurred in the underlying topology discovery

# Platform Support
Expand Down Expand Up @@ -5029,7 +5029,7 @@ impl<'nvml> Device<'nvml> {
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if the `Device` is invalid
* `NotSupported`, if this `Device` does not support this feature
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -6150,7 +6150,7 @@ impl<'nvml> Device<'nvml> {
* `Uninitialized`, if the library has not been successfully initialized
* `NotSupported`, if this `Device` doesn't support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

In addition, all of the errors returned by:
Expand Down
18 changes: 16 additions & 2 deletions nvml-wrapper/src/enum_wrappers/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,14 @@ pub enum FbcSessionType {
HwEnc,
}

/// Options to pass to [`crate::Device::remove()`].
#[cfg_attr(
target_os = "linux",
doc = "Options to pass to [`crate::Device::remove()`]."
)]
#[cfg_attr(
not(target_os = "linux"),
doc = "Options to pass to `Device::remove()`, which is only available on Linux."
)]
#[derive(EnumWrapper, Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlDetachGpuState_enum")]
Expand All @@ -618,7 +625,14 @@ pub enum DetachGpuState {
Remove,
}

/// Options to pass to [`crate::Device::remove()`].
#[cfg_attr(
target_os = "linux",
doc = "Options to pass to [`crate::Device::remove()`]."
)]
#[cfg_attr(
not(target_os = "linux"),
doc = "Options to pass to `Device::remove()`, which is only available on Linux."
)]
#[derive(EnumWrapper, Debug, Clone, Copy, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[wrap(c_enum = "nvmlPcieLinkState_enum")]
Expand Down
4 changes: 2 additions & 2 deletions nvml-wrapper/src/enums/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ pub enum DeviceArchitecture {
Ada,
/// <https://en.wikipedia.org/wiki/Hopper_(microarchitecture)>
Hopper,
/// https://en.wikipedia.org/wiki/Blackwell_(microarchitecture)
/// <https://en.wikipedia.org/wiki/Blackwell_(microarchitecture)>
Blackwell,
/// Unknown device architecture (most likely something newer).
Unknown,
Expand Down Expand Up @@ -405,7 +405,7 @@ pub enum FanControlPolicy {
Manual = NVML_FAN_POLICY_MANUAL,
}

/// Returned by [`crate::Device::get_fan_control_policy()`].
/// Returned by [`crate::Device::fan_control_policy()`].
///
/// Policy used for fan control.
// TODO: technically this is an "enum wrapper" but the type on the C side isn't
Expand Down
2 changes: 1 addition & 1 deletion nvml-wrapper/src/enums/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl TryFrom<nvmlLedState_t> for LedState {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlLedState_t) -> Result<Self, Self::Error> {
let color = value.color;
Expand Down
2 changes: 1 addition & 1 deletion nvml-wrapper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ impl Nvml {

* `InvalidArg`, if the device is invalid
* `NotSupported`, if this `Device` or the OS does not support this feature
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Platform Support
Expand Down
2 changes: 1 addition & 1 deletion nvml-wrapper/src/nv_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<'device, 'nvml: 'device> NvLink<'device, 'nvml> {
* `InvalidArg`, if the `link` or `Device` within this `NvLink` struct instance
is invalid
* `NotSupported`, if this `Device` doesn't support this feature
* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `Unknown`, on any unexpected error

# Device Support
Expand Down
10 changes: 5 additions & 5 deletions nvml-wrapper/src/struct_wrappers/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl TryFrom<nvmlBridgeChipInfo_t> for BridgeChipInfo {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlBridgeChipInfo_t) -> Result<Self, Self::Error> {
let fw_version = FirmwareVersion::from(value.fwVersion);
Expand Down Expand Up @@ -210,7 +210,7 @@ impl TryFrom<nvmlBridgeChipHierarchy_t> for BridgeChipHierarchy {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlBridgeChipHierarchy_t) -> Result<Self, Self::Error> {
let chips_hierarchy = value
Expand Down Expand Up @@ -464,7 +464,7 @@ impl TryFrom<nvmlEncoderSessionInfo_t> for EncoderSessionInfo {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlEncoderSessionInfo_t) -> Result<Self, Self::Error> {
Ok(Self {
Expand Down Expand Up @@ -564,7 +564,7 @@ impl TryFrom<nvmlFieldValue_t> for FieldValueSample {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlFieldValue_t) -> Result<Self, Self::Error> {
Ok(Self {
Expand Down Expand Up @@ -644,7 +644,7 @@ impl TryFrom<nvmlFBCSessionInfo_t> for FbcSessionInfo {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
* `IncorrectBits`, if the `sessionFlags` from the given struct do match the
wrapper definition
*/
Expand Down
2 changes: 1 addition & 1 deletion nvml-wrapper/src/struct_wrappers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl TryFrom<nvmlExcludedDeviceInfo_t> for ExcludedDeviceInfo {

# Errors

* `UnexpectedVariant`, for which you can read the docs for
* `UnexpectedVariant`, check that error's docs for more info
*/
fn try_from(value: nvmlExcludedDeviceInfo_t) -> Result<Self, Self::Error> {
unsafe {
Expand Down
Loading
Loading