< >
Home » TK1入门教程软件篇 » TK1入门教程软件篇-安装cuDNN

TK1入门教程软件篇-安装cuDNN

TK1入门教程软件篇-安装cuDNN

说明:

  • 介绍如何TK1上安装cuDNNR1或cuDNNR2版本,以及在Caffe上使用。

cuDNN :

  • cuDNN是NVIDIA的GPU加速库,用于深层神经网络和机器学习
  • 它被集成到更高级别的机器学习框架,如加州大学伯克利分校的Caffe软件,现在可用于Jetson TK1
  • cuDNN版本1是当前的稳定版本,而cuDNN v2是发布版本3
  • Caffe使用cuDNN发行版1.所有库和文档均可从NVIDIA网站获取,需要免费开发者注册才能下载

安装cuDNN1:

  • 建立目录
mkdir ~/cuDNNR1
  • 下载软件包:

    • 软件包名称:cudnn-6.5-linux-armv7-R1.tgz
    • 下载地址:https://developer.nvidia.com/cuDNN
  • 下载安装脚本:
cd ~/cuDNNR1
git clone https://gist.github.com/jetsonhacks/fa9f4ff89006607359ea
cp fa9f4ff89006607359ea/installcuDNNR1.sh ../installcuDNNR1.sh
vim installcuDNNR1.sh
  • 脚本内容:
#!/bin/sh
# Install cuDNN R1 on NVIDIA Jetson TK1
# Register as a NVIDIA developer and download the cuDNN package
# Package is named cudnn-6.5-linux-armv7-R1.tgz
# This script and the cuDNN package should be in the same directory, usually ~/Downloads
# This script places the library and include files for cudnn in the CUDA 6.5 directories
# Make sure this is executing as root
if [ $(id -u) != 0 ]; then
  echo "This script requires root permissions"
  echo "$ sudo "$0""
  exit
fi
# unzip the archive
tar -zxvf cudnn-6.5-linux-armv7-R1.tgz
cd cudnn-6.5-linux-armv7-R1
# copy the include file
cp cudnn.h /usr/local/cuda-6.5/include
cp libcudnn* /usr/local/cuda-6.5/lib
  • 也可以自行复制张贴对应内容
  • 分配权限,执行安装
chmod +x installcuDNNR1.sh
./installcuDNNR1.sh
  • 完成安装

安装cuDNNR2:

  • 建立目录
mkdir ~/cuDNNR2
  • 下载软件包:

    • 软件包名称:cudnn-6.5-linux-ARMv7-R2-rc1.tgz
    • 下载地址:https://developer.nvidia.com/cuDNN
  • 下载安装脚本:
cd ~/cuDNNR2
git clone https://gist.github.com/jetsonhacks/5257f2352d444c2f3240
cp  5257f2352d444c2f3240/installcuDNNR2.sh ../installcuDNNR2.sh
vim installcuDNNR2.sh
  • 脚本内容:
#!/bin/sh
# Install cuDNN R2 on NVIDIA Jetson TK1
# Register as a NVIDIA developer and download the cuDNN package
# Package is named cudnn-6.5-linux-ARMv7-R2-rc1.tgz
# This script and the cuDNN package should be in the same directory, usually ~/Downloads
# This script places the library and include files for cudnn in the CUDA 6.5 directories
# Make sure this is executing as root
if [ $(id -u) != 0 ]; then
  echo "This script requires root permissions"
  echo "$ sudo "$0""
  exit
fi
# unzip the archive
tar -zxvf cudnn-6.5-linux-ARMv7-R2-rc1.tgz
cd cudnn-6.5-linux-ARMv7-R2-rc1
# copy the include file
cp cudnn.h /usr/local/cuda-6.5/include
cp libcudnn* /usr/local/cuda-6.5/lib
  • 也可以自行复制张贴对应内容
  • 分配权限,执行安装
chmod +x installcuDNNR2.sh
./installcuDNNR2.sh
  • 完成安装

Caffe使用cuDNN

  • 修改Makefile.config
# Makefile.config (only relevant cuDNN configuration items shown)
USE_CUDNN := 1
INCLUDE_DIRS := /usr/local/cuda-6.5/include
LIBRARY_DIRS := /usr/local/cuda-6.5/lib
  • 重新编译Caffe才生效

参考:

  • https://devblogs.nvidia.com/parallelforall/embedded-machine-learning-cudnn-deep-neural-network-library-jetson-tk1/
  • http://www.jetsonhacks.com/2015/01/20/nvidia-jetson-tk1-cudnn-install-caffe-example/
  • https://gist.github.com/jetsonhacks/fa9f4ff89006607359ea
  • https://gist.github.com/jetsonhacks/5257f2352d444c2f3240

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: tk1入门教程软件篇