Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wzpei9
Paddle
提交
e5b4643a
P
Paddle
项目概览
wzpei9
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e5b4643a
编写于
10月 18, 2018
作者:
T
Tao Luo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add profile_mkldnn test
test=develop
上级
7d680be5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
28 deletion
+25
-28
paddle/fluid/inference/tests/api/analyzer_resnet50_tester.cc
paddle/fluid/inference/tests/api/analyzer_resnet50_tester.cc
+12
-13
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
+13
-13
paddle/fluid/inference/tests/api/tester_helper.h
paddle/fluid/inference/tests/api/tester_helper.h
+0
-2
未找到文件。
paddle/fluid/inference/tests/api/analyzer_resnet50_tester.cc
浏览文件 @
e5b4643a
...
...
@@ -20,14 +20,13 @@ namespace paddle {
namespace
inference
{
namespace
analysis
{
void
SetConfig
(
AnalysisConfig
*
cfg
,
bool
_use_mkldnn
=
FLAGS_use_MKLDNN
)
{
void
SetConfig
(
AnalysisConfig
*
cfg
)
{
cfg
->
param_file
=
FLAGS_infer_model
+
"/params"
;
cfg
->
prog_file
=
FLAGS_infer_model
+
"/model"
;
cfg
->
use_gpu
=
false
;
cfg
->
device
=
0
;
cfg
->
enable_ir_optim
=
true
;
cfg
->
specify_input_name
=
true
;
cfg
->
_use_mkldnn
=
_use_mkldnn
;
}
void
SetInput
(
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
*
inputs
)
{
...
...
@@ -53,9 +52,10 @@ void SetInput(std::vector<std::vector<PaddleTensor>> *inputs) {
}
// Easy for profiling independently.
TEST
(
Analyzer_resnet50
,
profil
e
)
{
void
profile
(
bool
use_mkldnn
=
fals
e
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
cfg
.
_use_mkldnn
=
use_mkldnn
;
std
::
vector
<
PaddleTensor
>
outputs
;
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
...
...
@@ -70,6 +70,11 @@ TEST(Analyzer_resnet50, profile) {
}
}
TEST
(
Analyzer_resnet50
,
profile
)
{
profile
();
}
#ifndef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_resnet50
,
profile_mkldnn
)
{
profile
(
true
/* use_mkldnn */
);
}
#endif
// Check the fuse status
TEST
(
Analyzer_resnet50
,
fuse_statis
)
{
AnalysisConfig
cfg
;
...
...
@@ -83,25 +88,19 @@ TEST(Analyzer_resnet50, fuse_statis) {
}
// Compare result of NativeConfig and AnalysisConfig
TEST
(
Analyzer_resnet50
,
compar
e
)
{
void
compare
(
bool
use_mkldnn
=
fals
e
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
cfg
.
_use_mkldnn
=
use_mkldnn
;
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
SetInput
(
&
input_slots_all
);
CompareNativeAndAnalysis
(
cfg
,
input_slots_all
);
}
// Compare result of NativeConfig and AnalysisConfig with MKLDNN
TEST
(
Analyzer_resnet50
,
compare
)
{
compare
();
}
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_resnet50
,
compare_mkldnn
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
,
true
);
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
SetInput
(
&
input_slots_all
);
CompareNativeAndAnalysis
(
cfg
,
input_slots_all
);
}
TEST
(
Analyzer_resnet50
,
compare_mkldnn
)
{
compare
(
true
/* use_mkldnn */
);
}
#endif
}
// namespace analysis
...
...
paddle/fluid/inference/tests/api/analyzer_vis_tester.cc
浏览文件 @
e5b4643a
...
...
@@ -50,7 +50,7 @@ Record ProcessALine(const std::string &line) {
return
record
;
}
void
SetConfig
(
AnalysisConfig
*
cfg
,
bool
_use_mkldnn
=
FLAGS_use_MKLDNN
)
{
void
SetConfig
(
AnalysisConfig
*
cfg
)
{
cfg
->
param_file
=
FLAGS_infer_model
+
"/__params__"
;
cfg
->
prog_file
=
FLAGS_infer_model
+
"/__model__"
;
cfg
->
use_gpu
=
false
;
...
...
@@ -59,7 +59,6 @@ void SetConfig(AnalysisConfig *cfg, bool _use_mkldnn = FLAGS_use_MKLDNN) {
cfg
->
specify_input_name
=
true
;
// TODO(TJ): fix fusion gru
cfg
->
ir_passes
.
push_back
(
"fc_gru_fuse_pass"
);
cfg
->
_use_mkldnn
=
_use_mkldnn
;
}
void
SetInput
(
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
*
inputs
)
{
...
...
@@ -82,9 +81,10 @@ void SetInput(std::vector<std::vector<PaddleTensor>> *inputs) {
// Easy for profiling independently.
// ocr, mobilenet and se_resnext50
TEST
(
Analyzer_vis
,
profil
e
)
{
void
profile
(
bool
use_mkldnn
=
fals
e
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
cfg
.
_use_mkldnn
=
use_mkldnn
;
std
::
vector
<
PaddleTensor
>
outputs
;
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
...
...
@@ -106,6 +106,12 @@ TEST(Analyzer_vis, profile) {
}
}
TEST
(
Analyzer_vis
,
profile
)
{
profile
();
}
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_vis
,
profile_mkldnn
)
{
profile
(
true
/* use_mkldnn */
);
}
#endif
// Check the fuse status
TEST
(
Analyzer_vis
,
fuse_statis
)
{
AnalysisConfig
cfg
;
...
...
@@ -116,25 +122,19 @@ TEST(Analyzer_vis, fuse_statis) {
}
// Compare result of NativeConfig and AnalysisConfig
TEST
(
Analyzer_vis
,
compar
e
)
{
void
compare
(
bool
use_mkldnn
=
fals
e
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
cfg
.
_use_mkldnn
=
use_mkldnn
;
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
SetInput
(
&
input_slots_all
);
CompareNativeAndAnalysis
(
cfg
,
input_slots_all
);
}
// Compare result of NativeConfig and AnalysisConfig with MKLDNN
TEST
(
Analyzer_vis
,
compare
)
{
compare
();
}
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_vis
,
compare_mkldnn
)
{
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
,
true
);
std
::
vector
<
std
::
vector
<
PaddleTensor
>>
input_slots_all
;
SetInput
(
&
input_slots_all
);
CompareNativeAndAnalysis
(
cfg
,
input_slots_all
);
}
TEST
(
Analyzer_vis
,
compare_mkldnn
)
{
compare
(
true
/* use_mkldnn */
);
}
#endif
}
// namespace analysis
...
...
paddle/fluid/inference/tests/api/tester_helper.h
浏览文件 @
e5b4643a
...
...
@@ -35,8 +35,6 @@ DEFINE_bool(test_all_data, false, "Test the all dataset in data file.");
DEFINE_int32
(
num_threads
,
1
,
"Running the inference program in multi-threads."
);
DEFINE_bool
(
use_analysis
,
true
,
"Running the inference program in analysis mode."
);
DEFINE_bool
(
use_MKLDNN
,
false
,
"Running the inference program with mkldnn library."
);
namespace
paddle
{
namespace
inference
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录