Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
e31b2138
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e31b2138
编写于
12月 19, 2018
作者:
李
李寅
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add python dependency requirements and how-to-debug doc
上级
a2b27f63
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
123 addition
and
12 deletion
+123
-12
docs/development/how_to_debug.rst
docs/development/how_to_debug.rst
+85
-0
docs/index.rst
docs/index.rst
+1
-0
docs/installation/env_requirement.rst
docs/installation/env_requirement.rst
+27
-12
setup/optionals.txt
setup/optionals.txt
+4
-0
setup/requirements.txt
setup/requirements.txt
+6
-0
未找到文件。
docs/development/how_to_debug.rst
0 → 100644
浏览文件 @
e31b2138
How to debug
==============
Log debug info
--------------------------
Mace defines two sorts of logs: one is for users (LOG), the other is for developers (VLOG).
LOG includes four levels, i.e, ``INFO``, ``WARNING``, ``ERROR``, ``FATAL``;
Environment variable ``MACE_CPP_MIN_LOG_LEVEL`` can be set to specify log level of users, e.g.,
``set MACE_CPP_MIN_LOG_LEVEL=0`` will enable ``INFO`` log level, while ``set MACE_CPP_MIN_LOG_LEVEL=4`` will enable ``FATAL`` log level.
VLOG level is specified by numbers, e.g., 0, 1, 2. Environment variable ``MACE_CPP_MIN_VLOG_LEVEL`` can be set to specify vlog level.
Logs with higher levels than which is specified will be printed. So simply specifying a very large level number will make all logs printed.
By using Mace run tool, vlog level can be easily set by option, e.g.,
.. code:: sh
python tools/converter.py run --config /path/to/model.yml --vlog_level=2
If models are run on android, you might need to use ``adb logcat`` to view logs.
Debug memory usage
--------------------------
The simplest way to debug process memory usage is to use ``top`` command. With ``-H`` option, it can also show thread info.
For android, if you need more memory info, e.g., memory used of all categories, ``adb shell dumpsys meminfo`` will help.
By watching memory usage, you can check if memory usage meets expectations or if any leak happens.
Debug using GDB
--------------------------
GDB can be used as the last resort, as it is powerful that it can trace stacks of your process. If you run models on android,
things may be a little bit complicated.
.. code:: sh
# push gdbserver to your phone
adb push $ANDROID_NDK_HOME/prebuilt/android-arm64/gdbserver/gdbserver /data/local/tmp/
# set system env, pull system libs and bins to host
export SYSTEM_LIB=/path/to/android/system_lib
export SYSTEM_BIN=/path/to/android/system_bin
mkdir -p $SYSTEM_LIB
adb pull /system/lib/. $SYSTEM_LIB
mkdir -p $SYSTEM_BIN
adb pull /system/bin/. $SYSTEM_BIN
# Suppose ndk compiler used to compile Mace is of android-21
export PLATFORMS_21_LIB=$ANDROID_NDK_HOME/platforms/android-21/arch-arm/usr/lib/
# start gdbserver,make gdb listen to port 6000
# adb shell /data/local/tmp/gdbserver :6000 /path/to/binary/on/phone/example_bin
adb shell LD_LIBRARY_PATH=/dir/to/dynamic/library/on/phone/ /data/local/tmp/gdbserver :6000 /data/local/tmp/mace_run/example_bin
# or attach a running process
adb shell /data/local/tmp/gdbserver :6000 --attach 8700
# forward tcp port
adb forward tcp:6000 tcp:6000
# use gdb on host to execute binary
$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/gdb [/path/to/binary/on/host/example_bin]
# connect remote port after starting gdb command
target remote :6000
# set lib path
set solib-search-path $SYSTEM_LIB:$SYSTEM_BIN:$PLATFORMS_21_LIB
# then you can use it as host gdb, e.g.,
bt
docs/index.rst
浏览文件 @
e31b2138
...
...
@@ -39,6 +39,7 @@ The main documentation is organized into the following sections:
development/contributing
development/adding_a_new_op
development/how_to_run_tests
development/how_to_debug
development/memory_layout
.. toctree::
...
...
docs/installation/env_requirement.rst
浏览文件 @
e31b2138
...
...
@@ -18,25 +18,30 @@ Required dependencies
* - Bazel
- `bazel installation guide <https://docs.bazel.build/versions/master/install.html>`__
- 0.13.0
* - CMake
- apt-get install cmake
- >= 3.11.3
* - Jinja2
- pip install
-I
jinja2==2.10
- pip install jinja2==2.10
- 2.10
* - PyYaml
- pip install
-I
pyyaml==3.12
- pip install pyyaml==3.12
- 3.12.0
* - sh
- pip install
-I
sh==1.12.14
- pip install sh==1.12.14
- 1.12.14
* - Numpy
- pip install
-I
numpy==1.14.0
- pip install numpy==1.14.0
- Required by model validation
* - six
- pip install
-I
six==1.11.0
- pip install six==1.11.0
- Required for Python 2 and 3 compatibility
For Bazel, install it following installation guide. For python dependencies,
.. code:: sh
pip install -U --user setup/requirements.txt
Optional dependencies
---------------------
...
...
@@ -49,25 +54,35 @@ Optional dependencies
* - Android NDK
- `NDK installation guide <https://developer.android.com/ndk/guides/setup#install>`__
- Required by Android build, r15b, r15c, r16b, r17b
* - CMake
- apt-get install cmake
- >= 3.11.3
* - ADB
- apt-get install android-tools-adb
- Required by Android run, >= 1.0.32
* - TensorFlow
- pip install
-I
tensorflow==1.8.0
- pip install tensorflow==1.8.0
- Required by TensorFlow model
* - Docker
- `docker installation guide <https://docs.docker.com/install/linux/docker-ce/ubuntu/#set-up-the-repository>`__
- Required by docker mode for Caffe model
* - Scipy
- pip install
-I
scipy==1.0.0
- pip install scipy==1.0.0
- Required by model validation
* - FileLock
- pip install
-I
filelock==3.0.0
- pip install filelock==3.0.0
- Required by run on Android
* - ONNX
- pip install onnx
- pip install onnx
==1.3.0
- Required by ONNX model
For python dependencies,
.. code:: sh
pip install -U --user setup/optionals.txt
.. note::
- For Android build, `ANDROID_NDK_HOME` must be confifigured by using ``export ANDROID_NDK_HOME=/path/to/ndk``
...
...
setup/optionals.txt
0 → 100644
浏览文件 @
e31b2138
tensorflow>=1.8.0
scipy>=1.0.0
filelock>=3.0.0
onnx>=1.3.0
\ No newline at end of file
setup/requirements.txt
0 → 100644
浏览文件 @
e31b2138
python>=2.7.0
jinja2>=2.10
pyyaml>=3.12
sh>=1.12.14
numpy>=1.14.0
six>=1.11.0
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录