Windows10 and Ubuntu16.04 dual system installation and configuration tensorflow-gpu version

Reference link: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

Windows10

1. Install Anaconda, open Anaconda Prompt, and enter the following to install the GPU version of tensorflow

pip install tensorflow-gpu

Go to the NVIDIA official website to download the corresponding version of the graphics card driver:
http://www.nvidia.com/Download/index.aspx?lang=en-us

2. Download the corresponding CUDA (Compute Unified Device Architecture), a general-purpose parallel computing architecture launched by NVIDIA, which includes an SDK (software development kit) for general-purpose computing using GPU resources. The address to download the CUDA version is: https://developer.nvidia.com/cuda-downloads , be sure to download the CUDA version supported by tensorflow-gpu, here I downloaded tensorflow-gpu r1.7, the corresponding CUDA version is 9.0, neither high nor low. If the version is downloaded incorrectly, such as version 9.1, the uninstall method is also very simple. Open the "Control Panel" and uninstall all programs related to NVIDIA and 9.1. At this time, cuda9.1 and environment variables will be completely uninstalled.

3. Install CUDA 9.0 , download it in exe format, such as cuda_9.0.176_win10.exe, double-click to install, during the installation process, the environment variables will be automatically added, after the installation, check whether the installation is successful:
Method 1: in the command Enter the line to see the CUDA version:

C:\Users\Administrator>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Sep__1_21:08:32_Central_Daylight_Time_2017
Cuda compilation tools, release 9.0, V9.0.176

Method 2: Open the NVIDIA Control Panel to check the CUDA version supported by the graphics card, "Desktop" → "Right-click" → "NVIDIA Control Panel", select "Help" → "System Information" → "Components" on the taskbar
write picture description here

4. Download cuDNN . Compared with standard cuda, cuDNN is specially optimized for performance of neural network operations, such as convolution, pooling, normalization and activation layers. Most deep learning frameworks use cuDNN to drive GPU computing. Download address: https://developer.nvidia.com/cudnn , but you need to register an account before downloading. You need to select the cuDNN corresponding to the CUDA9.0 version, and the cuDNN version should also correspond to tensorflow. For example, tensorflow1.7 corresponds to cuDNN 7.0.X. I learned from the error message.
write picture description here

5. The downloaded cuDNN is actually just a few files, just copy these files to the CUDA folder. The
write picture description here
left side is the downloaded cuDNN folder, and the right side is the CUDA installation directory. Put the contents in the left folder. Go to the corresponding folder on the right.

Ubuntu16.04 installation

1. Download and install the graphics card driver:
I use a GTX 1080 GAMING BOX from Gigabyte, so I need to install the game box driver first, please
refer to the following link:
Install the driver for the external graphics card box: https://egpu.io/forums/thunderbolt -linux-setup/egpu-in-linux-has-anyone-here-gotten-it-to-work/#post-24877Total
process: https://zhuanlan.zhihu.com/p/33811068External
graphics card box driver After the installation is successful, the graphics card box will be lit.
First confirm the graphics card driver version:

sudo ubuntu-drivers devices

write picture description here

You can go to the official website to download the driver run file: download address: http://www.nvidia.com/Download/index.aspx?lang=en-us .
You need to enter the command line interface to install, because to avoid the X server, click ctrl+AIt+F1 to enter:

sudo service lightdm stop #关闭图形界面
chmod u+x NVIDIA-Linux-x86_64-390.48.run  # 修改驱动run文件为可执行权限
sudo ./NVIDIA-Linux-x86_64-390.48.run 
'''
NVIDIA-Linux-x86_64-390.48.run命令后可加如下参数:
-no-opengl-files:只安装驱动文件,不安装OprnGL文件
-no-x-check:安装驱动时不检查X server
-no-nouveau-check:安装时不检查nouveau
'''
reboot  # 重新启动

2. CUDA download and installation You
need to enter the command line interface to install, because to avoid the X server, click ctrl+AIt+F1 to enter:

sudo service lightdm stop  
chmod u+x cuda_9.0.176_384.81_linux.run  # 修改CUDA安装run文件为可执行权限
sudo ./cuda_9.0.176_384.81_linux.run
reboot  # 重新启动

Then accept or y all the way until Install CUDA9.0 Samples? Choose n because we don't write code directly in CUDA. The downloaded CUDA is installed to the /usr/local/CUDA-9.0/ folder by default.

2. To install cuDAA, you need to register before downloading. Download the following three:
write picture description here
Install the downloaded deb package:

sudo dpkg -i libcudnn7_7.0.4.11-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.0.4.11-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-doc_7.0.4.11-1+cuda9.0_amd64.deb

3. Configure environment variables in the .bashrc (/home/winycg/.bashrc) file. Enter the following command in the terminal to edit the .bashrc file:

gedit .bashrc

Enter environment variables:

export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:/usr/local/cuda-9.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda-9.0
export PATH=/usr/local/cuda-9.0/bin:$PATH

Enter the following command to make the environment variable take effect:

source .bashrc

4. Test if the GPU is available.

$cp -r /usr/src/cudnn_samples_v7/ $HOME   # 复制文件夹到home
$ cd  $HOME/cudnn_samples_v7/mnistCUDNN
$make clean && make  # 编译mnistCUDNN sample
$ ./mnistCUDNN  # Run the mnistCUDNN sample.

If cuDNN is successfully installed, it displays:

Test passed!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325370897&siteId=291194637