[PYTHON] What to do to get tensorflow-gpu to work

at first

After initializing the computer, I had to re-install various things to run tensorflow with gpu. Then I stumbled on various things, so make a note to put it back in the future.

environment

windows10 RTX2070 Ryzen 3700x Anaconda

Path

Download Anaconda Creating an environment Understanding tensorflow dependencies download cuda Download cuDNN path

version

It seems that the writing style has changed considerably from 1.x to 2.x in 2019. Therefore, it seems that some programs on the net do not work. Therefore, create two environments, one with the latest version of 2.x and the other with the latest version of 1.x.

2.x

Python3.7 tensorflow-gpu==2.4.0 cudnn8.0.5 cuda11.0 keras-2.4.3

Environment creation

https://qiita.com/ozaki_physics/items/985188feb92570e5b82d There is a way to create an environment.

Conda create -n 37tens24 python=3.7 anaconda

Understanding version

Next, grasp the dependency environment of tensorflow https://www.tensorflow.org/install/source_windows?hl=ja Because there was no latest version, and sometimes it was wrong

https://www.kkaneko.jp/tools/win/keras.html

I confirmed here Also, basically you can follow this site In the latest version, keras seems to have no dependency

pip install tensorflow-gpu==2.4.0
pip install keras

cuda toolkit

https://developer.nvidia.com/cuda-toolkit-archive Download from here

Download 11.0 It is better to download the local one in consideration of starting over (about 500MB)

Run Download everything at first

https://www.kkaneko.jp/tools/win/cuda.html Here is detailed

cudnn

Detailed explanation https://www.kkaneko.jp/tools/win/cudnn805.html

https://developer.nvidia.com/cudnn Download from here And defrost

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0 Think about trying again, back up this, and then copy and paste the decompressed contents

Add path

___ System ___ environment variable name CUDNN_PATH value C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0 Set like (from administrator)

Note that you need to open it as an administrator to change system environment variables.

https://www.lisz-works.com/entry/sys-env-admin

Administrator powershell from right click on Windows mark

Start C:\Windows\system32\rundll32.exe sysdm.cpl, EditEnvironmentVariables

Now you can use everything.

1.x

37tens115 tensorflow_gpu-1.15.0 It doesn't work with Cudnn 7.4.2, so 7.6.5 Cuda10.0 Keras2.3.1 The latest version of Keras doesn't work with TensorFlow 1.15. Install Keras version 2.3.1

For the second and older version, cuda image.png This is all you need

This site is detailed https://www.kkaneko.jp/tools/win/cuda.html

image.png

Cudnn_path stayed at 11 and worked

Summary

It doesn't go smoothly and it's difficult, so please do your best.

Recommended Posts

What to do to get tensorflow-gpu to work
What to do if rails s doesn't work
What to do if atom autocomplete-python doesn't work
What to do to get google spreadsheet in python
What to do when Ubuntu crashes
What to do if yum breaks
What to do if you get "coverage unknown" in Coveralls
What to do with PYTHON release?
What to do if Python doesn't work on Git for Windows
What to do if you get a minus zero in Python
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1
What to do when you get "I can't see the site !!!!"
What to do after installing Linux (Ubuntu)
Let's summarize what you want to do.
What to do if you get lost in file reference with FileNotFoundError
What to do if you get angry in TensorFlow v2 without attribute'app'
What to do if you get stuck during Anaconda installation on Linux
What to do if you get a TypeError with numpy min, max
What to do if you get an error when trying to load mnist
What to do if you get Could not fetch URL 443 with pip
Notes on what to do when matplotlib scatter () / scatter3d () does not work
What to do if you get an error when installing Dlib (Ubuntu)
What to do if pipreqs results in UnicodeDecodeError
What to do if you can't pipenv shell
[Python] What I did to do Unit Test
Note: What to do if pip install fails
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if pip cannot be installed
What to do when PermissionError of tempfile.mkstemp occurs
What to do if Docker-sync suddenly stops working
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
Create a command to get the work log
Example of what to do when the sample script does not work (OpenCV-Python)
What to do if you get a "No versions found" error in pipenv
What to do if you get angry with swapon failed: Operation not permitted
Let's Encrypt updated! What to do if the certbot renew command doesn't work
What to do if scrapy doesn't work after installing scrapy with pip on mac
What to do if you get an error when installing python with pyenv
What to do if you get "Python not configured." Using PyDev in Eclipse
What to do if you get an "unknown service" error from your gRPC server
What to do if pip install fails in Xcode 5.1
[Go 1.13] What to do when unexpected directory layout: appears
[openpyxl] What to do when IllegalCharacterError appears in pandas.DataFrame.to_excel
UnicodeDecodeError: What to do when'shift_jis' codec can't decode byte
curl: (60) What to do when Issuer certificate is invalid.
What to do when python3 type venv does not work well on Raspberry Pi
What to do if you get an OpenSSL error when installing Python 2 with pyenv
No module named What to do if you get'libs.resources'
ModuleNotFoundError: No module What to do if you get'tensorflow.contrib'
What to do if SciPy installation fails on CentOS
What to do when gdal_merge creates a huge file
What to do when raise ValueError, "unsupported hash type"
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
Links to do what you want with Sublime Text
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if a UnicodeDecodeError occurs in pip
What to do if Sort imports get stuck in VS Code's Python Extension (around 2020/09)
[Deep Learning Association E Qualification] What to do to receive
What to do when "cannot import name xxx" [Python]
pipenv shell is no longer available ... what to do?
What to do if pip install fails to install dependent libraries