This section provides details about the depth of the learning environment configuration, Ubuntu 16.04 + Nvidia GTX 1080 + Python 3.6 + CUDA 9.0 + cuDNN 7.1 + TensorFlow 1.6.
Python 3.6
First install Python 3.6, used here Anaconda 3 to install, download address: https://www.anaconda.com/download/#linux , click the Download button to download it, here is the Anaconda 3-5.1 version download, if download speed Tsinghua too slow can choose to use the mirror: https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ .
After a Anaconda3-5.1.0-Linux-x86_64.sh downloaded file will appear in the directory, then you can directly execute the installation:
bash Anaconda3-5.1.0-Linux-x86_64.sh
After finished to go down to complete the installation with default settings.
Here it will be installed by default to the user's home directory, if you want a global installed, you can enter the address you want to install in this step:
Anaconda3 will now be installed into this location:
/home/cqc/anaconda3
- Press ENTER to confirm the location
- Press CTRL-C to abort the installation
- Or specify a different location below
[/home/cqc/anaconda3] >>> /usr/local/anaconda3
PREFIX=/usr/local/anaconda3
Here I've specified install it under / usr / local / anaconda3 directory, global installed, all users share, of course, if users want to use, then this is the default configuration can be.
Add python3 and pip3 after the installation is complete soft links:
sudo ln -s /usr/local/anaconda3/bin/python3 /usr/local/sbin/python3
sudo ln -s /usr/local/anaconda3/bin/pip /usr/local/sbin/pip3
Here is a soft link to add it to / usr / local / sbin directory, and it will exist in the default environment variable, it can be called directly.
Of course, you can choose to add the / usr / local / anaconda3 / bin directory environment variable may be modified ~ / .bashrc file, add the following:
export PATH=/usr/local/anaconda3/bin${PATH:+:${PATH}}
Then execute:
source ~/.bashrc
To take effect the next time will be the default execution ~ / .bashrc file login, it will take effect.
Next we verify under python3, whether pip3 commands from Anaconda, the command is as follows:
pip3 -V
pip 9.0.1 from /usr/local/anaconda3/lib/python3.6/site-packages (python 3.6)
which python3
/usr/local/anaconda3/bin/python3
python3
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 18:10:19)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
If the input command python3 pip3 and similar results as described above can occur, in the path / usr / local / anaconda3, as evidenced by the success of Python 3.
install driver
First, look at what your computer needs drivers, we can go http://www.nvidia.com/Download/index.aspx next query is how we need to drive, here is my card GTX 1080, so in order to an example of this, check the corresponding good configuration:
Click Search, you can see the query results are as follows:
Version: 390.25
Release Date: 2018.1.29
Operating System: Linux 64-bit
Language: English (US)
File Size: 77.48 MB
Here is that we need a version 390.25.
Then if we installed the drive before you can reinstall it, if the current has been installed it would not have had.
If you want to reinstall, you must first uninstall the graphics driver before:
sudo apt-get remove –purge nvidia*
After running some of NVIDIA's driver was uninstalled.
This time nvidia-smi commands can not be used, which proves graphics driver has been uninstalled.
Next, add a source PPA then ordered as follows:
sudo add-apt-repository ppa:graphics-drivers/ppa
Then update the look:
sudo apt-get update
Then re-install the graphics driver:
sudo apt-get install nvidia-390
Note that 390 is just check out our version, check out the actual version shall prevail.
CUDA 9.0
The old version before, if present, can choose to uninstall, and in order to avoid new version of CUDA conflict, there is a uninstallcuda * .pl files in / usr / local / cuda / bin directory, you can directly run the uninstall command as follows:
sudo ./uninstall_cuda_*.pl
This allows you to uninstall all CUDA.
Next we download the CUDA 9.0, attention TensorFlow 1.5 and 1.6 version is still only compatible with CUDA 9.0, is not compatible with CUDA 9.1, so do not download 9.1, CUDA 9.0 download address is: https://developer.nvidia.com/cuda-90 Archive--download , followed by checking the version of the well system shown in FIG:
Here we have chosen Linux-x86_64-Ubuntu-16.04-runfile configuration, and then click the Download button Base Installer section, download the CUDA 9.0 installation package.
Download the corresponding command is:
wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run
Execute this command, wait for the download to complete.
Next to perform the installation, run the following command:
sudo bash cuda_9.0.176_384.81_linux-run
Confirm the installation process need to enter some options, as follows:
Description
The NVIDIA CUDA Toolkit provides command-line and graphical
tools for building, debugging and optimizing the performance
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n
Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /home/cqc ]:
Installing the CUDA Toolkit in /usr/local/cuda-9.0 ...
Finally, if such a prompt appears, as evidenced by the CUDA installed:
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-9.0
Samples: Installed in /home/cqc, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-9.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-9.0/lib64, or, add /usr/local/cuda-9.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-9.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-9.0/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 384.00 is required for CUDA 9.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run -silent -driver
Then we need to configure the environment variables, change the ~ / .bashrc file, add the following lines:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
Implementation of what to take effect after the modification is complete:
source ~/.bashrc
Then we output CUDA_HOME, LD_LIBRARY_PATH you can see the corresponding output:
echo $CUDA_HOME
/usr/local/cuda
echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64
This represents the environment variables into effect, CUDA installation is complete.
cuDNN 7.1
cuDNN's full name is The NVIDIA CUDA® Deep Neural Network library, is designed to accelerate the depth learning library, which supports accelerated optimization Caffe2, MATLAB, Microsoft Cognitive Toolkit, TensorFlow, Theano and PyTorch such as the depth of learning, the latest version is cuDNN 7.1, then we look at its installation.
Download link: https://developer.nvidia.com/rdp/cudnn-download , then you need to register to open, here we choose cuDNN v7.1.1 (Feb 28, 2018) , for CUDA 9.0, and then select cuDNN v7.1.1 Library for Linux, as shown:
After extracting installer can be downloaded:
tar -zxvf cudnn-9.0-linux-x64-v7.1.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/ -d
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
After completion of the implementation of the above command, cuDNN it installed, then we can find in / usr / local / cuda / include directory on more cudnn.h header files.
TensorFlow 1.6
Until now Python 3.6, CUDA 9.0 and cuDNN 7.1 has been installed, and configured the environment variables, then we can be installed directly TensorFlow 1.6, TensorFlow 1.6 version for CUDA 9 and cuDNN 7 is optimized, you can pre Construction of binary files.
Here is TensorFlow need to install the GPU version, the command is as follows:
pip3 install tensorflow-gpu==1.6.0
After the installation is complete, verify:
import tensorflow
If there is no error, it would prove that all environmental configurations are successful.
The above is Ubuntu 16.04 + Nvidia GTX 1080 + Python 3.6 + CUDA 9.0 + cuDNN 7.1 + TensorFlow 1.6 environment configuration process is complete.
Source: Huawei cloud community Author: Cui Shu Jing Qing only seek