2023년 March 16일
  1. AI 트레이닝 센터
  2. Python
  3. 윈도우 환경 tensorflow와 pytorch 설치

윈도우 환경 tensorflow와 pytorch 설치

OS: Windows 11
그래픽카드: NVIDIA GeForce RTX 2080 SUPER x 2
Python: (env) 3.7.3

1. Cuda & cuDNN 다운로드 및 설치

현재 환경에 최적화 해서 설치하는 것을 권장

Cuda 설치: 별도 계정 필요 없이 다운로드 가능함
download: CUDA Toolkit Archive | NVIDIA Developer

cuDNN 설치: nvidia developer 계정 필요함.
download: CUDA Deep Neural Network (cuDNN) | NVIDIA Developer

Cuda 경우 다운로드 받은 파일(EXE)을 실행하여 설치 진행하고, cuDNN 경우는 다운로드 받은 ZIP 파일 압축 해제한 후 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6 에 bin, include, lib 폴더 복사하여 설치함. 설치 이후 환경 변수에 하단 추가

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\lib

2. Tensorflow GPU 설치

다음과 같이 pip로 설치 가능함

pip install tensorflow-gpu==2.8.0

3. Pytorch 설치

나의 환경에 맞는 명령어를 찾아야 함. https://pytorch.org/get-started/locally/

conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia

4. 테스트 수행

import tensorflow as tf

print(tf.__version__)
2.8.0


tf.test.is_built_with_cuda()
True


tf.test.gpu_device_name()

2023-03-16 12:01:44.360450: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-03-16 12:01:46.841322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /device:GPU:0 with 5949 MB memory: -> device: 0, name: NVIDIA GeForce RTX 2080 SUPER, pci bus id: 0000:01:00.0, compute capability: 7.5
2023-03-16 12:01:46.843892: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /device:GPU:1 with 5949 MB memory: -> device: 1, name: NVIDIA GeForce RTX 2080 SUPER, pci bus id: 0000:02:00.0, compute capability: 7.5
‘/device:GPU:0’

Leave a Reply

Your email address will not be published. Required fields are marked *

연관 글
BCT NEWS
인기 글
워드프레스 제작 팁
클라우드
워드프레스 유지보수
워드프레스 모음