feat(api/device): add shortcut when there is no NVLink available

This commit is contained in:
Xuehai Pan 2023-08-05 02:23:29 +08:00
parent 4073d7da75
commit b2dc47eec8

View file

@ -1537,6 +1537,8 @@ class Device: # pylint: disable=too-many-instance-attributes,too-many-public-me
could be :const:`nvitop.NA` when not applicable.
"""
nvlink_link_count = self.nvlink_link_count()
if nvlink_link_count == 0:
return []
def query_nvlink_throughput_counters() -> tuple[tuple[int | NaType, int]]:
return tuple( # type: ignore[return-value]