The most correct posture to install CUDNN, most of the online tutorials are too pit

Source: Internet
Author: User
Why do I need to install CUDNN

Known as the Nvidia Cuda®deep Neural network library, Cudnn is a GPU-based accelerated library designed specifically for the underlying operations in deep neural Networks . CUDNN provides highly optimized implementations for standard processes in deep neural networks, such as convolution, pooling, normalization, and activation layers forward and back processes.

CUDNN is just one of the accelerated libraries in the Nvidia Deep Neural network software Development Kit. Want to learn more about the Nvidia Deep Neural network acceleration Library in the other packages please poke link https://developer.nvidia.com/deep-learning-software. Each deep learning framework installation CUDNN need to know

Basically all deep learning frameworks support CUDNN, such as Caffe, Caffe2, TensorFlow, Torch, Pytorch, Theano, and so on.

Caffe can modify the corresponding options in the Makefile.config to change whether to compile the cudnn in the process of compiling Caffe, and if it is not compiled CUDNN, it is 3-5 times slower to perform some programs based on the deep learning framework of Caffe. (Caffe official online said not bad how much, obviously poor many well). Caffe to CUDNN version is not very strict, as long as the greater than CUDNN 4 can be.

TensorFlow current version of r1.2, forced to install CuDNN, but also the version of the corresponding restrictions (CuDNN 5.1). However, in the official note, TensorFlow will add support for CUDNN 6.0 in the next version of r1.3.

Torch can automatically detect the CUDNN version of the current system by Luajit to compile accordingly (if there is no cudnn, it can be installed in torch). How to install CUDNN

First of all, the online most Chinese installation cudnn tutorial wrong way, this way really deceptive countless .

simply put, the most wrong way to install CUDNN is to unzip the downloaded CUDNN compressed package. Then copy the CUDNN header file (. h file in the Cuda/include directory) to the include path of the Cuda installation path, and copy the CUDNN library file (all files in the cuda/lib64 directory) to the lib64 path of the Cuda installation path. This method cannot be successfully installed CUDNN if the corresponding symbolic link is not reset cudnn.

Below we say the correct installation Cudnn way , in fact, follow the official installation instructions to install it.

Download the CUDNN corresponding version of the package from HTTPS://DEVELOPER.NVIDIA.COM/CUDNN (you may need to register or log in).

If the compressed package is not in the. tgz format, rename the package to. tgz format. Unzip the current. tgz format of the package to any path in the system (this path is very important, the following is the path of the absolute path abbreviated as/YOUR/PATH/TO/CUDNN), the extracted folder named Cuda, The folder contains two folders: one for include and the other for lib64.
For example: I unzipped this tarball in the/usr/local directory, then the absolute path of the file is/usr/local/cuda

Associate the Lib64 folder in the extracted file to the environment variable . This step is important.

   CD ~
   sudo gedit. BASHRC

In the pop-up gedit document editor (. bashrc), the last line is added :

   Export ld_library_path=/your/path/to/cudnn/lib64: $LD _library_path

where/your/path/to/cudnn/lib64 refers to. tgz the Lib64 folder in the path where the extracted files are located.
After you save the changed file, immediately after:

   source. BASHRC

Restart the terminal (terminal), this step can successfully configure the Cudnn lib file.

The last step in configuring CUDNN is to copy the Cudnn.h file from the Include folder (/your/path/to/cudnn/include) in the extracted Cudnn folder (typically the file named Cuda) to/usr/local/cuda/include, you need to get administrator privileges to perform this operation because the system path is entered.

Open the terminal and enter/your/path/to/cudnn/include. where/your/path/to/cudnn/include refers to. tgz the Include folder in the path where the extracted files are located. For example:

   CD cuda/include
   sudo cp *.h/usr/local/cuda/include/

One of the cuda/include here is/your/path/to/cudnn/include for my own installation. Because I will cudnn. tgz compressed package extracted to the home of the current user's path, the extracted folder named Cuda.

After that, reset the read and write permissions for the Cudnn.h file:

   sudo chmod a+r/usr/local/cuda/include/cudnn.h

At this point, the CUDNN configuration is complete.

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.