먼저 CUDA가 설치되어있는 경우 터미널에 다음과 같이 입력 하여 설치한다.
$ pip3 install -f torch torchvision
설치 확인
python3 를 실행한 다음 나오는 터미널에서 다음과 같이 입력한다.
$ python3
Python 3.8.10 (default, Mar 15 2022, 12:22:08)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
PyTorch가 GPU를 활용하고 있는지 확인하기 위해서 다음을 입력한다.
>>> print(torch.cuda.is_available())
True
>>> print(torch.cuda.device_count())
1
>>>