본문 바로가기
Programming/Python

Keras, Tensorflow-gpu 설치

by NAMP 2017. 12. 25.

Keras, Tensorflow-gpu 설치

keras 설치

명령 프롬프트를 관리자 모드로 실행합니다.

관리자 모드가 아닐경우 액세스 거부가 발생할 수 있습니다.

PermissionError: [WinError 5] 액세스가 거부되었습니다: 'c:\programdata\anaconda3.6_64bit\lib\site-packages\html5lib-0.999-py3.6.egg-info'

keras, tensorflow-gpu 를 설치합니다.

pip install keras tensorflow-gpu

CUDA가 설치되어 있지 않으면 에러가 발생합니다.

ImportError: Could not find 'cudart64_80.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 8.0 from this URL: https://developer.nvidia.com/cuda-toolkit

cuda 설치

https://developer.nvidia.com/cuda-toolkit 에서 CUDA 를 받아서 설치합니다.

플랫폼을 선택합니다.

Windows, x86_64, 10, exe(local)로 선택하면 아래와 같은 내용을 볼 수 있습니다. (다운로드 받는 시점에 따라 버전 정보는 변경될 수 있습니다.)

Download 버튼을 눌러 다운로드를 시작합니다.

cuDNN dll 파일이 없으면 다운로드 받습니다.

You may install the necessary DLL by downloading cuDNN 6 from this URL: https://developer.nvidia.com/cudnn

cuDNN v6.0을 다운로드 압축을 풀어놓습니다.

cuda/bin 의 경로를 환경변수 path 에 추가합니다.

그 후 명령 프롬프트를 새롭게 실행합니다. python 을 실행하고 아래 코드를 입력합니다.

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

device 결과를 확인할 수 있습니다.

>>> from tensorflow.python.client import device_lib
>>> print(device_lib.list_local_devices())
2017-12-24 16:53:19.759524: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1030] Found device 0 with properties:
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.8475
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 5.01GiB
2017-12-24 16:53:19.759821: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1120] Creating TensorFlow device (/device:GPU:0) -> (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 5930639541858223113
, name: "/device:GPU:0"
device_type: "GPU"
memory_limit: 5061826969
locality {
  bus_id: 1
}
incarnation: 11986973785329103856
physical_device_desc: "device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1"
]

 

 

 

 

댓글