Install Cuda under Ubuntu (install: nvidia-384+cuda9.0+cudnn7.1)

Source: Internet
Author: User
Tags cuda toolkit nvcc gtx

(Installation: nvidia-384+cuda9.0+cudnn7.1)

Graphics (GPU) driver: NVIDIA-384

cuda:cuda9.0

cudnn:cudnn7.1

The installation of Cuda under Ubuntu requires NVIDIA driver, first enter the Nvidia official website, and then query the corresponding NVIDIA driver support your computer model.

Here My computer is: Asus F450J, comes with Nvidia GEFORCE 745.

first step, install nvidia GPU drivergo to NVIDIA website to find out if the GPU supports my computer as follows

As you can see:GeForce 700M Series (notebooks):

GeForce GTX 780M, GeForce GTX 770M, GeForce GTX 765M, GeForce GTX 760M, GeForce GT 755M, GeForce gt 750M, GeForce GT 7 45M, GeForce gt 740M, GeForce GT 735M, GeForce GT 730M, GeForce GT 720M, GeForce gt 710M, GeForce 720M, GeForce 710M, GeForce 705M

GeForce GT 745M is the model of my computer, so version:390.48 is supported by my NVIDIAGPU driver.

So the second part we install NVIDIA DISPLAY DRIVER version:390.48 executes the following code:

The first part:Install subsequent steps or dependencies required by the environment
1 sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf- compiler    2 3 sudo apt-get install--no-install-recommends libboost-all-dev   45 sudo Apt-get Install Libopenblas-dev liblapack-dev libatlas-base-Dev   67 sudo apt-get Install Libgflags-dev libgoogle-glog-dev liblmdb-Dev   89 sudo apt-get install Git cmake build-essential

Enter this code to output the following information to indicate that the dependent environment was successfully installed

Code

1

Show:

1 Reading Package Lists ... Done2 Building Dependency Tree3 Reading State information ... Done4Build-essential isAlready the newest version (12. 1ubuntu2). 5CMake isAlready the newest version (3.5.1-1ubuntu3).6Git isAlready the newest version (1:2.7.4-0ubuntu1.3). 70 upgraded, 0 newly installed, 0 to remove and126 notUpgraded.

Indicates a successful installation of the dependent environment

Part II: Installation of the display driver

Go to the official website to download the NVIDIA graphics card (GPU) driver and run it. or run directly on the terminal, execute the following code.

sudo apt-get update sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt-get update sudo apt-get install nvidia-384< C6/>sudo apt-get Install mesa-common-dev sudo apt-get install Freeglut3-dev  

Restart the system after execution is complete

sudo reboot  # or sudo shutdown-r now

Detect if installation display driver is successful after boot

Nvidia-settings  # or just click on the dash Start interface to enter Nvidia view

Displays the following information indicating that the installation was successful

Configuring Environment variables

sudo gedit ~/.BASHRC

Add the following two lines to the. BASHRC

Export ld_library_path=/usr/lib/x86_64-linux-GNU: $LD _library_path export Ld_library_path=/lib/x86_64- Linux-gnu: $LD _library_path
Step two, install Nvidia CUDAFirst part, the Cuda Toolkit download interface which first enters Nvidia official website

Download Cuda Toolkit as shown in

Note: This place hints that to install this Cuda Toolkit 9.1, you need to install at least nvidia DISPLAY DRIVER R390 version 3.90 above.

CUDA Toolkit

After downloading the Cuda Toolkit9.1, execute the following code to install it (there is no need to install OPGL here), the code is as follows:

1 sudo sh cuda_9.0.176_384.81_linux.run--no-opengl-libs    #

Output display:

1 Do you accept the previously read EULA?2accept/decline/quit:accept3Install NVIDIA Accelerated Graphics Driver forLinux-x86_64 384.81? 4(y) es/(n) o/(q) uit:n5Install the CUDA 9.0Toolkit?6(y) es/(n) o/(q) uit:y7 Enter Toolkit Location8[Default is/usr/local/cuda-9.0 ]:  9Want to install a symbolic link at/usr/local/Cuda?Ten(y) es/(n) o/(q) uit:y OneInstall the CUDA 9.0Samples? A(y) es/(n) o/(q) uit:y - Enter CUDA Samples Location -[Default is/home/Pertor]: theInstalling the CUDA Toolkitinch/usr/local/cuda-9.0 ...  -Missing Recommended library:libXmu.so

To add an environment variable:

sudo gedit ~/. Bashrcexport PATH=/usr/local/cuda-8.0/bin: $PATHexport ld_library_path=/usr/local/ cuda/~/.BASHRC

Verify that the CUDA9.0 is installed successfully

cd/usr/local/cuda-8.0/samples/1_utilities/Devicequerysudo make. /devicequery

The output of the following information indicates a successful installation

./Devicequery Starting ... CUDA Device Query (Runtime API) version (Cudart static linking) detected1CUDA capable device (s) device 0:"GeForce GT 740M"CUDA Driver Version/Runtime Version 8.0/8.0CUDA Capability Major/minor version number:3.5Total amount ofGlobalmemory:2004 MBytes (2100953088bytes) ( 2) multiprocessors, (192) CUDA cores/mp:384CUDA cores GPU Max Clock rate:1032 MHz (1.03GHz) Memory Clock Rate:800Mhz Memory Bus Width:64-bit L2 Cache Size:524288bytes Maximum Texture Dimension Size (x, Y, z) 1D= (65536), 2d= (65536, 65536), 3d= (4096, 4096, 4096) Maximum layered 1D Texture Size, (num) layers 1D= (16384), 2048 layers
Step three, install Nvidia CuDNN

Login website Download CUDNN

This need to apply for an account, registered to enter the official website, as shown in

CuDNN's full name is the NVIDIA CUDA? The deep neural Network Library, which is specifically designed to accelerate the depth of learning, supports CAFFE2, MATLAB, Microsoft cognitive Toolkit, TensorFlow, Theano and Pytorch, etc. Accelerated optimization of deep learning, the latest version is CuDNN 7.1, and then we'll look at how it's installed.  

Download Link:https://developer.nvidia.com/rdp/cudnn-download, need to register to open, here we choose Cudnn v7.1.1 (Feb, 2018), for CUDA 9.0, then select CuDNN v7.1.1 Library for Linux:

After downloading, unzip the installation and perform the following steps:

1 tar-zxvf cudnn-9.0-linux-x64-v7.123 sudo cp cuda/lib64/libcudnn*/usr/local/ cuda/lib64/-4 sudo chmod a+r/usr/local/cuda/include/5

After the execution of the above command, CuDNN is installed, we can find in the/usr/local/cuda/include directory is more cudnn.h header file.  

Execution nvcc-v in terminal displays the following information indicating success

NVCC-v[email protected]-computer:~$ NVCC-V  2005-2017 NVIDIA Corporation Built on Fri_sep__1 _21:08

Tips:

It is not recommended to install Cuda 9.1, it is recommended to install Cuda version 9.0. Cuda 9.1 Inside with 387 Drive, but the general Cuda 9.1 comes with the driver generally difficult to install a successful, so it is recommended to install a separate 384 display driver. And the official website indicates that CUDA9.1 needs a graphics card driver must be at least 390, so the installation of the 384 graphics driver requires the installation of CUDA9.0.

For the sake of insurance we should be Cuda 9.0 and nvidia-384 this version.

Install Cuda under Ubuntu (install: nvidia-384+cuda9.0+cudnn7.1)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.