[PYTHON] Building a TensorFlow environment that uses GPU on Windows 10

Building a TensorFlow environment that uses GPU on Windows

I built an environment to run TensorFlow with Python using Anaconda and spyder Basically, I refer to the following [Intelligent Curiosity How to Use tensorflow-gpu on Windows 10](https://intellectual-curiosity.tokyo/2019/06/17/windows-10%E3%81%A7tensorflow-gpu%E3%82%92% E4% BD% BF% E3% 81% 86% E6% 96% B9% E6% B3% 95 /)

PC environment

What to use

Precautions when setting the environment

Depending on the version of each package, it may not recognize the GPU. Be sure to check the version to install from this table

Installation of Anaconda

  1. Anaconda Download Page Download the Python 3.7 Windows installer from
  2. Start the installer, agree to the terms and specify the installation destination, and install

Reference: Install Pythonjapan Windows version

Install Cuda Toolkit

This page is used as a reference. You need to install Microsoft Visual Studio in advance.

  1. Download the Toolkit from the CUDA installation page (https://developer.nvidia.com/cuda-toolkit-archive) --Click CUDA Toolkit 10.0 and select [Windows]-[x86-64]-[10] (The last version is the version of Windows)
  1. Install from the downloaded installer --Agree to the terms and select the installation destination --Choose a custom option --Install according to the installer (I think there is no problem with the basic "Next")
  2. Check environment variables --Control Panel-> System and Security-> System-> Advanced System Settings-Select Environment Variables --Make sure the system environment variables are: CUDA_PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 --Also check that the Path value of the user environment variable has the following: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\CUPTI\lib64
  3. Check where nvcc passes at the command prompt If the installation is successful, the path of the cuda exe file will be displayed.

cuDNN installation

  1. File download -Go to Download Page --Registration as you will be required to register as a member of Nvidia Developer --Go to the download page again and download the version you want to install
  2. Download file adaptation --The Zip file will be downloaded, so unzip it with the extraction software. --Since the same folder exists in the folder where CUDA is installed (C: \ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v10.0), copy the downloaded folder to CUDA. --Add the following to your system environment variables CUDNN_PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0

Install tensorflow-gpu

This page is used as a reference. It is recommended to build a virtual environment because tensorflow using cpu and tensorflow-gpu conflict and are compatible depending on the version.

  1. Create a virtual environment for Anaconda --Open anacondaPrompt and build a virtual environment with commands
> conda create -n [Environment name] python=3.6 anaconda
> activate [Environment name]
  1. Install tensorflow-gpu in the created virtual environment Execute the following command -[version] enter the version you want to install
> pip install tensorflow-gpu==[version]
  1. Test Execute the following command to start spyder
> spyder

Do the following on Spyder

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

Success if device_type: "GPU" is displayed at the bottom of the output

reference

Intellectual Curiosity How to use tensorflow-gpu on Windows 10: https://intellectual-curiosity.tokyo/2019/06/17/windows-10%E3%81%A7tensorflow-gpu%E3%82%92%E4% BD% BF% E3% 81% 86% E6% 96% B9% E6% B3% 95 /

Pythonjapan Windows version installation: https://www.python.jp/install/anaconda/windows/install.html Installing NVIDIA CUDA Toolkit 10.1 (on Windows): https://www.kkaneko.jp/tools/win/cuda.html GPU version TensorFlow environment construction (Windows 10): http://tecsingularity.com/cuda/tensorflowenv/

Recommended Posts

Building a TensorFlow environment that uses GPU on Windows 10
I built a TensorFlow environment on windows10
[Tensorflow] Tensorflow environment construction on Windows 10
Procedure for building a CDK environment on Windows (Python)
Building a Python environment on Mac
Create a Linux environment on Windows 10
I tried to create a server environment that runs on Windows 10
Run TensorFlow on a GPU instance on AWS
Building a LaTeX environment on Chrome OS
Creating a python virtual environment on Windows
Building an environment to run ChainerMN on a GPU instance on AWS
Building an environment for "Tello_Video" on Windows
Everything from building a Python environment to running it on Windows
Try Tensorflow with a GPU instance on AWS
Building an environment that uses Python in Eclipse
Simply build a Python 3 execution environment on Windows
Building a Python environment on a Sakura VPS server
Create a Python virtual development environment on Windows
Build TensorFlow on Windows
A story about building an IDE environment with WinPython on an old Windows OS.
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Create a comfortable Python 3 (Anaconda) development environment on windows
A memo of installing Chainer 1.5 for GPU on Windows
Build a GVim-based Python development environment on Windows 10 (1) Installation
Create a decent shell and python environment on Windows
Build a machine learning environment natively on Windows 10 (x64)
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Build Python environment on Windows
Django environment development on Windows 10
Install Chainer 1.6 (GPU) on Windows 7.
Building a Python virtual environment
Build python environment on windows
Ubuntu14.04 + GPU + TensorFlow environment construction
Building a Python virtual environment
Let's get started with Python ~ Building an environment on Windows 10 ~
Building a python environment for artificial intelligence (Chainer / TensorFlow / CSLAIER)
Building a Jupyter Lab development environment on WSL2 using Anaconda3
Building a Python environment on a Mac and using Jupyter lab
Resolve a Segmentation fault that occurs in Ubuntu 16.04+ Tensorflow environment
Build a GVim-based Python development environment on Windows 10 (2) Basic settings
Precautions that must be understood when building a PYTHON environment
Until building a Python development environment using pyenv on Ubuntu 20.04
Building a kubernetes environment with ansible 2
A memo that reproduces the slide show (gadget) of Windows 7 on Windows 10.
Create a Python environment for professionals in VS Code on Windows
Python environment construction memo on Windows 10
Example of building python development environment on windows (wsl2, vscode, pipenv)
Anaconda python environment construction on Windows 10
Building a Windows 7 environment for getting started with machine learning with Python
Install python2.7 on windows 32bit environment
Building a Python development environment on Windows -From installing Anaconda to linking Atom and Jupyter Notebook-
Create a Python environment on Mac (2017/4)
Run Tensorflow natively supported on windows
Building a virtual environment with Python 3
Create a python environment on centos
Use Tensorflow 2.1.0 with Anaconda on Windows 10!
When creating an environment that uses python django on Ubuntu 12.04 LTS
(Note) Notes on building TensorFlow + Flask + Nginx environment with Docker Compose
Run TensorFlow2 on a VPS server
Install Python development environment on Windows 10
Building a development environment with Maven on Google App Engine [Java]