Ubuntu18.04 cuda installation difficulties and obstacles and cudnn

After installing the host first described Ubuntu18.04 do not install anything, including graphics driver, cuda graphics card installed inside the drive belt. Direct download cuda10.0 and the corresponding version of cudnn, mainly because at this stage the highest version TensorFlow support cuda10.0 seemingly, does not support cuda10.1 should be installed cuda10.1 run TensorFlow wrong for me. So the back and unload cuda10.1, installation cuda10.0.
First, install the CUDA
1. Download the
official website to download ( CUDA official website )
Drawing a circle where you can view the download previous versionsview download previous versions, go after selecting cuda10.0 download
Here Insert Picture Descriptionand run the package in accordance with the option to download version
Here Insert Picture Description2. Installation
according to Description open a terminal run:

sudo sh cuda_10.0.130_410.48_linux.run

Terminal installation interface appears, the agreement appears, press the Enter key has been running (if you want to see can look down one by one, hee hee ......)
Here Insert Picture Descriptionbecause I have already installed the card, so there I first graphics card chose n, others are y, if your ubuntu is clean, directly select all y. The next step is to wait for the installation was successful! After the write path environment variable is an input terminal (to be in the root directory):

sudo gedit .bashrc

If it is not the root directory, enter:

sudo gedit ~.bashrc

In the write path:

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

Save and exit, restart .bashrc file:

source ~.bashrc

3. Test
the input terminal:

cd /usr/local/cuda/samples/1_Utilities/deviceQuery 
sudo make
./deviceQuery

Appears in Figure indicates the installation was successful:
Here Insert Picture DescriptionSecond, install cudnn
1. Download
cudnn download the corresponding version (cudnn need to log in to download site, you can register by mail, then download the compressed file, as shown in Figure):
Here Insert Picture Description2. Install
directly with Ubuntu Right extract to the current file into the file, open a terminal and run:


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

View CUDNN version in a terminal:


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

Here Insert Picture DescriptionSo far, cuda and cudnn been installed successfully!
Daniel middle reference to a number of blog, in this very grateful! ! !

Released nine original articles · won praise 2 · Views 3088

Guess you like

Origin blog.csdn.net/xiaokan_001/article/details/88126122