Search code examples
pytorchcuda

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


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


Solution

  • 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.