Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between versions 9.2,10.1,10.2,11.0 of cuda for PyTorch 1.7

Tags:

pytorch

Recently,I need to install pytorch ,when I check out the website :

install pytorch website

It shows four different version 9.2,10.1,10.2,11.0 to choose ,And I have cuda version 10.0 and driver version 450 installed on my computer,I thought it would fail to enable gpu when using pytorch ,After I choose 10.1 and try torch.cuda.is_available() and it returns True

I have two questions:

  1. Why does everything turn out to be working even my cuda version is not the same as any of one I mentioned ?

  2. What's the difference between choosing cuda verison 9.2,10.1,10.2,11.0 ?

like image 522
Pro_gram_mer Avatar asked Feb 01 '21 07:02

Pro_gram_mer


People also ask

Which CUDA version should I use for PyTorch?

You can build PyTorch from source with any CUDA version >=9.2 and the binaries ship with the mentioned CUDA versions from the install selection.

Does CUDA 11 work with PyTorch?

Notably, since the current stable PyTorch version only supports CUDA 11.1, then, even though you have installed CUDA 11.2 toolkit manually previously, you can only run under the CUDA 11.1 toolkit.

Does CUDA 11.4 support PyTorch?

While my PC has CUDA 11.4 installed for my nVidia and various other dependent apps run on it. Presently on the official site the PyTorch just seems compatible with CUDA 11.3 and nothing else in Cuda 11.


1 Answers

PyTorch doesn't use the system's CUDA installation when installed from a package manager (either conda or pip). Instead, it comes with a copy of the CUDA runtime and will work as long as your system is compatible with that version of PyTorch. By compatible I mean that the GPU supports the particular version of CUDA and the GPU's compute capability is one that the PyTorch binaries (for the selected version) are compiled with support for.

Therefore the version reported by nvcc (the version installed on the system) is basically irrelevant. The version you should be looking at is

import torch
# print the version of CUDA being used by pytorch
print(torch.version.cuda)

The only time the system's version of CUDA should matter is if you compiled PyTorch from source.

As for which version of CUDA to select. You will probably want the newest version of CUDA that your system is compatible with. This is because newer versions generally include performance improvements compared to older versions.

like image 147
jodag Avatar answered Sep 19 '22 14:09

jodag