简体   繁体   中英

GPU is not available for Pytorch

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.

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

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

I would suggest restarting your system and check again if it is working or not ?

which version of Pytorch did you install ? Did you try to match between Pytorch and the Cuda version ?

First, open a terminal and run nvidia-smi and see if it detects your GPU. If this works, then 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, restart your computer and try again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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