PyTorch: Error 803: system has unsupported display driver / cuda driver combination (CUDA 11.7, pytorch 1.13.1)

huangapple go评论58阅读模式
英文:

PyTorch: Error 803: system has unsupported display driver / cuda driver combination (CUDA 11.7, pytorch 1.13.1)

问题

无法使PyTorch正常工作。

我已经安装了cuda和NVIDIA驱动程序。

我使用以下命令安装了PyTorch

我正在使用以下代码片段测试PyTorch

它告诉我PyTorch无法访问CUDA。

如果这有任何区别,我正在运行ubuntu 22.04下的6.1.15-060115-generic内核。

英文:

I can't get PyTorch to work.

I have cuda and NVIDIA drivers installed

nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Jun__8_16:49:14_PDT_2022
Cuda compilation tools, release 11.7, V11.7.99
Build cuda_11.7.r11.7/compiler.31442593_0

I have installed PyTorch using the following command

conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia

I am testing PyTorch using the following code snippet

import torch

print(torch.__version__)

print(torch.cuda.is_available())

device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
print('Using device:', device)
print()

#Additional Info when using cuda
if device.type == 'cuda':
    print(torch.cuda.get_device_name(0))
    print('Memory Usage:')
    print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')
    print('Cached:   ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')

Which tells me PyTorch can't access CUDA

    1.13.1
    /home/vn/miniconda3/lib/python3.10/site-packages/torch/cuda/__init__.py:88: UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). 
Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? 
Error 803: system has unsupported display driver / cuda driver combination 
(Triggered internally at /opt/conda/conda-bld/pytorch_1670525541990/work/c10/cuda/CUDAFunctions.cpp:109.)
      return torch._C._cuda_getDeviceCount() > 0
    False
    Using device: cpu

In case it makes any difference I am running
6.1.15-060115-generic kernel under ubuntu 22.04

答案1

得分: 1

"installed cuda" 不代表 "显卡可以使用cuda。"
最终,我必须让nvidia-smi工作。
最简单的方法是使用随Ubuntu附带的NVIDIA驱动程序。

英文:

tldr - "installed cuda" doesn't mean "cuda can be used by the card."

ultimately I had to get nvidia-smi work.
the easiest way to do it was by using NVIDIA drivers that came with ubuntu.

huangapple
  • 本文由 发表于 2023年3月10日 01:22:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/75688024.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定