ubuntu16.04 + GTX1060 + CUDA9.0 + CUDANN7.0 tensorflow (GPU) installed, the measured effective installation package I put a cloud dish, direct download.

In recent run some semantic segmentation code, many of which were versions of the GPU, and that they install it, record it, began wrong many times, the last reference to some articles, find this version of the problem is very important, I use what version cuda9 .0 + cudann7.0 + tensorlow-gpu == 1.7, we hope to help newcomers. I refer to the tutorial below:
ubuntu16.04 tensorflow1.5-GPU + + + cuda9.0 cudnn
import tensorflow: ImportError: libcublas.so.9.0: can not open shared object file: No such file or director
see to see Nvidia CUDA version and cuDNN
CUDA and cuDNN uninstall an update
that is I downloaded the corresponding version of the installation package can be downloaded directly from the cloud disk:
[installation package Baidu cloud Share] link: https://pan.baidu.com/s/1eDVLkoUaQ6pLM8a0KiWs0w
extraction code: 15yv
installation What is the problem, you can leave a message exchange
consists of the following steps:
1. disable nouveau
2. delete the original version of nvidia, nvidia install the new version
3. uninstall the original cuda, installation cuda9.0
4. uninstall the original cudann, installation cudann7. 0.5
5. installation 1.7.0 tensorflow

1. disable nouveau
first run the following code to see if the output.

lsmod | grep nouveau

If there is an output terminal, then prove that the drive is running, you need to manually ban nouveau, if you have run the following command

sudo gedit /etc/modprobe.d/blacklist-nouveau.conf 

Add the following code in the text:

blacklist nouveau
options nouveau modeset=0

Execute the following statement to update

sudo update-initramfs -u

And then execute the following statement to view the nouveau disable a result, no information output specification is disabled success, there are still information output, you can restart.

lsmod | grep nouveau

2. Delete the original nvidia version, install the new version of nvidia
about the implementation of the delete command

sudo apt-get remove –purge nvidia

Install the new NVIDIA drivers, I installed the 384

sudo apt-get install nvidia-384

Enter the following code to see if the installation was successful

nvidia-smi

Here Insert Picture DescriptionThe above graphics card information, the installation is successful, otherwise the restart, and then execute the code above to see whether successful.
3. Install cuda
here if installed the wrong version, you need to uninstall the wrong version, the version must correspond .
Execute the following command to enter the cuda installation folder, if the installation is 9.0, other version 9.0 installed into the other:

cd  /usr/local/cuda-9.0/bin

Execute the following command to uninstall cuda

sudo ./uninstall_cuda_9.0.pl
sudo rm -rf /usr/local/cuda-9.0

cuda official website to download the corresponding version here
Here Insert Picture Description I downloaded version is .run, as
Here Insert Picture Descriptionfile to download .run folder, execute the following command

sudo sh cuda_9.0.176_384.81_linux.run

And then out the installation process, press enter up to 100%
and enter:
Accept
n-(this does not install the graphics driver already installed)
Y
Y
Y
until the final installation is complete, configure the environment variables

sudo gedit  ~/.bashrc

Writes the following environment variables in the file:

export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

After saving effect immediately execute the following command:

source ~/.bashrc

Execute the following command to view cuda install version:

nvcc -V

Show as follows:
Here Insert Picture Description
the installation was successful version 9.0
4. Install cudann
installed the wrong version, uninstall the wrong version of cudann, execute the following command:

sudo rm -rf /usr/local/cuda/include/cudnn.h
sudo rm -rf /usr/local/cuda/lib64/libcudnn*

Then go to the official website to download cudann, we must remember the corresponding version, I downloaded 7.0, remember not higher than 7.1, 7.1 and I tried does not work, the best 7.0 of
this official website to download cudann, but needs its own register an account, you do not want to register account I cuda9.0, corresponding cudann put my Baidu cloud disk can be downloaded directly.
First download the file into the folder Unzip the downloaded file, and then execute the code installed cudann

sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

Then check cudann installed version, execute the following command:

cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

Here Insert Picture Description
My version is 7.0.5
5. Install tensorflow 1.7.0 (do not install the version of the otherwise too prone to error)
first uninstall the CPU version of the original installation, execute the following code;

Installation tensorflow execute the code, if tensorflow previously installed, you can uninstall the original version of the CPU.

sudo pip uninstall tensorflow

Uninstalled gpu version can be installed, and execute the following code;

sudo pip install tensorflow-gpu==1.7.0

After waiting for a successful installation, enter the code to verify success.

python
import tensorflow as tf

Here Insert Picture Description
No problems should be successful.

Guess you like

Origin blog.csdn.net/weixin_42535742/article/details/89501857