Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
363f4646
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
363f4646
编写于
8月 12, 2020
作者:
Z
zhaoyangstar
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Compile] Enable time profile option in tiny_publish, test=develop
上级
ebcdb28b
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
30 addition
and
7 deletion
+30
-7
CMakeLists.txt
CMakeLists.txt
+2
-0
lite/core/CMakeLists.txt
lite/core/CMakeLists.txt
+2
-0
lite/core/profile/CMakeLists.txt
lite/core/profile/CMakeLists.txt
+1
-1
lite/core/profile/profiler.cc
lite/core/profile/profiler.cc
+8
-6
lite/tools/build.sh
lite/tools/build.sh
+5
-0
lite/tools/build_android.sh
lite/tools/build_android.sh
+12
-0
未找到文件。
CMakeLists.txt
浏览文件 @
363f4646
...
...
@@ -191,6 +191,8 @@ if (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
include
(
external/gtest
)
# download, build, install gtest
include
(
ccache
)
# set ccache for compilation
include
(
external/protobuf
)
# download, build, install protobuf
elseif
(
LITE_WITH_PROFILE
)
include
(
external/gflags
)
# download, build, install gflags
endif
()
# for opencl
...
...
lite/core/CMakeLists.txt
浏览文件 @
363f4646
...
...
@@ -140,6 +140,8 @@ if (NOT LITE_ON_TINY_PUBLISH)
add_subdirectory
(
mir
)
add_subdirectory
(
profile
)
add_subdirectory
(
arena
)
elseif
(
LITE_WITH_PROFILE
)
add_subdirectory
(
profile
)
endif
()
# for mobile, unnecessary to compile the following testings.
...
...
lite/core/profile/CMakeLists.txt
浏览文件 @
363f4646
...
...
@@ -5,5 +5,5 @@ endif()
lite_cc_library
(
basic_profiler SRCS basic_profiler.cc DEPS gflags
)
lite_cc_test
(
test_basic_profiler SRCS basic_profiler_test.cc DEPS basic_profiler
)
lite_cc_library
(
lite_profiler SRCS profiler.cc DEPS context
)
lite_cc_library
(
lite_profiler SRCS profiler.cc DEPS context
gflags
)
lite_cc_test
(
test_lite_timer SRCS test_timer.cc DEPS lite_profiler
)
lite/core/profile/profiler.cc
浏览文件 @
363f4646
...
...
@@ -127,14 +127,16 @@ std::string Profiler::Summary(Type type, bool concise, size_t w) {
// Title.
if
(
concise
)
{
ss
<<
"Timing cycle = "
<<
units_
.
front
().
Timer
(
type
)
->
LapTimes
().
Size
()
<<
std
::
endl
;
<<
"
\n
"
;
ss
<<
"===== Concise "
<<
TypeStr
.
find
(
type
)
->
second
<<
" Profiler Summary: "
<<
name_
<<
", Exclude "
<<
w
<<
" warm-ups ====="
<<
std
::
endl
;
<<
" warm-ups ====="
<<
"
\n
"
;
}
else
{
ss
<<
"===== Detailed "
<<
TypeStr
.
find
(
type
)
->
second
<<
" Profiler Summary: "
<<
name_
<<
", Exclude "
<<
w
<<
" warm-ups ====="
<<
std
::
endl
;
<<
" warm-ups ====="
<<
"
\n
"
;
}
ss
<<
setw
(
20
)
<<
left
<<
"OperatorType"
<<
" "
<<
setw
(
30
)
<<
left
<<
"KerneAttr(Place)"
...
...
@@ -169,7 +171,7 @@ std::string Profiler::Summary(Type type, bool concise, size_t w) {
<<
" "
<<
setw
(
12
)
<<
left
<<
"LocalWorkSize"
;
}
#endif
ss
<<
std
::
endl
;
ss
<<
"
\n
"
;
// Profile information.
if
(
concise
)
{
...
...
@@ -248,7 +250,7 @@ std::string Profiler::Summary(Type type, bool concise, size_t w) {
<<
item
.
second
.
cl_max
<<
" "
<<
left
<<
fixed
<<
setprecision
(
2
)
<<
cl_percent
<<
"% "
;
#endif
ss
<<
std
::
endl
;
ss
<<
"
\n
"
;
// clang-format on
}
}
else
{
...
...
@@ -310,7 +312,7 @@ std::string Profiler::Summary(Type type, bool concise, size_t w) {
<<
unit
.
Character
().
global_work_size
<<
" "
<<
setw
(
12
)
<<
left
<<
fixed
<<
unit
.
Character
().
local_work_size
;
#endif
ss
<<
std
::
endl
;
ss
<<
"
\n
"
;
}
}
return
ss
.
str
();
...
...
lite/tools/build.sh
浏览文件 @
363f4646
...
...
@@ -110,6 +110,10 @@ function make_tiny_publish_so {
local
lang
=
$3
local
android_stl
=
$4
if
[
${
WITH_PROFILE
}
==
"ON"
]
;
then
prepare_thirdparty
fi
cur_dir
=
$(
pwd
)
build_dir
=
$cur_dir
/build.lite.
${
os
}
.
${
abi
}
.
${
lang
}
if
[
-d
$build_dir
]
...
...
@@ -134,6 +138,7 @@ function make_tiny_publish_so {
-DLITE_ON_TINY_PUBLISH
=
ON
\
-DANDROID_STL_TYPE
=
$android_stl
\
-DLITE_BUILD_EXTRA
=
$BUILD_EXTRA
\
-DLITE_WITH_PROFILE
=
${
WITH_PROFILE
}
\
-DLITE_WITH_CV
=
$BUILD_CV
\
-DLITE_BUILD_TAILOR
=
$BUILD_TAILOR
\
-DLITE_OPTMODEL_DIR
=
$OPTMODEL_DIR
\
...
...
lite/tools/build_android.sh
浏览文件 @
363f4646
...
...
@@ -32,6 +32,8 @@ MEDIATEK_APU_SDK_ROOT="$(pwd)/apu_ddk" # Download APU SDK from https://paddlelit
WITH_OPENCL
=
OFF
# options of adding training ops
WITH_TRAIN
=
OFF
# options of time profile
WITH_PROFILE
=
OFF
# num of threads used during compiling..
readonly
NUM_PROC
=
${
LITE_BUILD_THREADS
:-
4
}
#####################################################################################################
...
...
@@ -146,6 +148,10 @@ function make_tiny_publish_so {
prepare_opencl_source_code
$workspace
$build_dir
fi
# 3rd party is needed when profile option is ON
if
[
"
${
WITH_PROFILE
}
"
==
"ON"
]
;
then
prepare_thirdparty
fi
local
cmake_mutable_options
=
"
-DLITE_BUILD_EXTRA=
$WITH_EXTRA
\
...
...
@@ -155,6 +161,7 @@ function make_tiny_publish_so {
-DLITE_OPTMODEL_DIR=
$OPTMODEL_DIR
\
-DLITE_WITH_JAVA=
$WITH_JAVA
\
-DLITE_WITH_CV=
$WITH_CV
\
-DLITE_WITH_PROFILE=
$WITH_PROFILE
\
-DLITE_WITH_NPU=
$WITH_HUAWEI_KIRIN_NPU
\
-DNPU_DDK_ROOT=
$HUAWEI_KIRIN_NPU_SDK_ROOT
\
-DLITE_WITH_APU=
$WITH_MEDIATEK_APU
\
...
...
@@ -329,6 +336,11 @@ function main {
WITH_STRIP
=
"
${
i
#*=
}
"
shift
;;
# ON or OFF, default OFF
--with_profile
=
*
)
WITH_PROFILE
=
"
${
i
#*=
}
"
shift
;;
# string, absolute path to optimized model dir
--opt_model_dir
=
*
)
OPTMODEL_DIR
=
"
${
i
#*=
}
"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录