Skip to content
Merged
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
36 changes: 36 additions & 0 deletions nvml-wrapper/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
nvml: &'nvml Nvml,
}

unsafe impl<'nvml> Send for Device<'nvml> {}

Check warning on line 76 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

the following explicit lifetimes could be elided: 'nvml
unsafe impl<'nvml> Sync for Device<'nvml> {}

Check warning on line 77 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

the following explicit lifetimes could be elided: 'nvml

assert_impl_all!(Device: Send, Sync);

Expand Down Expand Up @@ -155,10 +155,10 @@

* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if this `Device` is invalid or the apiType is invalid (may occur if
the C lib changes dramatically?)

Check warning on line 158 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `NotSupported`, if this query is not supported by this `Device` or this `Device`
does not support the feature that is being queried (e.g. enabling/disabling auto

Check warning on line 160 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
boosted clocks is not supported by this `Device`).

Check warning on line 161 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, for which you can read the docs for
* `Unknown`, on any unexpected error
Expand Down Expand Up @@ -192,7 +192,7 @@

* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if this `Device` is invalid or the clockType is invalid (may occur
if the C lib changes dramatically?)

Check warning on line 195 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `NotSupported`, if this `Device` does not support this feature
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `Unknown`, on any unexpected error
Expand Down Expand Up @@ -432,7 +432,7 @@
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if this `Device` is invalid or `clock_type` is invalid (shouldn't occur?)
* `NotSupported`, if this `Device` or the `clock_type` on this `Device`
does not support this feature

Check warning on line 435 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `Unknown`, on any unexpected error

Expand Down Expand Up @@ -914,7 +914,7 @@
- A flag indicating if CEC attestation is present (as big-endian bytes)
- The CEC attestation report size (as big-endian bytes)
- The CEC attestation report data (up to 4096 bytes)
The returned vector contains all these components concatenated together in the order listed above.

Check warning on line 917 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
# Errors
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if device is invalid or memory is NULL
Expand Down Expand Up @@ -950,6 +950,42 @@
}
}

/**
Gets the confidential compute state for this `Device`.
# Errors
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if device is invalid or memory is NULL
* `NotSupported`, if this query is not supported by the device
*/
#[doc(alias = "nvmlDeviceGetConfComputeGpusReadyState")]
pub fn get_confidential_compute_state(&self) -> Result<bool, NvmlError> {
let sym = nvml_sym(self.nvml.lib.nvmlSystemGetConfComputeGpusReadyState.as_ref())?;

unsafe {
let mut is_accepting_work: u32 = 0;
nvml_try(sym(&mut is_accepting_work))?;
Ok(is_accepting_work == NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE)
}
}


/**
Sets the confidential compute state for this `Device`.
# Errors
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if device is invalid or memory is NULL
* `NotSupported`, if this query is not supported by the device
*/
#[doc(alias = "nvmlDeviceSetConfComputeState")]
pub fn set_confidential_compute_state(&self, is_accepting_work: bool) -> Result<(), NvmlError> {
let sym = nvml_sym(self.nvml.lib.nvmlSystemSetConfComputeGpusReadyState.as_ref())?;

unsafe {
nvml_try(sym(is_accepting_work as u32))?;
Ok(())
}
}

/**
Gets the current utilization and sampling size (sampling size in μs) for the Decoder.

Expand Down Expand Up @@ -1384,7 +1420,7 @@
* `Uninitialized`, if the library has not been successfully initialized
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `UnexpectedVariant`, if an enum variant not defined in this wrapper gets
returned in a field of an `EncoderSessionInfo` struct

Check warning on line 1423 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `Unknown`, on any unexpected error

# Device Support
Expand Down Expand Up @@ -2047,7 +2083,7 @@
* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if `error_type`, `counter_type`, or `location` is invalid (shouldn't occur?)
* `NotSupported`, if this `Device` does not support ECC error reporting for the specified
memory

Check warning on line 2086 in nvml-wrapper/src/device.rs

View workflow job for this annotation

GitHub Actions / Clippy

doc list item without indentation
* `GpuLost`, if this `Device` has fallen off the bus or is otherwise inaccessible
* `Unknown`, on any unexpected error

Expand Down
Loading