After setting up the environment for almost two days, I finally got better. Although at the beginning, I installed and unloaded, but! ! ! After the installation is successful, that kind of happiness is beyond words~~~~~ So here I must record my hard journey~~~~
1. Identify the adapted version of cuda for your computer
Before that, you need to have VS installed on your computer , here is a direct connection to Baidu Cloud:
Link: https://pan.baidu.com/s/1M94HKU6O47G7SGq8xYS6Pg
Extraction code: 9ofd
How to determine your computer model:
Right click on My Computer -> click on properties -> system -> enter the device manager -> find the display adapter:
The box in the picture below is my nvidia model
Then you need to find out which cuda corresponds to your version
Check if there is an NVIDIA control panel on your computer. If not, you'd better install one (provided that your computer has an n card)
Use the driver wizard to see if there is an NVIDIA driver (driver wizard installation package link: https://pan.baidu.com/s/12AjwmiTpT50k6wNGj4CcbQ
extraction code: wka0)
Use the driver wizard to check whether your NVIDIA driver is up to date, it is best to upgrade
If it is the latest one, open the NVIDIA control panel——>set physx configuration——>components, you can see NVIDIA.DLL, and the following is the version you should install
2. Download the corresponding version of cuda, cudnn
(Cuda and cudnn version and corresponding version patch)
Baidu Cloud: Link: https://pan.baidu.com/s/195x-Vn2-_HtI54M93cvJTQ Extraction code: kqcr
Download the corresponding version of cuda
cuda download link: https://developer.nvidia.com/cuda-toolkit-archive
cudnn download address: https://developer.nvidia.com/rdp/cudnn-download (you need to register first when downloading)
Three, install cuda, cudnn
Install cuda after downloading:
You can refer to: https://blog.csdn.net/u013165921/article/details/77891913
The installation is very simple, agree and continue, keep going, the environment I chose is custom installation.
After installation, the control panel will see:
Then decompress the cudnn corresponding to cuda:
Move the above files to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 under your cuda installation directory
So even if cuda and cudnn are completed
4. Check whether CUDA and CUDNN are installed successfully
win+R——>Enter nvidia-smi——>nvcc -V and the following appears:
(Most of the situation is fine, but when I installed it for the first time, it was the same, but the DLL error was reported, which was very annoying)
So in order to accurately confirm whether it is really installed:
cd to the root directory -> in cd C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\extras\demo_suite -> enter deviceQuery.exe and bandwidthTest.exe respectively
The best thing to see is pass, then CUDA and CUDNN are installed.
Five, install TensorFlow-GPU version
Ok, after installing cuda, it's time to install the TensorFlow-GPU version
Mine is in anconda3 + python3.6.2 + tensorflow-gpu 1.13.1 version
# 创建一个名为tensorflow-py36的环境,指定Python版本是3.6)
conda create --name tensorflow-py36 python=3.6
# 安装好后,使用activate激活某个环境
activate tensorflow-py36 # 即系统已经切换到了3.4的环境
# 进行tensorflow的安装(刚刚弄的环境的话, pip最好升级一下啊!!)
pip install tensorflow-gpu==1.13.1
# 退出tensorflow-py36环境
deactivate tensorflow-py36
# 删除tensorflow-py36环境
conda remove --name tensorflow-py36 --all
As follows, it should be fine without reporting errors, but! ! ! When I installed it once, the import was good, but an error occurred when I ran the code! ! ! , Can't find the method in TensorFlow. . . . . . . . . . . .
The possible error at this time is that your project name is the same as TensorFlow~~~~ (it is possible here!!!)
So in order to be truly sure, tensorflow is really installed, let's test it with a code:
Test tensorflow code:
# -*- coding: utf-8 -*-
# !/usr/bin/env python
# @Time : 2019/5/7 17:19
# @Author : xhh
# @Desc :
# @File : tensor_tf.py
# @Software: PyCharm
import numpy as np
import tensorflow as tf
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[ 2.]])
product = tf.matmul(matrix1, matrix2)
print(product)
sess = tf.Session()
There is no error in the code structure~~~~
It’s finally time to witness the results, I’m a little excited~~
Have you seen it? Your gpu information is all there. When I see success, I am really quite happy~~, the feeling of flying, now you can enjoy the thrill of GPU acceleration, very nice ! ! ! !
Here I will write down my installation record. If you have any questions, you can discuss it. I will definitely reply to everyone~~. After all, I have stepped on a lot, hahaha
ps: When I ran the code with the CPU version of tensorflow before, it was really slow,,, now it’s good, it’s very fast~~~
You can pay attention to the official account of my friend and me~~~ Here are some python technical information that my friend and I update from time to time! ! I hope you can support me and pay attention to it. Thank you everyone~~