[PR #87] [MERGED] feat(api/device): add methods to query PCIe and NVLink throughput #154

Closed
opened 2026-05-05 03:26:51 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/XuehaiPan/nvitop/pull/87
Author: @XuehaiPan
Created: 8/4/2023
Status: Merged
Merged: 8/13/2023
Merged by: @XuehaiPan

Base: mainHead: throughput


📝 Commits (10+)

  • 2d479de feat(api/device): add methods to query PCI-e throughput
  • 4073d7d feat(api/device): add methods to query NVLink throughput
  • b2dc47e feat(api/device): add shortcut when there is no NVLink available
  • ce09863 chore(pre-commit): update pre-commit hooks
  • df1df52 chore(api/libnvml): handle corrupted pynvml installation
  • 54fe913 chore(api/utils): use open condition for the right side
  • 5184b7c chore(api/device): add extra interval argument for blocking
  • 643393b style: style libnvml
  • d71eb51 chore(pre-commit): update pre-commit hooks
  • c12b017 fix(callbacks): fix a potential attribute errors for newer PyTorch-Lightning

📊 Changes

14 files changed (+587 additions, -63 deletions)

View changed files

📝 .pre-commit-config.yaml (+3 -3)
📝 .pylintrc (+3 -1)
📝 CHANGELOG.md (+1 -1)
📝 README.md (+5 -0)
📝 docs/source/spelling_wordlist.txt (+5 -0)
📝 nvitop/api/collector.py (+1 -1)
📝 nvitop/api/device.py (+439 -9)
📝 nvitop/api/libcuda.py (+6 -3)
📝 nvitop/api/libcudart.py (+7 -2)
📝 nvitop/api/libnvml.py (+79 -25)
📝 nvitop/api/process.py (+5 -3)
📝 nvitop/api/utils.py (+20 -12)
📝 nvitop/callbacks/pytorch_lightning.py (+5 -1)
📝 nvitop/gui/screens/main/process.py (+8 -2)

📄 Description

Issue Type

  • Improvement/feature implementation

Description

Add methods to query PCIe and NVLink throughput.

In [1]: from nvitop import *

In [2]: d = Device(0)

In [3]: d.nvlink_mean_tx_throughput_human()  # mean TX throughput over all NVLinks
Out[3]: '257.6MiB/s'

In [4]: d.nvlink_tx_throughput_human()  # we have 12-NVLinks
Out[4]: 
['234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s',
 '234.7MiB/s']

In [5]: d.nvlink_rx_throughput_human()  # we have 12-NVLinks
Out[5]: 
['2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s',
 '2700MiB/s']

In [6]: d.nvlink_throughput()  # we have 12-NVLinks
Out[6]: 
[ThroughputInfo(tx=2619858, rx=2596953),  # in KiB/s
 ThroughputInfo(tx=2619815, rx=2596953),
 ThroughputInfo(tx=2619939, rx=2596953),
 ThroughputInfo(tx=2619939, rx=2596953),
 ThroughputInfo(tx=2619860, rx=2596953),
 ThroughputInfo(tx=2619860, rx=2596953),
 ThroughputInfo(tx=2619860, rx=2596953),
 ThroughputInfo(tx=2619819, rx=2596953),
 ThroughputInfo(tx=2619942, rx=2596953),
 ThroughputInfo(tx=2619939, rx=2596953),
 ThroughputInfo(tx=2619861, rx=2596953),
 ThroughputInfo(tx=2619861, rx=2596953)]

In [7]: d.pcie_throughput()  # in KiB/s
Out[7]: ThroughputInfo(tx=7000, rx=12000)

In [8]: d.pcie_tx_throughput()  # in KiB/s
Out[8]: 11000

In [9]: d.pcie_tx_throughput_human()
Out[9]: '6.84MiB/s'

Motivation and Context

Resolves #82


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/XuehaiPan/nvitop/pull/87 **Author:** [@XuehaiPan](https://github.com/XuehaiPan) **Created:** 8/4/2023 **Status:** ✅ Merged **Merged:** 8/13/2023 **Merged by:** [@XuehaiPan](https://github.com/XuehaiPan) **Base:** `main` ← **Head:** `throughput` --- ### 📝 Commits (10+) - [`2d479de`](https://github.com/XuehaiPan/nvitop/commit/2d479deecc09ffe94b5c484b0b5f6f0bd7dd8185) feat(api/device): add methods to query PCI-e throughput - [`4073d7d`](https://github.com/XuehaiPan/nvitop/commit/4073d7da75e1101e8cafe4809be525090622935c) feat(api/device): add methods to query NVLink throughput - [`b2dc47e`](https://github.com/XuehaiPan/nvitop/commit/b2dc47eec8ff9d11156f05b571e6b7896ad76a5d) feat(api/device): add shortcut when there is no NVLink available - [`ce09863`](https://github.com/XuehaiPan/nvitop/commit/ce098635f2f086b03136d2a839703da7052a5482) chore(pre-commit): update pre-commit hooks - [`df1df52`](https://github.com/XuehaiPan/nvitop/commit/df1df528abc3aa5ea7748d0f58d9fe24fc830d9e) chore(api/libnvml): handle corrupted pynvml installation - [`54fe913`](https://github.com/XuehaiPan/nvitop/commit/54fe913323c5e2242ec2c0e022c048095865e334) chore(api/utils): use open condition for the right side - [`5184b7c`](https://github.com/XuehaiPan/nvitop/commit/5184b7c9a7d2cd4dafeb71e60a1fbd4bc171543e) chore(api/device): add extra `interval` argument for blocking - [`643393b`](https://github.com/XuehaiPan/nvitop/commit/643393be53a47e87080958d3b463023b7a246a41) style: style `libnvml` - [`d71eb51`](https://github.com/XuehaiPan/nvitop/commit/d71eb5103a6e3b2a0850eb19987bcbe1bda5cf0e) chore(pre-commit): update pre-commit hooks - [`c12b017`](https://github.com/XuehaiPan/nvitop/commit/c12b01701bf1bf62fe5b124d5a410c2fdc524a8c) fix(callbacks): fix a potential attribute errors for newer PyTorch-Lightning ### 📊 Changes **14 files changed** (+587 additions, -63 deletions) <details> <summary>View changed files</summary> 📝 `.pre-commit-config.yaml` (+3 -3) 📝 `.pylintrc` (+3 -1) 📝 `CHANGELOG.md` (+1 -1) 📝 `README.md` (+5 -0) 📝 `docs/source/spelling_wordlist.txt` (+5 -0) 📝 `nvitop/api/collector.py` (+1 -1) 📝 `nvitop/api/device.py` (+439 -9) 📝 `nvitop/api/libcuda.py` (+6 -3) 📝 `nvitop/api/libcudart.py` (+7 -2) 📝 `nvitop/api/libnvml.py` (+79 -25) 📝 `nvitop/api/process.py` (+5 -3) 📝 `nvitop/api/utils.py` (+20 -12) 📝 `nvitop/callbacks/pytorch_lightning.py` (+5 -1) 📝 `nvitop/gui/screens/main/process.py` (+8 -2) </details> ### 📄 Description <!-- Provide a descriptive summary of the changes in the title above --> #### Issue Type <!-- Pick relevant types and delete the rest --> - Improvement/feature implementation #### Description <!-- Describe the changes in detail --> Add methods to query PCIe and NVLink throughput. ```python In [1]: from nvitop import * In [2]: d = Device(0) In [3]: d.nvlink_mean_tx_throughput_human() # mean TX throughput over all NVLinks Out[3]: '257.6MiB/s' In [4]: d.nvlink_tx_throughput_human() # we have 12-NVLinks Out[4]: ['234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s', '234.7MiB/s'] In [5]: d.nvlink_rx_throughput_human() # we have 12-NVLinks Out[5]: ['2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s', '2700MiB/s'] In [6]: d.nvlink_throughput() # we have 12-NVLinks Out[6]: [ThroughputInfo(tx=2619858, rx=2596953), # in KiB/s ThroughputInfo(tx=2619815, rx=2596953), ThroughputInfo(tx=2619939, rx=2596953), ThroughputInfo(tx=2619939, rx=2596953), ThroughputInfo(tx=2619860, rx=2596953), ThroughputInfo(tx=2619860, rx=2596953), ThroughputInfo(tx=2619860, rx=2596953), ThroughputInfo(tx=2619819, rx=2596953), ThroughputInfo(tx=2619942, rx=2596953), ThroughputInfo(tx=2619939, rx=2596953), ThroughputInfo(tx=2619861, rx=2596953), ThroughputInfo(tx=2619861, rx=2596953)] In [7]: d.pcie_throughput() # in KiB/s Out[7]: ThroughputInfo(tx=7000, rx=12000) In [8]: d.pcie_tx_throughput() # in KiB/s Out[8]: 11000 In [9]: d.pcie_tx_throughput_human() Out[9]: '6.84MiB/s' ``` #### Motivation and Context <!-- Why are these changes required? --> <!-- What problems do these changes solve? --> <!-- Link to relevant issues --> Resolves #82 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-05-05 03:26:51 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/nvitop#154
No description provided.