1. CUDA Toolkit 설치하기

가지고 있는 GPU에 맞춰서 아래 링크에서 버전 확인하기

https://en.wikipedia.org/wiki/CUDA

 

CUDA - Wikipedia

From Wikipedia, the free encyclopedia Parallel computing platform and programming model In computing, CUDA (Compute Unified Device Architecture) is a proprietary[2] parallel computing platform and application programming interface (API) that allows softwar

en.wikipedia.org

 

RTX 3090의 경우 8.6 버전 (Ampere) 그룹임으로, CUDA 11.8, 12.0-12.6, 12.8이 가능함을 알 수 있다. 해당 버전을 구글에 검색해 설치해주면 된다.

 

터미널 창에서 "nvcc --version"을 입력하면, 설치가 잘 되었는지 확인할 수 있다. 혹시나 기존 버전에서 변경하고자 하는 경우, 기존 버전을 삭제하거나 환경변수에서 새로 설치하는 버전의 CUDA를 상위로 올리면 된다. 환경변수 반영이 안돼면, 재부팅하면 된다.

 

2. cuDNN 설치하기

아래의 링크에서 설치한 CUDA 버전에 맞춰서 설치해준다.

https://docs.nvidia.com/deeplearning/cudnn/backend/latest/reference/support-matrix.html

 

Support Matrix — NVIDIA cuDNN Backend

For best performance, the recommended configuration for GPUs Volta or later is cuDNN 9.8.0 with CUDA 12.8. For GPUs prior to Volta (that is, Pascal and Maxwell), the recommended configuration is cuDNN 9.8.0 with CUDA 11.8. These are the configurations used

docs.nvidia.com

 

CUDA 12.4를 설치해 주었으므로, cuDNN 9,8.0을 설치하면 되는 것을 알 수 있다. 마찬가지로 검색해서 다운로드 해주면 된다.

 

다운로드된 cuDNN의 모든 파일을 CUDA에 옮겨주면 설치가 완료된다.

 

3. Torch 설치하기

아래의 링크에서 환경에 맞춰 설치를 진행하면 된다.

https://pytorch.org/get-started/locally/

 

Start Locally

Start Locally

pytorch.org

 

Previous torch version을 위한 설치 방법도 사이트에 있으니 참고해서 설치하면 끝나게 된다.

 

설치하려는 Torch와 Python 버전이 안맞을 수도 있다. 그런 경우 아래 링크를 참고해 적절하게 맞춰서 설치하면 된다.

https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix

 

pytorch/RELEASE.md at main · pytorch/pytorch

Tensors and Dynamic neural networks in Python with strong GPU acceleration - pytorch/pytorch

github.com

 

다 완료되었으면 python으로 확인해보면 된다.

print(torch.__version__) # torch version 확인
print(torch.cuda.is_available()) 
print(torch.cuda.get_device_name(0))