Reputation: 817
Recently,I need to install pytorch ,when I check out the 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 ?
Upvotes: 13
Views: 13166
Reputation: 22304
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.
Upvotes: 15