tensorflow 준비

2022년 2월 21일 월요일

그래픽 드라이버

python 설치

conda create -n tensor python=3.8
conda activate tensor

텐서플로우 설치

pip install tensorflow-gpu>=2.5.0,<2.7.0

https://www.tensorflow.org/install/gpu

  • gpu 인식테스트
python
import tensorflow
from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
2022-02-22 00:17:37.198723: I tensorflow/core/platform/cpu_feature_guard.cc:142] 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.
2022-02-22 00:17:37.882632: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1510] Created device /device:GPU:0 with 9440 MB memory:  -> device: 0, name: NVIDIA GeForce RTX 3080 Ti, pci bus id: 0000:23:00.0, compute capability: 8.6
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 5050334808703057182
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 9898950656
locality {
  bus_id: 1
  links {
  }
}
incarnation: 6738684737477047134
physical_device_desc: "device: 0, name: NVIDIA GeForce RTX 3080 Ti, pci bus id: 0000:23:00.0, compute capability: 8.6"

gpu가 안나오면 cuda/cudnn 설치확인