編碼的世界 / 優質文選 / 感情

【親測】centos 7 下安裝cuDNN


2022年5月17日
-   

親測centos 7 下安裝cuDNN
參考
  • http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

  • 文件准備
  • 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.tgz
  • Copy 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/ $HOME
  • Go 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

    熱門文章