记录黑客技术中优秀的内容, 传播黑客文化,分享黑客技术精华

Jetson TX-2 入门 -- 全部你应该知道的

2017-06-18 18:25

首先庆祝一下我用TX-1做实验写的《GPU加速与L-ORB特征提取的全景视频实时拼接》发表啦^_^
导师表示很开心,又给我买了两台TX-2

TX-2比TX-1只是性能的升级,其它部分没有太大变化,接下来要写的小技巧对于TX-1/2都适用。使用期间发现的问题都会持续更新到这篇博客,目前发现的问题有:

  • OpenCV4Tegra 不支持 -lopencv_nonfree
  • OpenCV4Tegra 在TX-2中不支持 GPU 模块
  • 如何开启被屏蔽的2块CPU并设置为最大频率

0x01 OpenCV4Tegra 不支持 -lopencv_nonfree

Jetpack 自带的 Opencv 不支持 nonfree 库,因此就不能使用SIFT/SURF这种专利算法。要使用nonfree库有两种解决方案[参考]

Note about SIFT/SURF in the nonfree module: OpenCV4Tegra doesn’t include the opencv_nonfree package (containing SIFT & SURF feature detectors) since those algorithms are patented by other companies and therefore anyone using opencv_nonfree is at risk of liability.

If you need something from the nonfree module, you have 2 options:

  1. Analyze the public OpenCV source code then copy/paste the parts of the nonfree module that you want (eg: SURF feature detector) from OpenCV into your own project. You will have the CPU optimizations of OpenCV4Tegra for most of your code and will have the GPU module and will have the non-optimized patented code that you need from the nonfree package such as SURF. So this option gives full performance (for everything except the nonfree code) but is tedious.
  2. Ignore OpenCV4Tegra, and instead, download & build public OpenCV (by following the instructions below for natively compiling the OpenCV library from source). You will still have the GPU module but not any CPU optimizations, but you won’t need to spend time ripping out parts of the OpenCV non-free module code. So this option is easiest but produces slower code if you are running most of your code on CPU.

并且 libopencv4tegra 是2.4版的opencv,要使用3.0+版本的还是得自己编译opencv才行。(缺点是自己编译的opencv没有CPU优化)
自行编译Opencv的方法在这里,教程上采用的是opencv 3.1.0,还打了补丁。我直接用3.2.0版本编译安装的,至今还没发现问题。

make的时候记得加参数-j6开启6个线程否则会很慢

0x02 OpenCV4Tegra 在TX-2中不支持 GPU 模块

Currently, libopencv_gpu.so can’t be used on TX2 since wrong compute architecture.

We are really sorry about this issue. For temporally solution, please build opencv from source.
Opencv2.4.13:
http://docs.opencv.org/master/d6/d15/tutorial_building_tegra_cuda.html#tutorial_building_tegra_cuda_opencv_24X
Opencv3.x:
https://devtalk.nvidia.com/default/topic/983098/jetson-tx1/opencv-3-1-with-usb-camera-support/

We are working on this issue and will update information to you soon.
Thanks and sorry for all the inconvenience.

参考

0x03 开启被屏蔽的2块CPU并设置为最大频率

使用位于home目录的tegrastats命令可以查看TX-2的使用情况

1
2
$ ~/tegrastats
RAM 1282/7854MB (lfb 1x256kB) cpu [21%@2035,off,off,15%@2035,17%@2035,15%@2035]

那么问题来了,为什么有两块cpu被关闭(off)了。解决方案在这Two cores disabled

1
2
3
$ sudo su
$ echo 1 > /sys/devices/system/cpu/cpu1/online
$ echo 1 > /sys/devices/system/cpu/cpu2/online

此时两块CPU开启

1
2
nvidia@tegra-ubuntu:~$ ~/tegrastats
RAM 973/7854MB (lfb 1545x4MB) cpu [0%@2035,0%@345,0%@345,0%@2035,0%@2035,0%@2035]

注意到两块CPU的频率为345,下面执行~/jetson_clocks.sh开启最大频率

1
2
$ ~/tegrastats
RAM 979/7854MB (lfb 1545x4MB) cpu [0%@2035,0%@2419,0%@2419,0%@2035,0%@2035,0%@2035]

你会注意到不但cpu的频率提升到了2419,你手头TX-2的小风扇也跟着华丽的转起来了。

知识来源: s1nh.org/post/jetson-tx-2-all-you-know/

阅读:192559 | 评论:0 | 标签:无

想收藏或者和大家分享这篇好文章→复制链接地址

“Jetson TX-2 入门 -- 全部你应该知道的”共有0条留言

发表评论

姓名:

邮箱:

网址:

验证码:

公告

关注公众号hackdig,学习最新黑客技术

推广

工具

标签云