【亲测】centos 7 下安装cuDNN
【参考】
【文件准备】
- cuda_8.0.61_375.26_linux.run
- cudnn-8.0-linux-x64-v5.1.tgz
【步骤】
切换到压缩包所在位置,解压
$ tar -xzvf cudnn-8.0-linux-x64-v5.1.tgz复制相关文件到cuda特定目录下(我的cuda安装目录为/usr/local/cuda/)
$ 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 /usr/local/cuda/lib64/libcudnn*使用
这个时候编译caffe可以将Makefile.config中的USE_CUDNN不注释,从而使用cuDNN加速
# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1
【附录】
来源: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html
2.3. Installing cuDNN on Linux
The following steps describe how to build a cuDNN dependent program. Choose the installation method that meets your environment needs. For example,the tar file installation applies to all Linux platforms. The debian installation package applies to Ubuntu 14.04 and 16.04.
In the following sections:
> your CUDA directory path is referred to as /usr/local/cuda/
> your cuDNN download path is referred to as <cudnnpath>
2.3.1. Installing from a Tar File
- Navigate to your directory containing the cuDNN Tar file.
Unzip the cuDNN package.
$ tar -xzvf cudnn-9.0-linux-x64-v7.tgzCopy the following files into the CUDA Toolkit directory.
$ 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
/usr/local/cuda/lib64/libcudnn*
2.3.2. Installing from a Debian File
1. Navigate to your <cudnnpath> directory containing cuDNN Debian file.
2. Install the runtime library,for example:
sudo dpkg -i libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb
3. Install the developer library,for example:
sudo dpkg -i libcudnn7-dev_7.0.3.11-1+cuda9.0_amd64.deb
4. Install the code samples and the cuDNN Library User Guide,for example:
sudo dpkg -i libcudnn7-doc_7.0.3.11-1+cuda9.0_amd64.deb
2.4. Verifying
To verify that cuDNN is installed and is running properly,compile the mnistCUDNN sample located in the /usr/src/cudnn_samples_v7 directory in the debian file.
Copy the cuDNN sample to a writable path.
$ cp -r /usr/src/cudnn_samples_v7/ $HOMEGo to the writable path.
$ cd $HOME/cudnn_samples_v7/mnistCUDNN- Compile the mnistCUDNN sample.
$make clean && make - Run the mnistCUDNN sample.
$ ./mnistCUDNN
If cuDNN is properly installed and running on your Linux system,you will see a message similar to the following:
Test passed!
Read more at: http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#ixzz4y6gZeDaA Follow us: @GPUComputing on Twitter | NVIDIA on Facebook
原文链接:https://www.f2er.com/centos/375237.html