Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
122b37ce
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
122b37ce
编写于
12月 04, 2019
作者:
P
Pei Yang
提交者:
GitHub
12月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make config option DisableGlogInfo() able to mute all inference logs (#21318)
* make DisableGlogInfo able to mute all logs in inference.
上级
4c9b3daf
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
26 addition
and
14 deletion
+26
-14
paddle/fluid/framework/naive_executor.cc
paddle/fluid/framework/naive_executor.cc
+2
-3
paddle/fluid/inference/analysis/analyzer.cc
paddle/fluid/inference/analysis/analyzer.cc
+4
-1
paddle/fluid/inference/analysis/analyzer_tester.cc
paddle/fluid/inference/analysis/analyzer_tester.cc
+2
-0
paddle/fluid/inference/analysis/argument.h
paddle/fluid/inference/analysis/argument.h
+3
-0
paddle/fluid/inference/analysis/ir_pass_manager.cc
paddle/fluid/inference/analysis/ir_pass_manager.cc
+2
-1
paddle/fluid/inference/analysis/ir_pass_manager.h
paddle/fluid/inference/analysis/ir_pass_manager.h
+1
-0
paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
...id/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
+1
-2
paddle/fluid/inference/api/analysis_predictor.cc
paddle/fluid/inference/api/analysis_predictor.cc
+3
-2
paddle/fluid/platform/init.cc
paddle/fluid/platform/init.cc
+8
-5
未找到文件。
paddle/fluid/framework/naive_executor.cc
浏览文件 @
122b37ce
...
...
@@ -102,9 +102,8 @@ void NaiveExecutor::CreateOps(const ProgramDesc &desc, int block_id,
for
(
const
auto
&
op_desc
:
desc
.
Block
(
block_id
).
AllOps
())
{
if
(
!
with_feed_fetch_ops
&&
(
op_desc
->
Type
()
==
"feed"
||
op_desc
->
Type
()
==
"fetch"
))
{
string
::
PrettyLogEndl
(
string
::
Style
::
detail
(),
"--- skip [%s], %s -> %s"
,
op_desc
->
Input
(
"X"
)[
0
],
op_desc
->
Type
(),
op_desc
->
Output
(
"Out"
)[
0
]);
LOG
(
INFO
)
<<
"--- skip ["
<<
op_desc
->
Input
(
"X"
)[
0
]
<<
"], "
<<
op_desc
->
Type
()
<<
" -> "
<<
op_desc
->
Output
(
"Out"
)[
0
];
continue
;
}
ops_
.
emplace_back
(
OpRegistry
::
CreateOp
(
*
op_desc
));
...
...
paddle/fluid/inference/analysis/analyzer.cc
浏览文件 @
122b37ce
...
...
@@ -29,8 +29,11 @@ void Analyzer::Run(Argument *argument) { RunAnalysis(argument); }
void
Analyzer
::
RunAnalysis
(
Argument
*
argument
)
{
PADDLE_ENFORCE
(
argument
->
analysis_passes_valid
(),
"analsis_passes is not valid in the argument."
);
const
bool
disable_logs
=
argument
->
disable_logs
();
for
(
auto
&
pass
:
argument
->
analysis_passes
())
{
string
::
PrettyLogH1
(
"--- Running analysis [%s]"
,
pass
);
if
(
!
disable_logs
)
{
string
::
PrettyLogH1
(
"--- Running analysis [%s]"
,
pass
);
}
if
(
!
argument
->
enable_analysis_optim
()
&&
pass
==
"ir_analysis_pass"
)
continue
;
...
...
paddle/fluid/inference/analysis/analyzer_tester.cc
浏览文件 @
122b37ce
...
...
@@ -29,6 +29,7 @@ using namespace framework; // NOLINT
TEST
(
Analyzer
,
analysis_without_tensorrt
)
{
Argument
argument
;
argument
.
SetDisableLogs
(
false
);
argument
.
SetModelDir
(
FLAGS_inference_model_dir
);
argument
.
SetEnableAnalysisOptim
(
false
);
argument
.
SetUseGPU
(
false
);
...
...
@@ -41,6 +42,7 @@ TEST(Analyzer, analysis_without_tensorrt) {
TEST
(
Analyzer
,
analysis_with_tensorrt
)
{
Argument
argument
;
argument
.
SetDisableLogs
(
false
);
argument
.
SetEnableAnalysisOptim
(
false
);
argument
.
SetTensorRtMaxBatchSize
(
3
);
argument
.
SetTensorRtWorkspaceSize
(
1
<<
20
);
...
...
paddle/fluid/inference/analysis/argument.h
浏览文件 @
122b37ce
...
...
@@ -149,6 +149,9 @@ struct Argument {
DECL_ARGUMENT_FIELD
(
analysis_passes
,
AnalysisPasses
,
std
::
vector
<
std
::
string
>
);
// whether to mute all logs in inference.
DECL_ARGUMENT_FIELD
(
disable_logs
,
DisableLogs
,
bool
);
// Pass a set of op types to enable its mkldnn kernel
DECL_ARGUMENT_FIELD
(
mkldnn_enabled_op_types
,
MKLDNNEnabledOpTypes
,
std
::
unordered_set
<
std
::
string
>
);
...
...
paddle/fluid/inference/analysis/ir_pass_manager.cc
浏览文件 @
122b37ce
...
...
@@ -147,6 +147,7 @@ void IRPassManager::CreatePasses(Argument *argument,
pass
->
Set
(
"auto_config_layout"
,
new
bool
(
argument
->
anakin_auto_config_layout
()));
}
disable_logs_
=
argument
->
disable_logs
();
if
(
pass_name
==
"fc_fuse_pass"
)
{
pass
->
Set
(
"use_gpu"
,
new
bool
(
argument
->
use_gpu
()));
}
...
...
@@ -164,7 +165,7 @@ std::unique_ptr<Graph> IRPassManager::Apply(std::unique_ptr<Graph> graph) {
PADDLE_ENFORCE
(
graph
.
get
());
// Apply all the passes
for
(
const
auto
&
pass
:
passes_
)
{
if
(
pass
->
Type
()
!=
"graph_viz_pass"
)
{
if
(
pass
->
Type
()
!=
"graph_viz_pass"
&&
!
disable_logs_
)
{
PrettyLogEndl
(
Style
::
H2
(),
"--- Running IR pass [%s]"
,
pass
->
Type
());
}
graph
.
reset
(
pass
->
Apply
(
graph
.
release
()));
...
...
paddle/fluid/inference/analysis/ir_pass_manager.h
浏览文件 @
122b37ce
...
...
@@ -56,6 +56,7 @@ class IRPassManager final {
std
::
unique_ptr
<
Graph
>
graph_
;
std
::
vector
<
std
::
unique_ptr
<
framework
::
ir
::
Pass
>>
passes_
;
bool
disable_logs_
{
false
};
};
}
// namespace analysis
...
...
paddle/fluid/inference/analysis/ir_passes/tensorrt_subgraph_pass.cc
浏览文件 @
122b37ce
...
...
@@ -108,8 +108,7 @@ void TensorRtSubgraphPass::CreateTensorRTOp(
framework
::
BlockDesc
block_desc
(
nullptr
,
&
block_proto
);
block_desc
.
Proto
()
->
set_parent_idx
(
-
1
);
block_desc
.
Proto
()
->
set_idx
(
0
);
string
::
PrettyLogDetail
(
"--- detect a sub-graph with %d nodes"
,
subgraph
.
size
());
LOG
(
INFO
)
<<
"--- detect a sub-graph with "
<<
subgraph
.
size
()
<<
" nodes"
;
for
(
auto
*
node
:
subgraph
)
{
auto
*
new_block_op
=
new_block
->
AppendOp
();
...
...
paddle/fluid/inference/api/analysis_predictor.cc
浏览文件 @
122b37ce
...
...
@@ -452,6 +452,7 @@ void AnalysisPredictor::PrepareArgument() {
passes
.
clear
();
LOG
(
INFO
)
<<
"ir_optim is turned off, no IR pass will be executed"
;
}
argument_
.
SetDisableLogs
(
config_
.
glog_info_disabled
());
argument_
.
SetIrAnalysisPasses
(
passes
);
argument_
.
SetAnalysisPasses
(
config_
.
pass_builder
()
->
AnalysisPasses
());
argument_
.
SetScopeNotOwned
(
scope_
.
get
());
...
...
@@ -508,10 +509,10 @@ std::unique_ptr<PaddlePredictor> CreatePaddlePredictor<
framework
::
InitGflags
(
flags
);
}
}
framework
::
InitGLOG
(
""
);
if
(
config
.
glog_info_disabled
())
{
FLAGS_logtostderr
=
1
;
FLAGS_minloglevel
=
google
::
WARNING
;
LOG
(
WARNING
)
<<
" - GLOG's LOG(INFO) is disabled."
;
FLAGS_minloglevel
=
2
;
// GLOG_ERROR
}
std
::
unique_ptr
<
PaddlePredictor
>
predictor
(
new
AnalysisPredictor
(
config
));
...
...
paddle/fluid/platform/init.cc
浏览文件 @
122b37ce
...
...
@@ -46,6 +46,7 @@ namespace framework {
#endif
std
::
once_flag
gflags_init_flag
;
std
::
once_flag
glog_init_flag
;
std
::
once_flag
p2p_init_flag
;
std
::
once_flag
glog_warning_once_flag
;
...
...
@@ -223,13 +224,15 @@ void SignalHandle(const char *data, int size) {
#endif
void
InitGLOG
(
const
std
::
string
&
prog_name
)
{
// glog will not hold the ARGV[0] inside.
// Use strdup to alloc a new string.
google
::
InitGoogleLogging
(
strdup
(
prog_name
.
c_str
()));
std
::
call_once
(
glog_init_flag
,
[
&
]()
{
// glog will not hold the ARGV[0] inside.
// Use strdup to alloc a new string.
google
::
InitGoogleLogging
(
strdup
(
prog_name
.
c_str
()));
#ifndef _WIN32
google
::
InstallFailureSignalHandler
();
google
::
InstallFailureWriter
(
&
SignalHandle
);
google
::
InstallFailureSignalHandler
();
google
::
InstallFailureWriter
(
&
SignalHandle
);
#endif
});
}
}
// namespace framework
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录