Home Tensorflow / PyTorch GPU 세팅
Post
Cancel

Tensorflow / PyTorch GPU 세팅

텐서플로와 파이토치에서 GPU 사용 확인과 셋업 참고 사항 기록
텐서 2.11 버전부터는 윈도우에서 GPU 사용을 지원하지 않는다고 함!

Tensorflow and PyTorch Setup

  • CUDA: 11.2
  • cuDNN : 8.1
  • TF: tensorflow-gpu==2.10.0
  • Torch: conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.3 -c pytorch
  • Python: 3.7

CUDA Setup

  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib
  • C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\include
  • nvcc --version
  • nvidia-smi

Ref

Tensorflow CUDA 버전 확인 PyTorch 버전 확인

1
2
import tensorflow as tf
import torch
1
tf.__version__, torch.__version__
1
('2.10.0', '1.12.1')
1
2
3
4
# TF GPU
from tensorflow.python.client import device_lib

device_lib.list_local_devices()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[name: "/device:CPU:0"
 device_type: "CPU"
 memory_limit: 268435456
 locality {
 }
 incarnation: 8541440801171234456
 xla_global_id: -1,
 name: "/device:GPU:0"
 device_type: "GPU"
 memory_limit: 6254755840
 locality {
   bus_id: 1
   links {
   }
 }
 incarnation: 17163750858690062226
 physical_device_desc: "device: 0, name: NVIDIA GeForce RTX 2070 SUPER, pci bus id: 0000:09:00.0, compute capability: 7.5"
 xla_global_id: 416903419]
1
2
# Torch GPU
"CUDA" if torch.cuda.is_available() else "CPU"
1
'CUDA'
This post is licensed under CC BY 4.0 by the author.

22년 11월 4주차 주간 회고

지식 증류 학습

Comments powered by Disqus.