close

http://developer.nvidia.com/rdp/cudnn-download

要先登入下載:

cuDNN v7.3.1 Library for Linux
cuDNN v7.3.1 Runtime Library for Ubuntu18.04 (Deb)
cuDNN v7.3.1 Developer Library for Ubuntu18.04 (Deb)
cuDNN v7.3.1 Code Samples and User Guide for Ubuntu18.04 (Deb)

先解壓縮然後將檔案放入cuda:

  • tar -xvf cudnn-10.0-linux-x64-v7.3.1.20.tgz
  • sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
  • sudo cp cuda/lib64/lib* /usr/local/cuda/lib64/
  • cd /usr/local/cuda/lib64/
  • sudo chmod +r libcudnn.so.7.3.1
  • sudo ln -sf libcudnn.so.7.3.1 libcudnn.so.7
  • sudo ln -sf libcudnn.so.7 libcudnn.so
  • sudo ldconfig

檢查是否安裝正確:

  • sudo dpkg -i libcudnn7_7.3.1.20-1+cuda10.0_amd64.deb
  • sudo dpkg -i libcudnn7-dev_7.3.1.20-1+cuda10.0_amd64.deb
  • sudo dpkg -i libcudnn7-doc_7.3.1.20-1+cuda10.0_amd64.deb
  • cp -r /usr/src/cudnn_samples_v7/ $HOME
  • cd $HOME/cudnn_samples_v7/mnistCUDNN
  • make clean && make
  • ./mnistCUDNN
 
正確則會出現:

cudnnGetVersion() : 7301 , CUDNN_VERSION from cudnn.h : 7301 (7.3.1)
Host compiler version : GCC 7.4.0
There are 1 CUDA capable devices on your machine :
device 0 : sms  4  Capabilities 3.0, SmClock 928.0 Mhz, MemSize (Mb) 978, MemClock 2700.0 Mhz, Ecc=0, boardGroupID=0
Using device 0

Testing single precision
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 2
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.022368 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.033792 time requiring 100 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.038592 time requiring 57600 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.182528 time requiring 203008 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 7: 0.476448 time requiring 2057744 memory
Resulting weights from Softmax:
0.0000000 0.9999399 0.0000000 0.0000000 0.0000561 0.0000000 0.0000012 0.0000017 0.0000010 0.0000000
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 0.9999288 0.0000000 0.0000711 0.0000000 0.0000000 0.0000000 0.0000000
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 0.9999820 0.0000154 0.0000000 0.0000012 0.0000006

Result of classification: 1 3 5

Test passed!

Testing half precision (math in single precision)
Loading image data/one_28x28.pgm
Performing forward propagation ...
Testing cudnnGetConvolutionForwardAlgorithm ...
Fastest algorithm is Algo 2
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.031456 time requiring 100 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.034304 time requiring 28800 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.040608 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 0.144544 time requiring 207360 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 0.167264 time requiring 203008 memory
Resulting weights from Softmax:
0.0000001 1.0000000 0.0000001 0.0000000 0.0000563 0.0000001 0.0000012 0.0000017 0.0000010 0.0000001
Loading image data/three_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000714 0.0000000 0.0000000 0.0000000 0.0000000
Loading image data/five_28x28.pgm
Performing forward propagation ...
Resulting weights from Softmax:
0.0000000 0.0000008 0.0000000 0.0000002 0.0000000 1.0000000 0.0000154 0.0000000 0.0000012 0.0000006

Result of classification: 1 3 5

Test passed!

 

 

arrow
arrow
    文章標籤
    cudnn ubuntu
    全站熱搜
    創作者介紹
    創作者 微笑創客 的頭像
    微笑創客

    微笑創客 Smile assassin

    微笑創客 發表在 痞客邦 留言(0) 人氣()