Struct nvml_wrapper::nv_link::NvLink
source · pub struct NvLink<'device, 'nvml: 'device> { /* private fields */ }
Expand description
Struct that represents a Device
’s NvLink.
Obtain this via Device.link_wrapper_for()
.
Lifetimes are used to enforce that each NvLink
instance cannot be used after
the Device
instance it was obtained from is dropped:
use nvml_wrapper::Nvml;
let nvml = Nvml::init()?;
let device = nvml.device_by_index(0)?;
let link = device.link_wrapper_for(0);
drop(device);
// This won't compile
link.is_active()?;
Note that I cannot test any NvLink
methods myself as I do not have access to
such a link setup. Test the functionality in this module before you use it.
Implementations§
source§impl<'device, 'nvml: 'device> NvLink<'device, 'nvml>
impl<'device, 'nvml: 'device> NvLink<'device, 'nvml>
sourcepub fn is_active(&self) -> Result<bool, NvmlError>
pub fn is_active(&self) -> Result<bool, NvmlError>
Gets whether or not this Device
’s NvLink is active.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnexpectedVariant
, for which you can read the docs forUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn version(&self) -> Result<u32, NvmlError>
pub fn version(&self) -> Result<u32, NvmlError>
Gets the NvLink version of this Device
/ NvLink
.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn has_capability(&self, cap_type: Capability) -> Result<bool, NvmlError>
pub fn has_capability(&self, cap_type: Capability) -> Result<bool, NvmlError>
Gets whether or not this Device
/ NvLink
has a Capability
.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn remote_pci_info(&self) -> Result<PciInfo, NvmlError>
pub fn remote_pci_info(&self) -> Result<PciInfo, NvmlError>
Gets the PCI information for this NvLink
’s remote node.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn error_counter(&self, counter: ErrorCounter) -> Result<u64, NvmlError>
pub fn error_counter(&self, counter: ErrorCounter) -> Result<u64, NvmlError>
Gets the specified ErrorCounter
value.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn reset_error_counters(&mut self) -> Result<(), NvmlError>
pub fn reset_error_counters(&mut self) -> Result<(), NvmlError>
Resets all error counters to zero.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn set_utilization_control(
&mut self,
counter: Counter,
settings: UtilizationControl,
reset_counters: bool
) -> Result<(), NvmlError>
pub fn set_utilization_control( &mut self, counter: Counter, settings: UtilizationControl, reset_counters: bool ) -> Result<(), NvmlError>
Sets the NvLink utilization counter control information for the specified
Counter
.
The counters will be reset if reset_counters
is true.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn utilization_control(
&self,
counter: Counter
) -> Result<UtilizationControl, NvmlError>
pub fn utilization_control( &self, counter: Counter ) -> Result<UtilizationControl, NvmlError>
Gets the NvLink utilization counter control information for the specified
Counter
.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn utilization_counter(
&self,
counter: Counter
) -> Result<UtilizationCounter, NvmlError>
pub fn utilization_counter( &self, counter: Counter ) -> Result<UtilizationCounter, NvmlError>
Gets the NvLink utilization counter for the given counter
.
The retrieved values are based on the current controls set for the specified
Counter
. You should use .set_utilization_control()
before calling this
as the utilization counters have no default state.
I do not attempt to verify, statically or at runtime, that you have controls
set for counter
prior to calling this method on counter
. NVIDIA says that
it is “In general[,] good practice”, which does not sound to me as if it
is in any way unsafe to make this call without having set controls. I don’t
believe it’s worth the overhead of using a Mutex
’d bool to track whether
or not you have set controls, and it’s certainly not worth the effort to
statically verify it via the type system.
That being said, I don’t know what exactly would happen, either, and I have no means of finding out. If you do and discover that garbage values are returned, for instance, I would love to hear about it; that would likely cause this decision to be reconsidered.
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn freeze_utilization_counter(
&mut self,
counter: Counter
) -> Result<(), NvmlError>
pub fn freeze_utilization_counter( &mut self, counter: Counter ) -> Result<(), NvmlError>
Freezes the specified NvLink utilization Counter
.
Both the receive and send counters will be frozen (if I’m reading NVIDIA’s meaning correctly).
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn unfreeze_utilization_counter(
&mut self,
counter: Counter
) -> Result<(), NvmlError>
pub fn unfreeze_utilization_counter( &mut self, counter: Counter ) -> Result<(), NvmlError>
Unfreezes the specified NvLink utilization Counter
.
Both the receive and send counters will be unfrozen (if I’m reading NVIDIA’s meaning correctly).
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.
sourcepub fn reset_utilization_counter(
&mut self,
counter: Counter
) -> Result<(), NvmlError>
pub fn reset_utilization_counter( &mut self, counter: Counter ) -> Result<(), NvmlError>
Resets the specified NvLink utilization Counter
.
Both the receive and send counters will be rest (if I’m reading NVIDIA’s meaning correctly).
§Errors
Uninitialized
, if the library has not been successfully initializedInvalidArg
, if thelink
orDevice
within thisNvLink
struct instance is invalidNotSupported
, if thisDevice
doesn’t support this featureUnknown
, on any unexpected error
§Device Support
Supports Pascal or newer fully supported devices.