GPU-enabled training and testing in Windows 10

In Windows 10, my computer has NVIDIA driver 456.71 and I installed PyTorch using
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch

Then, I checked whether PyTorch used CUDA by typing the followings:

import torch
torch.cuda.is_available()

And it returned True.

It’s pretty weird to me because I’ve heard that we need to install both NVIDIA drivers and CUDA to use GPUs.

Thus, my question is: Can I use PyTorch and GPU-enabled training and testing without manually installing CUDA for Windows?

@hjung although you are getting True for torch.cuda.is_available(), without underlying nvidia drivers you will be unable to use it for tensor operations

There is an older thread discussing the same thing

@anantguptadbl From the link, it seems that the PyTorch installation command includes the CUDA runtime, which I think is sufficient to use use GPUs for training and testing. Thus, we do not need to install manually CUDA for Windows.

Could you (or anyone) please correct me if I am wrong?

Yes, you are right and don’t need to install a local CUDA toolkit (just the drivers) unless you want to build PyTorch from source or a custom CUDA extension.

1 Like