Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nvmlDeviceGetP2PStatus #62

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
29 changes: 29 additions & 0 deletions nvml-wrapper/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3452,6 +3452,35 @@ impl<'nvml> Device<'nvml> {
}
}

/**
Gets the status for a given p2p capability index between this [`Device`] and another given [`Device`].

# Errors

* `Uninitialized`, if the library has not been successfully initialized
* `InvalidArg`, if device1 or device2 or p2p_index is invalid
* `Unknown`, on any unexpected error
*/
#[doc(alias = "nvmlDeviceGetP2PStatus")]
pub fn p2p_status(
&self,
device2: &Device,
p2p_index: P2pCapabilitiesIndex,
) -> Result<P2pStatus, NvmlError> {
let sym = nvml_sym(self.nvml.lib.nvmlDeviceGetP2PStatus.as_ref())?;

let status_c = unsafe {
let mut status: nvmlGpuP2PStatus_t = mem::zeroed();
let device2 = device2.device;

nvml_try(sym(self.device, device2, p2p_index as u32, &mut status))?;

status
};

P2pStatus::try_from(status_c)
}

/**
Gets the power source of this [`Device`].

Expand Down
1 change: 0 additions & 1 deletion nvml-wrapper/unwrapped_functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ nvmlDeviceGetNvLinkRemotePciInfo_v2
nvmlDeviceGetNvLinkUtilizationControl
nvmlDeviceGetNvLinkUtilizationCounter
nvmlDeviceGetOfaUtilization
nvmlDeviceGetP2PStatus
nvmlDeviceGetPgpuMetadataString
nvmlDeviceGetPowerManagementDefaultLimit
nvmlDeviceGetPowerManagementLimitConstraints
Expand Down