[Windows] Tensorflow & Keras 사전 준비
1. CUDA Toolkit 설치 (Base: 10.1)
2. cuDNN 설치 (Base: 10.1)
1. CUDA Toolkit 설치(10.1)
CUDA Toolkit 10.1 update2 Archive
Select Target Platform Click on the green buttons that describe your target platform. Only supported platforms will be shown. Operating System Architecture Distribution Version Installer Type Do you want to cross-compile? Yes No Select Host Platform Click
developer.nvidia.com
해당 URL에 들어간다.
아래와 같이 선택하고 Legacy Releases를 클릭한다.
Category | 선택 |
Operating System | Windows |
Architecture | x86_64 |
Version | 10 |
Installer Type | exe(local) |
CUDA Toolkit 10.1을 클릭 후 download 진행한다.(앞에 선택 참고)
추가로 CUDA Toolkit 10.0 도 받는다. (밑에 설명할 오류가 발생하기 때문이다.)
2. cuDNN (cudnn-10.1)설치하기
https://developer.nvidia.com/rdp/cudnn-archive
cuDNN Archive
NVIDIA cuDNN is a GPU-accelerated library of primitives for deep neural networks.
developer.nvidia.com
로그인을 진행하면 download 진행된다.
3. 설치하기
1) cuda 설치하기
cuda_10.1.105_418.96_win10를 먼저 설치하고 cuda_10.0.130_411.31_win10.exe를 설치한다.
설치가 완료되면 다음 파일을 copy한다. (from v10.0 to v10.1)
v10.0 | v10.1 |
cudart64_100.dll | copy 위치 |
2) cudnn 설치하기
cudnn-10.1-windows10-x64-v7.6.5.32.zip의 압축을 풀다.
bin, include, lib를 모두 선택한다.
cuda가 설치된 Floder에 붙여넣는다.(C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1)
4. 환경변수 설정
path
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include
참고
https://www.tensorflow.org/install/gpu#software_requirements
GPU support | TensorFlow
Note: GPU support is available for Ubuntu and Windows with CUDA®-enabled cards. TensorFlow GPU support requires an assortment of drivers and libraries. To simplify installation and avoid library conflicts, we recommend using a TensorFlow Docker image with
www.tensorflow.org
5. GPU 사용 확인
설치 전
import tensorflow as tf
hello = tf.constant('hello')
sess = tf.Session()
print(sess.run(hello))
2020-02-01 16:16:40.688461: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
b'hello'
설치 후
import tensorflow as tf
hello = tf.constant('hello')
sess = tf.Session()
print(sess.run(hello))
※ 오류 1
C:\Users\mellowlee\python_project\venv\Scripts\python.exe C:/Users/mellowlee/Project_Python_Pycharm01/sample/util.py
2020-02-01 16:53:32.153697: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
solution
cudart64_101.dll이 없다는 것이고 cuda10.1 버전을 받으면 될것 같다.
1) 받아서 설치(cuda10.1 설치)
CUDA Toolkit 10.1 original Archive
Select Target Platform Click on the green buttons that describe your target platform. Only supported platforms will be shown. Operating System Architecture Distribution Version Installer Type Do you want to cross-compile? Yes No Select Host Platform Click
developer.nvidia.com
2) cudart64_101.dll copy
참고
How to resolve TensorFlow 2.0 Error – Could not load dynamic library ‘cudart64_100.dll’ – Jozef Jarosciak Blog
Recently I came across an issue while building ANN with TensorFlow 2.0, where IntelliJ complained about not being able to load the dynamic library ‘cudart64_100.dll’. The below instructions outline the approach for fixing the issue and would apply also to
www.joe0.com
오류 2
2020-02-01 18:14:31.298078: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1651] Ignoring visible gpu device (device: 0, name: GeForce GTX 760, pci bus id: 0000:01:00.0, compute capability: 3.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
2020-02-01 18:14:31.298599: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-02-01 18:14:31.299583: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-02-01 18:14:31.299806: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]
그래픽 카드의 성능이 떨어져서 tenforflow를 사용할 수 가 없다는 내용이다.
3.5 이상은되어야 사용가능하다.
그래픽 성능표
https://developer.nvidia.com/cuda-gpus
CUDA GPUs
Recommended GPU for Developers NVIDIA TITAN RTX NVIDIA TITAN RTX is built for data science, AI research, content creation and general GPU development. Built on the Turing architecture, it features 4608, 576 full-speed mixed precision Tensor Cores for accel
developer.nvidia.com