又多了一个垫桌角的玩具——Jetson Nano 初体验1

3月19日,NVIDIA的2019 GTC大会于硅谷召开,CEO黄仁勋发布了 Jetson Nano,可为机器人带来足够的AI运算力,99美元的良心之作。

技术参数

 
TechnicalSpecifications
GPU 128-core Maxwell
CPU Quad-core ARM A57 @ 1.43 GHz
Memory 4 GB 64-bit LPDDR4 25.6 GB/s
Storage microSD (not included)
Video Encode 4K @ 30 | 4x 1080p @ 30 | 9x 720p @ 30 (H.264/H.265)
Video Decode 4K @ 60 | 2x 4K @ 30 | 8x 1080p @ 30 | 18x 720p @ 30 (H.264/H.265)
Camera 1x MIPI CSI-2 DPHY lanes
Connectivity Gigabit Ethernet, M.2 Key E
Display HDMI 2.0 and eDP 1.4
USB 4x USB 3.0, USB 2.0 Micro-B
Others GPIO, I2C, I2S, SPI, UART
Mechanical 100 mm x 80 mm x 29 mm

CPU为4核A57处理器,运行Linux for Tegra,GPU有128个Cuda核心,运算能力472G,功耗5W。

1. 开机初始配置

1.1 器件准备

  1. 电源:Micro USB(5V 2.5A)
  2. HDMI线、DP线或者HDMI转DVI线,实测HDMI转VGA会出现闪屏,不能使用
  3. 16G以上class 10或者更高级别Micro SD卡,并备好高速读卡器烧写镜像,个人使用的是128G的卡
  4. 网线、USB键盘和鼠标(网线连接到路由器,方便IP与MAC绑定,之后可以使用固定IP连接板子)

开机时由于需要在图形界面上对系统进行设置,需要保证显示设备(HDMI连到显示器上)和控制设备(键盘和鼠标)都连接上。在开机设置完成后,可以关闭图形界面并使用SSH登陆,此时只需要连上电源和网线放在角落即可,当然也可以用来垫桌角了。

1.2 烧写系统

  1. 官网下载系统镜像系统镜像

  2. 使用 Etcher写入镜像到SD卡

1.3 开机配置

  1. 烧写完成后,将SD卡插入Jetson Nano,开机并完成用户密码、时区等设置,在终端使用ifconfig命令获取由路由器DHCP分配的IP地址,并在路由器中绑定IPMAC地址,之后可通过固定IP来访问,我的板子配置的固定IP是:192.168.1.115

  2. 设置完成后拔掉电源关机,此时可以拔除USB键盘、鼠标和HDMI转接线,可以放在散热良好的角落

  3. 使用PUTTY 通过SSH协议连接板子

1.4 关闭图形界面

通过top命令可以看到内存占用情况

KiB Mem :  4058432 total,  1593660 free,  1477904 used,   986868 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  2378568 avail Mem

内存占用1.5G左右,且没有交换区

由于内存和显存共用,当内存占用太多时,留给GPU使用的显存就会很少,所以可以关闭图形界面从而留出更多的备用内存

1.4.1 关闭图像用户界面

sudo systemctl set-default multi-user.target
sudo reboot

结果:

Removed /etc/systemd/system/default.target.
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.

关闭图形界面后的内存占用:

%Cpu(s):  0.1 us,  0.6 sy,  0.0 ni, 98.9 id,  0.2 wa,  0.1 hi,  0.1 si,  0.0 st
KiB Mem :  4059712 total,  3513880 free,   322932 used,   222900 buff/cache
KiB Swap:        0 total,        0 free,        0 used.  3571064 avail Mem

可以节省1.1G内存开销用于其他事务

1.4.2 启用图形用户界面

sudo systemctl set-default graphical.target
sudo reboot

1.5 设置交换分区

SWAP(交换)分区是一种通过在硬盘中预先划分一定的空间,然后将把内存中暂时不常用的数据临时存放到硬盘中,以便腾出物理内存空间让更活跃的程序服务来使用的技术,其设计目的是为了解决真实物理内存不足的问题。但由于交换分区毕竟是通过硬盘设备读写数据的,速度肯定要比物理内存慢,所以只有当真实的物理内存耗尽后才会调用交换分区的资源。

实际上,并不是等所有的物理内存都消耗完毕之后,才去使用swap的空间,什么时候使用是由swappiness 参数值控制。

虽然在SD卡上使用交换分区容易使SD卡坏的快一点,但是设置交换分区仍然有必要,将Swappiness参数设置接近零以尽可能的使用内存而非SD卡的交换分区。

1.5.1 查看交换分区

free -m
              total        used        free      shared  buff/cache   available
Mem:           3964         313        3424          17         226        3488
Swap:             0           0           0

1.5.2 检查硬盘驱动器分区上的可用空间

df -h

Filesystem Size Used Avail Use% Mounted on
/dev/root 118G 9.1G 104G 9% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 2.0G 18M 2.0G 1% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 397M 0 397M 0% /run/user/1000

通常,swap空间等于或双倍于系统内存的量是一个很好的选择。如果将其用作RAM后备,那么你的swap分区尽可能不要超过4G。

1.5.3 创建Swap分区文件

我们可以在文件系统上创建一个swap分区。我们将在根/目录中分配我们想要调用的swap大小的文件swapfile。

创建交换文件的最佳方法是使用fallocate。此命令将创建指定大小的文件。

sudo fallocate -l 4G /swapfile
ls -lh /swapfile

-rw-r--r-- 1 root root 4.0G 4月 29 20:25 /swapfile

1.5.4 启用Swap分区

我们需要将swap文件转换为swap分区。首先,我们需要锁定文件的权限,以便只有具有root权限的用户才能读取内容。

通过输入以下内容使该文件只能由root访问:

sudo chmod 600 /swapfile

输入以下命令验证权限更改:

ls -lh /swapfile

-rw------- 1 root root 4.0G /swapfile

只有root用户启用了读写标志。

我们现在可以通过输入以下内容将文件标记为swap空间

sudo mkswap /swapfile

Setting up swapspace version 1, size = 4 GiB (4294963200 bytes)
no label, UUID=e1a385f2-4431-4881-9beb-966adefd688d

标记文件后,我们可以启用swap文件:

sudo swapon /swapfile

输入以下内容验证交换是否可用:

sudo swapon --show

NAME TYPE SIZE USED PRIO
/swapfile file 4G 0B -1

我们可以用free命令再次检查:

free -h
              total        used        free      shared  buff/cache   available
Mem:           3.9G        318M        3.3G         17M        230M        3.4G
Swap:          4.0G          0B        4.0G

swap已成功设置,操作系统将在必要时使用它。

1.5.5 永久化swap文件

虽然已启用当前会话中的 swap 文件,但是,如果我们重新启动的话,服务器将不会自动保留 swap 设置。可以通过将交换文件添加到我们的 /etc/fstab 来进行更改。

为了避免出现任何问题,先备份/etc/fstab文件:

sudo cp /etc/fstab /etc/fstab.bak

输入以下内容,将swap文件信息添加到/etc/fstab文件末尾:

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

接下来,我们将调整我们的swap空间。

1.5.6 调整Swap设置

(1)调整Swappiness参数

该swappiness参数主要配置系统将数据从RAM交换到交换空间的频率。该参数的值是介于0和100之间的百分比。

当值接近于零时,除非绝对必要,否则内核不会将数据交换到磁盘。请记住,与swap文件的交互是“费时的”,因为它们比与RAM的交互花费更长的时间,并且它们可能导致性能的显着降低。

当该值接近100时,其将尝试将更多数据放入交换中以努力保留更多的RAM空间。我们可以通过输入以下内容来查看当前的swappiness值:

cat /proc/sys/vm/swappiness

60

对于服务器本身来说,您可能希望这个数值更接近于0。我们可以使用sysctl命令将swappiness设置为不同的值。

例如,要将swappiness设置为10,我们可以输入:

sudo sysctl vm.swappiness=10

vm.swappiness = 10

我们可以通过在/etc/sysctl.conf文件中添加以下行来自动设置此值:

sudo nano /etc/sysctl.conf

在底部,您可以添加:

vm.swappiness=10

完成后保存并关闭文件。

(2)调整缓存压力设置

您可能想要修改的另一个相关值是vfs_cache_pressure。这将关系到系统选择多少缓存inodedentry信息。

您可以通过proc命令来查看当前值:

cat /proc/sys/vm/vfs_cache_pressure

100

我的设置系统会很快地从缓存中删除inode信息。我们可以通过输入以下内容将其设置为更保守的值(如50):

sudo sysctl vm.vfs_cache_pressure=50
vm.vfs_cache_pressure = 50

同样,这仅适用于我们当前的会话。我们可以通过将其添加到配置文件来改变它,就像我们使用swappiness设置一样:

sudo nano /etc/sysctl.conf

在底部,添加指定新值的行:

vm.vfs_cache_pressure=50

完成后保存并关闭文件。

1.6 更换源并更新软件

Jetson Nano 采用的是 aarch64 架构的Ubuntu 18.04.2 LTS 系统

Nano的镜像默认是国外的源,速度很慢,国内的源有的上不去,有的包无法安装,经过测试清华大学的源完美可用,现放上教程

首先备份原本的 source.list 文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak    #为防止误操作后无法恢复,先备份原文件sources.list

sudo vim /etc/apt/sources.list

然后删除所有内容,复制

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-security main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ bionic-backports main multiverse restricted universe

到 sources.list 后保存,之后打开终端输入

#刷新存储库索引
sudo apt-get update
#在升级软件包时自动处理依赖关系
sudo apt-get full-upgrade 

由于在使用时经常查看CPU和共享的内存占用,系统自带的top命令并不好用,可以使用更好用的 htop,使用如下命令安装

sudo apt install htop

htop

htop 可以看到每个CPU核心的使用率、共享内存的使用率,方便直观

1.7 检查已经安装的系统组件

Jetson-nano 的OS镜像已经自带了JetPackcudacudnnopencv 等已经安装好的库,并有例子,这些例子安装路径如下所示

路径
TensorRT /usr/src/tensorrt/samples/
CUDA /usr/local/cuda-/samples/
cuDNN /usr/src/cudnn_samples_v7/
Multimedia API /usr/src/tegra_multimedia_api/
VisionWorks /usr/share/visionworks/sources/samples/ /usr/share/visionworks-tracking/sources/samples/ /usr/share/visionworks-sfm/sources/samples/
OpenCV /usr/share/OpenCV/samples/

1.7.0 检查系统属性

#查看Jetson Nano L4T版本:
head -n 1 /etc/nv_tegra_release

R32 (release), REVISION: 1.0, GCID: 14531094, BOARD: t210ref, EABI: aarch64, DATE: Wed Mar 13 07:46:13 UTC 2019

#查看系统版本
cat /etc/lsb-release

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS"

#查看系统内核
uname -a

Linux nv 4.9.140-tegra #1 SMP PREEMPT PDT 2019 aarch64 aarch64 aarch64 GNU/Linux

#查看内存
free -m

          total        used        free      shared  buff/cache   available

Mem: 3964 393 2949 25 621 3387
Swap: 4095 0 4095

#查看CPU详情
lscpu

Architecture: aarch64
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
Vendor ID: ARM
Model: 1
Model name: Cortex-A57
Stepping: r1p1
CPU max MHz: 1428.0000
CPU min MHz: 102.0000
BogoMIPS: 38.40
L1d cache: 32K
L1i cache: 48K
L2 cache: 2048K
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32

#查看硬盘分区
sudo parted -l

Error: /dev/mtdblock0: unrecognised disk label
Model: Unknown (unknown)
Disk /dev/mtdblock0: 4194kB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:

Model: SD SC128 (sd/mmc)
Disk /dev/mmcblk0: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:

Number Start End Size File system Name Flags
2 1049kB 1180kB 131kB TBC
3 2097kB 2556kB 459kB RP1
4 3146kB 3736kB 590kB EBT
5 4194kB 4260kB 65.5kB WB0
6 5243kB 5439kB 197kB BPF
7 6291kB 6881kB 590kB TOS
8 7340kB 7406kB 65.5kB EKS
9 8389kB 9044kB 655kB LNX
10 9437kB 9896kB 459kB DTB
11 10.5MB 10.6MB 131kB RP4
12 11.5MB 11.6MB 81.9kB BMP
1 12.6MB 128GB 128GB ext4 APP

#查看硬盘空间
df -h

Filesystem Size Used Avail Use% Mounted on
/dev/root 118G 16G 97G 15% /
devtmpfs 1.8G 0 1.8G 0% /dev
tmpfs 2.0G 4.0K 2.0G 1% /dev/shm
tmpfs 2.0G 26M 2.0G 2% /run
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
tmpfs 397M 12K 397M 1% /run/user/1000

#查看正在运行的进程
htop

#查看USB设备
lsusb

Bus 002 Device 002: ID 0bda:0411 Realtek Semiconductor Corp.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 0bda:5411 Realtek Semiconductor Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

#查看PCI总线
lspci

00:02.0 PCI bridge: NVIDIA Corporation Device 0faf (rev a1)
01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

#查看系统已载入的相关模块
lsmod

Module Size Used by
nvs 54527 0
nvgpu 1555053 3
bluedroid_pm 13912 0
ip_tables 19441 0
x_tables 28951 1 ip_tables

#查看硬件
sudo lshw

nv
description: Computer
product: jetson-nano
serial: 04212190206840c08401
width: 64 bits
capabilities: smp cp15_barrier setend swp
*-core
description: Motherboard
physical id: 0
*-cpu:0
description: CPU
product: cpu
physical id: 0
bus info: cpu@0
size: 1428MHz
capacity: 1428MHz
capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq
*-cpu:1
description: CPU
product: cpu
physical id: 1
bus info: cpu@1
size: 1428MHz
capacity: 1428MHz
capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq
*-cpu:2
description: CPU
product: cpu
physical id: 3
bus info: cpu@2
size: 1428MHz
capacity: 1428MHz
capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq
*-cpu:3
description: CPU
product: cpu
physical id: 4
bus info: cpu@3
size: 1428MHz
capacity: 1428MHz
capabilities: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpufreq
*-cpu:4 DISABLED
description: CPU
product: idle-states
physical id: 5
bus info: cpu@4
*-cpu:5 DISABLED
description: CPU
product: l2-cache
physical id: 6
bus info: cpu@5
*-memory
description: System memory
physical id: 7
size: 3964MiB
*-pci
description: PCI bridge
product: NVIDIA Corporation
vendor: NVIDIA Corporation
physical id: 2
bus info: pci@0000:00:02.0
version: a1
width: 32 bits
clock: 33MHz
capabilities: pci pm msi ht pciexpress normal_decode bus_master cap_list
configuration: driver=pcieport
resources: irq:84 ioport:1000(size=4096) memory:13000000-130fffff
*-network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
vendor: Realtek Semiconductor Co., Ltd.
physical id: 0
bus info: pci@0000:01:00.0
logical name: eth0
version: 15
serial: 00:04:4b:e4:0c:db
size: 100Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
configuration: autonegotiation=on broadcast=yes driver=r8168 driverversion=8.045.08-NAPI duplex=full ip=192.168.1.115 latency=0 link=yes multicast=yes port=twisted pair speed=100Mbit/s
resources: irq:404 ioport:1000(size=256) memory:13004000-13004fff memory:13000000-13003fff
*-usbhost:0
product: xHCI Host Controller
vendor: Linux 4.9.140-tegra xhci-hcd
physical id: 1
bus info: usb@1
logical name: usb1
version: 4.09
capabilities: usb-2.00
configuration: driver=hub slots=5 speed=480Mbit/s
*-usb
description: USB hub
product: 4-Port USB 2.1 Hub
vendor: Generic
physical id: 2
bus info: usb@1:2
version: 1.20
capabilities: usb-2.10
configuration: driver=hub slots=4 speed=480Mbit/s
*-usbhost:1
product: xHCI Host Controller
vendor: Linux 4.9.140-tegra xhci-hcd
physical id: 2
bus info: usb@2
logical name: usb2
version: 4.09
capabilities: usb-3.00
configuration: driver=hub slots=4 speed=5000Mbit/s
*-usb
description: USB hub
product: 4-Port USB 3.1 Hub
vendor: Generic
physical id: 1
bus info: usb@2:1
version: 1.20
capabilities: usb-3.20
configuration: driver=hub slots=4 speed=5000Mbit/s
*-network:0
description: Ethernet interface
physical id: 3
logical name: usb0
serial: 96:1a:c2:c7:d8:7f
capabilities: ethernet physical
configuration: broadcast=yes driver=g_ether driverversion=29-May-2008 firmware=tegra-xudc link=no multicast=yes
*-network:1
description: Ethernet interface
physical id: 4
logical name: l4tbr0
serial: 96:1a:c2:c7:d8:7d
capabilities: ethernet physical
configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=192.168.55.1 link=no multicast=yes
*-network:2 DISABLED
description: Ethernet interface
physical id: 5
logical name: dummy0
serial: 96:71:bf:d0:c5:fd
capabilities: ethernet physical
configuration: broadcast=yes driver=dummy driverversion=1.0
*-network:3
description: Ethernet interface
physical id: 6
logical name: rndis0
serial: 96:1a:c2:c7:d8:7d
capabilities: ethernet physical
configuration: broadcast=yes driver=g_ether driverversion=29-May-2008 firmware=tegra-xudc link=no multicast=yes

1.7.1 检查CUDA

Jetson-nano 中已经安装了 CUDA10.0 版本,但是此时你如果运行 nvcc -V 是不会成功的,需要你把 CUDA 的路径写入环境变量中。OS 中自带 Vim 工具 ,所以运行下面的命令编辑环境变量

sudo vim  ~/.bashrc

在最后添加

export CUBA_HOME=/usr/local/cuda-10.0
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
export PATH=/usr/local/cuda-10.0/bin:$PATH

然后保存退出
对了最后别忘了source一下这个文件。

source ~/.bashrc

source后,此时再执行 nvcc -V 执行结果如下

nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sun_Sep_30_21:09:22_CDT_2018
Cuda compilation tools, release 10.0, V10.0.166

1.7.2 检查OpenCV

Jetson-nano 中已经安装了 OpenCV3.3 版本,可以使用命令检查 OpenCV 是否安装就绪

#查看opencv版本:
pkg-config opencv --modversion

3.3.1

#查看opencv安装库
pkg-config opencv --libs

-lopencv_dnn -lopencv_ml -lopencv_objdetect -lopencv_shape -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video -lopencv_photo -lopencv_imgproc -lopencv_flann -lopencv_core

如果 OpenCV 安装就绪,会显示版本号,版本是3.3.1

1.7.3 检查cuDNN

Jetson-nano 中已经安装好了 cuDNN,并有例子可供运行,我们运行一下例子,也正好验证上面的 CUDA

#进入例子目录
cp -rf /usr/src/cudnn_samples_v7/mnistCUDNN  ~/cudnn 
#编译一下例子
make 
# 为可执行文件添加执行权限    
chmod a+x mnistCUDNN 
# 执行
./mnistCUDNN 

如果成功,如下所示

cudnnGetVersion() : 7301 , CUDNN_VERSION from cudnn.h : 7301 (7.3.1)
Host compiler version : GCC 7.3.0
There are 1 CUDA capable devices on your machine :
device 0 : sms  1  Capabilities 5.3, SmClock 921.6 Mhz, MemSize (Mb) 3964, MemClock 12.8 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 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.371823 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.396354 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 5.057344 time requiring 207360 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 16.059010 time requiring 57600 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 25.094376 time requiring 203008 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 1
Testing cudnnFindConvolutionForwardAlgorithm ...
^^^^ CUDNN_STATUS_SUCCESS for Algo 0: 0.134375 time requiring 0 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 1: 0.168437 time requiring 3464 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 2: 0.287084 time requiring 28800 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 4: 2.512813 time requiring 207360 memory
^^^^ CUDNN_STATUS_SUCCESS for Algo 5: 12.629375 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!

至此,基本组件检查完毕

参考资料

posted @ 2019-05-10 16:54  〇矽小筑  阅读(7911)  评论(0编辑  收藏  举报