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:
Why does everything turn out to be working even my cuda version is not the same as any of one I mentioned ?
What's the difference between choosing cuda verison 9.2,10.1,10.2,11.0 ?
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With