PyTorch를 사용해 딥러닝 공부하기 위해
개발 환경구축을 해볼꺼다.
준비
CUDA를 사용할껀데 일딴 CUDA는 CUDA코어가 장착된 NVIDIA GPU에서 작동된다.
때문에 자신의 그래픽카드를 먼저 확인해야한다.
필자일 경우 GTX 1080 (code name: Pascal)을 사용중이다.
이제 CUDA Toolkit의 버전을 선택할 차례이다
https://en.wikipedia.org/wiki/CUDA
CUDA - Wikipedia
From Wikipedia, the free encyclopedia Parallel computing platform and programming model In computing, CUDA (originally Compute Unified Device Architecture) is a proprietary[1] parallel computing platform and application programming interface (API) that all
en.wikipedia.org
GPUs supported에서 자신의 GPU의 Computecapability(version)을 확인해야한다
예시로 GTX 1080의 Computecapability(version)는 6.1이다.
확인하였으면 CUDA SDK의 버전을 선택해야한다.
필자를 예시로 Pascal기준 SDK버전은 11.8을 선택하였다.
버전을 선택하였으면 아래 링크에서 설치해준다.
https://developer.nvidia.com/cuda-toolkit-archive
CUDA Toolkit Archive
Previous releases of the CUDA Toolkit, GPU Computing SDK, documentation and developer drivers can be found using the links below. Please select the release you want from the list below, and be sure to check www.nvidia.com/drivers for more recent production
developer.nvidia.com
CUDA & cuDNN 설치
그다음 cuDNN을 CUDA 버전과 맞춰줘야한다. 아래 링크에서 확인하자.
https://docs.nvidia.com/deeplearning/cudnn/latest/reference/support-matrix.html
Support Matrix — NVIDIA cuDNN v9.3.0 documentation
The following sections highlight the compatibility of NVIDIA cuDNN versions with the various supported NVIDIA CUDA Toolkit, CUDA driver, and NVIDIA hardware versions. Note For best performance, the recommended configuration for GPUs Volta or later is cuDNN
docs.nvidia.com
SDK버전 11.8기준으로 cuDNN버전은 9.3.0을 사용할 수 있다.
cuDNN또한 버전에 맞게 설치해주자.
https://developer.nvidia.com/cudnn-archive
cuDNN Archive
developer.nvidia.com
cuDNN을 다운하면 이런식으로 압축파일일텐데
압축파일 내부에 있는 파일들을 모두
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8 경로에 복붙해주자
다했으면 CUDA가 성공적으로 설치되었는지 확인하기위해 CMD를 열고
nvcc --version을 입력한다.
PyTorch 설치
이제 PyTorch를 설치해야한다.
아래 사이트에서 자신의 컴퓨터 사양에 맞게 선택하고 Command를 복사해준다.
https://pytorch.org/get-started/locally/
Start Locally
Start Locally
pytorch.org
PyCharm에서 python 프로젝트를 빌드하고 터미널에서 위에서 받은 Command를 입력해준다.
참고로 최신 PyTorch를 사용하려면 python 버전이 3.8이상이여야하며 너무 높아서도 안된다.
설치가 끝났으면 python 파일을 하나 만들고
아래 코드를 입력해준다.
True가 뜨면 성공적으로 모든 작업을 완수한것이다.
'AI,ML' 카테고리의 다른 글
구름에듀 스터디 2일차 (0) | 2024.09.01 |
---|---|
구름에듀 스터디 1일차 (0) | 2024.08.18 |