6

I installed Anaconda, CUDA, and PyTorch today, and I can't access my GPU (RTX 2070) in torch. I followed all of installation steps and PyTorch works fine otherwise, but when I try to access the GPU either in shell or in script I get

>>> import torch
>>> torch.cuda.is_available()
False
>>> torch.cuda.device_count()
0
>>> print(torch.version.cuda)
None

Running conda list shows this as my installed package

cudatoolkit               11.3.1               h59b6b97_2

and running numba -s in the conda environment shows

__CUDA Information__
CUDA Device Initialized                       : True
CUDA Driver Version                           : 11030
CUDA Detect Output:
Found 1 CUDA devices
id 0    b'NVIDIA GeForce RTX 2070'                              [SUPPORTED]
                      compute capability: 7.5
                           pci device id: 0
                              pci bus id: 1
Summary:
        1/1 devices are supported

and all of the tests pass with ok. CUDA 11.3 is one of the supported compute platforms for PyTorch and by my GPU and that is the version that I installed.

I already tried reinstalling CUDA, I am on Windows 10, nvcc --version shows that CUDA is installed Build cuda_11.3.r11.3/compiler.29745058_0

Any suggestions would be helpful

Edit: I am using PyTorch 1.10 installed from the generated command on their website. Using python 3.9.7. I also installed PyTorch again in a fresh conda environment and got the same problem.

log
  • 71
  • 1
  • 1
  • 4
  • Have you tried installing Pytorch with older CUDA versions such as 10.1 / 10.2? If your platform supports 11, then it should do so for the older versions as well... – inverted_index Oct 24 '21 at 06:00
  • You are have a version of PyTorch installed which has not been built with CUDA GPU acceleration. You need to install a different version of PyTorch. On CUDA accelerated builds `torch.version.cuda` will return a CUDA version string. On non CUDA builds, it returns `None` – talonmies Oct 24 '21 at 06:12
  • Open terminal, type `nvidia -smi` to check if nvidia driver is installed successfully or not. – TaQuangTu Oct 24 '21 at 07:32
  • 1
    @talonmies Thanks for pointing that out. Changing my PyTorch version seems to have fixed the issue. I really appreciate it! – log Oct 24 '21 at 07:52
  • Its `nvidia-smi` there is no space between the two words. – aks Nov 07 '22 at 13:00

3 Answers3

3
  • Double check that you have installed pytorch with cuda enabled and not the CPU version
  • Open a terminal and run nvidia-smi and see if it detects your GPU.
  • Double check that your Cuda version is the same as the one required by PyTorch. If you have an older version of Cuda, then download the latest version.
1

Downgrading CUDA to 10.2 and using PyTorch LTS 1.8.2 lets PyTorch use the GPU now. Per the comment from @talonmies it seems like PyTorch 1.10 doesn't support CUDA

log
  • 71
  • 1
  • 1
  • 4
  • It isn't that Pytorch `1.10 doesn't support CUDA -- it does. It is that the *build* that you had installed didn't have CUDA support compiled in – talonmies Oct 24 '21 at 11:52
  • I installed the build listed on the homepage and it didn't work. I selected that I was using CUDA and there were no other build options – log Oct 24 '21 at 19:07
  • It can be that they messed up and are accidentally distributing a non GPU build as a GPU build. – talonmies Oct 24 '21 at 23:16
1

If you use conda, try to update conda. It works for me to install PyTorch 1.10 with CUDA 10.2.

ZikunHong
  • 11
  • 1