AMDGPU Top 使用指南与常见问题解决方法

AMDGPU Top 使用指南与常见问题解决方法

amdgpu_top Tool to display AMDGPU usage amdgpu_top 项目地址: https://gitcode.com/gh_mirrors/am/amdgpu_top

1. 项目基础介绍及主要编程语言

amdgpu_top是一个在Linux环境下使用的工具,主要用于显示AMDGPU显卡的使用情况,包括但不限于核心使用率、内存使用情况、电源消耗等性能指标。这个工具类似于AMD的radeon-top以及intel_gpu_top等,主要从性能计数器(GRBM、GRBM2)、传感器(fdinfo)以及AMDGPU驱动中搜集信息,并提供了一个简单的TUI(Text User Interface)界面,类似于nvidia-smi和rocm-smi。

该项目是用Rust编程语言编写的,由于Rust在系统编程上的性能优势,非常适合此类需要高效处理硬件信息的场景。

2. 新手在使用amdgpu_top时需要特别注意的三个问题及解决步骤

问题一:安装过程中的依赖问题

amdgpu_top在安装和运行时需要依赖于特定的库文件。如果系统中缺少这些依赖,将会导致程序无法启动。

解决步骤:
  1. 确认系统中已安装libdrmlibdrm_amdgpu库。可以使用包管理器进行安装,如在Ubuntu系统中可以使用以下命令:

    sudo apt-get install libdrm-dev libdrm-amdgpu-dev
    
  2. 如果在编译过程中遇到问题,检查是否所有必要的开发工具和库都已经安装。

问题二:显示不完全或无响应

当打开amdgpu_top的TUI界面时,可能会遇到界面显示不完全或者无响应的情况。

解决步骤:
  1. 确保使用的终端窗口支持amdgpu_top的显示需求。如果不支持,尝试调整终端窗口的大小。

  2. 如果程序无响应,可以尝试重新启动程序。

  3. 若问题依旧存在,可以尝试使用不同的终端模拟器或者检查是否有新的版本发布,可能新版本已修复了相关问题。

问题三:权限不足

在尝试获取GPU信息时,可能会遇到权限不足,导致无法读取性能计数器。

解决步骤:
  1. 检查当前用户是否具有足够权限。如果需要,可以使用sudo提升权限:

    sudo amdgpu_top
    
  2. 如果是在使用--dump选项时遇到权限问题,确保用户有权限访问相应的设备文件。

  3. 考虑将当前用户添加到videorender用户组中,这可以为用户授予对图形设备的访问权限:

    sudo usermod -a -G video $USER
    # 或者
    sudo usermod -a -G render $USER
    

    添加后,需要注销并重新登录用户,以使改动生效。

通过以上步骤,新手用户在使用amdgpu_top时应该能够遇到较少的问题,并能有效地监控AMDGPU显卡的性能情况。如果在使用过程中仍然遇到问题,可以考虑查看项目的文档或者寻求社区的帮助。

amdgpu_top Tool to display AMDGPU usage amdgpu_top 项目地址: https://gitcode.com/gh_mirrors/am/amdgpu_top

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

(Log) PS D:\Project\Y\project\GraphLogAD-main> pip install --no-cache-dir torch-scatter Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Collecting torch-scatter Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f5/ab/2a44ecac0f891dd0d765fc59ac8d277c6283a31907626560e72685df2ed6/torch_scatter-2.1.2.tar.gz (108 kB) Preparing metadata (setup.py) ... done Building wheels for collected packages: torch-scatter DEPRECATION: Building 'torch-scatter' using the legacy setup.py bdist_wheel mechanism, which will be removed in a future version. pip 25.3 will enforce this behaviour change. A possible replacement is to use the standardized build interface by setting the `--use-pep517` option, (possibly combined with `--no-build-isolation`), or adding a `pyproject.toml` file to the source tree of 'torch-scatter'. Discussion can be found at https://github.com/pypa/pip/issues/6334 Building wheel for torch-scatter (setup.py) ... error error: subprocess-exited-with-error × python setup.py bdist_wheel did not run successfully. │ exit code: 1 ╰─> [44 lines of output] C:\Users\23833\.conda\envs\Log\lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: OSI Approved :: MIT License See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\placeholder.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\scatter.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\segment_coo.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\segment_csr.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\testing.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\utils.py -> build\lib.win-amd64-cpython-310\torch_scatter copying torch_scatter\__init__.py -> build\lib.win-amd64-cpython-310\torch_scatter creating build\lib.win-amd64-cpython-310\torch_scatter\composite copying torch_scatter\composite\logsumexp.py -> build\lib.win-amd64-cpython-310\torch_scatter\composite copying torch_scatter\composite\softmax.py -> build\lib.win-amd64-cpython-310\torch_scatter\composite copying torch_scatter\composite\std.py -> build\lib.win-amd64-cpython-310\torch_scatter\composite copying torch_scatter\composite\__init__.py -> build\lib.win-amd64-cpython-310\torch_scatter\composite running egg_info writing torch_scatter.egg-info\PKG-INFO writing dependency_links to torch_scatter.egg-info\dependency_links.txt writing requirements to torch_scatter.egg-info\requires.txt writing top-level names to torch_scatter.egg-info\top_level.txt reading manifest file 'torch_scatter.egg-info\SOURCES.txt' reading manifest template 'MANIFEST.in' warning: no previously-included files matching '*' found under directory 'test' adding license file 'LICENSE' writing manifest file 'torch_scatter.egg-info\SOURCES.txt' running build_ext C:\Users\23833\.conda\envs\Log\lib\site-packages\torch\utils\cpp_extension.py:382: UserWarning: Error checking compiler version for cl: [WinError 2] 系统找不到指定的文件。 warnings.warn(f'Error checking compiler version for {compiler}: {error}') building 'torch_scatter._scatter_cpu' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for torch-scatter Running setup.py clean for torch-scatter Failed to build torch-scatter ERROR: Failed to build installable wheels for some pyproject.toml based projects (torch-scatter)
最新发布
06-23
<think>我们正在解决Windows上安装torch-scatter时出现的MicrosoftVisualC++14.0缺失问题。根据引用[1]和[2],问题在于该包包含需要编译的C++扩展,而系统缺少必要的编译工具。我们有几种解决方案:###✅解决方案1:安装MicrosoftC++生成工具(推荐但占用空间大)1.**下载安装生成工具**访问[VisualStudio生成工具下载页](https://visualstudio.microsoft.com/zh-hans/downloads/#build-tools-for-visual-studio-2022),下载并运行安装程序。2.**勾选工作负载**在安装界面选择:-"使用C++的桌面开发"-右侧勾选:*`Windows10/11SDK`*`MSVCv143-VS2022C++生成工具`*`C++CMake工具`![安装组件选择示意图](https://docs.microsoft.com/zh-cn/cpp/build/media/desktop-development-with-cpp.png?view=msvc-170)3.**重启后重试安装**```bashpipinstalltorch-scatter```###✅解决方案2:安装预编译的wheel(免编译,推荐)根据引用[3]和[4],PyG官方提供预编译的wheel文件,可绕过编译步骤:```bashpipinstalltorch-scatter-fhttps://data.pyg.org/whl/torch-{TORCH_VERSION}+{CUDA}.html```**参数替换规则**:|变量|获取方式|示例值||---------------|------------------------------------------|-------------||`TORCH_VERSION`|`importtorch;print(torch.__version__)`|`2.2.1`||`CUDA`|CPU版填`cpu`,GPU版根据`torch.version.cuda`获取|`cpu`/`cu121`|>**示例**:PyTorch2.2.1+CPU环境>```bash>pipinstalltorch-scatter-fhttps://data.pyg.org/whl/torch-2.2.1+cpu.html>```###✅解决方案3:通过Conda安装(Anaconda用户)```bashcondainstall-cpygpytorch-scatter```###🔍验证安装```pythonimporttorchfromtorch_scatterimportscatter_addsrc=torch.tensor([1,2,3,4,5])index=torch.tensor([0,0,1,1,2])out=scatter_add(src,index,dim=0)print(out)#应输出tensor([3,7,5])```###💡避坑指南1.**版本匹配**预编译wheel必须严格匹配PyTorch主版本和CUDA版本(如有),否则可能引发兼容性问题[^4]。2.**环境隔离**建议在虚拟环境中操作:```bashpython-mvenvscatter_envscatter_env\Scripts\activate```3.**清理缓存**若之前安装失败,先清理缓存:```bashpipcachepurge```>**技术原理**:`torch_scatter`等PyG依赖包含C++扩展模块,Windows需MSVC编译环境[^2]。预编译wheel通过CI提前编译二进制文件,避免用户本地编译[^3]。---###§§相关问题§§1.如何查看PyTorch精确版本及支持的CUDA版本?2.PyG框架中还有哪些依赖包需要类似编译步骤?3.在Linux系统中如何解决`torch_scatter`编译问题?4.为什么Anaconda环境有时能避免C++编译问题?5.安装后如何验证`torch_scatter`是否正常工作?</think>### 解决Windows安装torch-scatter时Microsoft Visual C++缺失问题 #### ✅ 方法1:安装Microsoft C++生成工具(推荐完整开发环境) 1. **下载安装器** 访问微软官方下载页:[Visual Studio生成工具](https://visualstudio.microsoft.com/zh-hans/downloads/#build-tools-for-visual-studio-2022) 2. **选择工作负载** 安装时勾选: - ✔️ "使用C++的桌面开发" - ✔️ 右侧"可选组件"中: * Windows 10/11 SDK * MSVC v143 - VS 2022 C++生成工具 * C++ CMake工具 ![安装界面示意图](https://docs.microsoft.com/zh-cn/cpp/build/media/desktop-development-with-cpp.png?view=msvc-170) 3. **安装后验证** ```bash pip install torch-scatter ``` > 此方法需5-6GB空间,但一劳永逸解决编译依赖[^2] #### ✅ 方法2:安装预编译版本(免编译) 1. **确认环境信息** ```bash python -c "import torch; print(torch.__version__, torch.version.cuda)" ``` 输出示例:`2.2.1 None`(CPU)或 `2.2.1 12.1`(CUDA 12.1) 2. **选择对应wheel** ```bash pip install torch-scatter -f https://data.pyg.org/whl/torch-{TORCH_VERSION}+{CUDA}.html ``` - **CPU版本**(输出中cuda为`None`时): ```bash pip install torch-scatter -f https://data.pyg.org/whl/torch-2.2.1+cpu.html ``` - **GPU版本**: ```bash pip install torch-scatter -f https://data.pyg.org/whl/torch-2.2.1+cu121.html ``` > 预编译包无需本地编译环境[^4] #### ✅ 方法3:Conda安装(推荐Anaconda用户) ```bash conda install -c pyg pytorch-scatter ``` #### 💎 验证安装 ```python import torch from torch_scatter import scatter_add # 测试功能 src = torch.tensor([1, 2, 3, 4, 5]) index = torch.tensor([0, 0, 1, 1, 2]) print(scatter_add(src, index, dim=0)) # 应输出 tensor([3, 7, 5]) ``` #### ⚠️ 常见问题处理 1. **版本冲突** 确保所有PyG组件版本兼容: ```bash pip install torch-scatter==2.1.2+pt22cpu torch-sparse==0.6.18+pt22cpu ``` 2. **缓存问题** 清除pip缓存后重试: ```bash pip cache purge pip install --no-cache-dir torch-scatter ``` 3. **虚拟环境** 建议在新环境中操作: ```bash python -m venv scatter_env scatter_env\Scripts\activate ``` > **技术原理**:`torch_scatter`包含C++扩展模块,Windows需MSVC编译环境。PyG官方提供预编译包可避免此依赖[^3][^4]。 --- ###
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

毛彤影

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值