본문 바로가기
불편한점 빠르고 쉽게 해결해드림

NVIDIA 그래픽카드가 아닌 AMD, intel 등 GPU로 파이썬 Tensorflow 구동시키기

by 예쁜기억저장소 2023. 4. 4.

우선 지원하는 윈도우 버전과 그래픽은 이렇습니다.

  • Windows 10 Version 1709, 64-bit (Build 16299 or higher) or Windows 11 Version 21H2, 64-bit (Build 22000 or higher)
  • Python x86-64 3.7, 3.8, 3.9 or 3.10
  • One of the following supported GPUs:
    • AMD Radeon R5/R7/R9 2xx series or newer
    • Intel HD Graphics 5xx or newer
    • NVIDIA GeForce GTX 9xx series GPU or newer

 

1.아나콘다(ANACONDA) 설치하기

아나콘다 공식 사이트(https://www.anaconda.com)에 접속하여 다운로드 버튼을 누르면 Anaconda Installers 화면으로 이동합니다. 여기서 자신이 사용하고 있는 컴퓨터의 운영체제에 맞는 것을 선택하면 됩니다.

2.anaconda prompt 들어가서 가상환경 구축하기

현재론 파이썬ver.3.7이상, 텐써ver.2.9이상 지원함

anaconda prompt 실행해서 아래명령어를 적어주세요

conda create --name mylittleforest python=3.9

conda activate mylittleforest

pip install tensorflow-cpu==2.10

pip install tensorflow-directml-plugin

pip install wheel vswhere

원하는 패키지 알아서 pip install 하면된다.

 

 

 

본래 CPU만 있던게 GPU 가들어가있으면 합격이다.

from tensorflow.python.client import device_lib
device_lib.list_local_devices()

[name: "/device:CPU:0"

device_type: "CPU"

memory_limit: 268435456

locality {

}

incarnation: 16979449472946329870

xla_global_id: -1,

name: "/device:GPU:0"

device_type: "GPU"

memory_limit: 3715713024

locality {

bus_id: 1 }

incarnation: 14694252830794020884

physical_device_desc: "device: 0,

name: DML,

pci bus id: <undefined>"

xla_global_id: -1]

 

append

model.fit하기전에 이걸써주면 gpu만쓰는거같다.

with tf.device('/GPU:0'):