繁体   English   中英

PyTorch CUDA 版本始终为10.2

[英]PyTorch CUDA version is always 10.2

I've installed a handful of PyTorch versions ( CUDA 11.7 nightly , CUDA 11.6 nightly , 11.3 ), but every time, torch.version.cuda returns 10.2 .

我想在 CUDA 11.7 上运行 PyTorch。 我的显卡有 CUDA 能力sm_86

[me@legion imagen-test]$ sudo pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 
...
[me@legion imagen-test]$ python
>>> import torch
>>> print(torch.version.cuda)
10.2

当我实际尝试使用 PyTorch 时,我收到一条错误消息,提示我安装的 PyTorch 版本不支持我的显卡所需的较新版本的 CUDA。

>>> torch.Tensor([1,2,3]).cuda()
...
NVIDIA GeForce RTX 3060 Laptop GPU with CUDA capability sm_86 is not compatible with the current PyTorch installation.
The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
...
RuntimeError: CUDA error: no kernel image is available for execution on the device
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

我完全被难住了,不确定从这里到 go 的位置。 我会很感激任何帮助。

您可能已经在不同的安装版本中安装了 PyTorch 和 CUDA 10.2。 这可能优先于 PyTorch 的版本。 要解决此问题,只需使用 pip 卸载所有版本的pip uninstall torch -y并重新安装 PyTorch 和 ZA33B7710374FF504CA。

资料来源: https://discuss.pytorch.org/t/cuda-version-is-always-10-2/152876

我将描述安装带有 gpu 支持的tensorflow的所有内容; 我认为安装pytorch非常相似
您应该保留所有这些及其版本号 STRICT: nvidia driver 510 cuda11.6 ; cudnn8.4.0 ; Cupti11.6
然后安装严格版本的pytorch 22.04(支持 gpu 的构建)
检查 \CUDA\bin; \CUDA\libnvvp; \CUDA\extras\CUPTI\lib64 在你的 $PATH 中(这仅适用于 Windows)
检查 CUDA 文件夹是否在您的 CUDA_PATH 和envvars环境变量中

最后,您检查您的安装是否在 python 中运行:

import tensorflow as tf
tf.test.is_gpu_available()

应该打印出正确版本的 tf,正确版本的 cuda 和 cupti; 第二行应该成功运行并测试 gpu

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM