Skip to content

CUDA support in Torch

toncho11 edited this page Apr 14, 2023 · 6 revisions

Use this console command to get the CUDA compute platform version. The command is available on Windows as well.

nvidia-smi

You will get the version in the top right corner in "CUDA version". For example 11.7

Next go to https://pytorch.org and select your version of CUDA. Pytorch will generate a command for the installation similar to:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117

In the above case it is for CUDA 11.7. Next test your CUDA support:

import torch
print(torch.cuda.is_available())
print(torch.cuda.device_count())
print(torch.cuda.current_device())
print(torch.cuda.get_device_name(0))