Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
80eff266
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
80eff266
编写于
1月 31, 2018
作者:
D
dzhwinter
提交者:
GitHub
1月 31, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
"unify flags" (#7973)
* "unify flags" * "fix init"
上级
e261c792
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
12 addition
and
14 deletion
+12
-14
paddle/framework/executor.cc
paddle/framework/executor.cc
+3
-3
paddle/framework/operator.cc
paddle/framework/operator.cc
+2
-4
paddle/framework/scope.cc
paddle/framework/scope.cc
+5
-3
python/paddle/v2/fluid/__init__.py
python/paddle/v2/fluid/__init__.py
+2
-4
未找到文件。
paddle/framework/executor.cc
浏览文件 @
80eff266
...
@@ -25,7 +25,7 @@ limitations under the License. */
...
@@ -25,7 +25,7 @@ limitations under the License. */
#include "paddle/platform/place.h"
#include "paddle/platform/place.h"
#include "paddle/platform/profiler.h"
#include "paddle/platform/profiler.h"
DECLARE_bool
(
do_memory_
benchmark
);
DECLARE_bool
(
benchmark
);
DEFINE_bool
(
check_nan_inf
,
false
,
DEFINE_bool
(
check_nan_inf
,
false
,
"Checking whether operator produce NAN/INF or not. It will be "
"Checking whether operator produce NAN/INF or not. It will be "
"extremely slow so please use this flag wisely."
);
"extremely slow so please use this flag wisely."
);
...
@@ -125,7 +125,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
...
@@ -125,7 +125,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
op
->
Run
(
*
local_scope
,
place_
);
op
->
Run
(
*
local_scope
,
place_
);
VLOG
(
3
)
<<
op
->
DebugStringEx
(
local_scope
);
VLOG
(
3
)
<<
op
->
DebugStringEx
(
local_scope
);
if
(
FLAGS_
do_memory_
benchmark
)
{
if
(
FLAGS_benchmark
)
{
VLOG
(
2
)
<<
"Memory used after operator "
+
op
->
Type
()
+
" running: "
VLOG
(
2
)
<<
"Memory used after operator "
+
op
->
Type
()
+
" running: "
<<
memory
::
memory_usage
(
place_
);
<<
memory
::
memory_usage
(
place_
);
}
}
...
@@ -142,7 +142,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
...
@@ -142,7 +142,7 @@ void Executor::Run(const ProgramDesc& pdesc, Scope* scope, int block_id,
if
(
create_vars
&&
create_local_scope
)
{
if
(
create_vars
&&
create_local_scope
)
{
scope
->
DeleteScope
(
local_scope
);
scope
->
DeleteScope
(
local_scope
);
}
}
if
(
FLAGS_
do_memory_
benchmark
)
{
if
(
FLAGS_benchmark
)
{
VLOG
(
2
)
<<
"-------------------------------------------------------"
;
VLOG
(
2
)
<<
"-------------------------------------------------------"
;
VLOG
(
2
)
<<
"Memory used after deleting local scope: "
VLOG
(
2
)
<<
"Memory used after deleting local scope: "
<<
memory
::
memory_usage
(
place_
);
<<
memory
::
memory_usage
(
place_
);
...
...
paddle/framework/operator.cc
浏览文件 @
80eff266
...
@@ -22,9 +22,7 @@ limitations under the License. */
...
@@ -22,9 +22,7 @@ limitations under the License. */
#include "paddle/framework/shape_inference.h"
#include "paddle/framework/shape_inference.h"
#include "paddle/framework/var_type.h"
#include "paddle/framework/var_type.h"
DEFINE_bool
(
op_sync
,
false
,
DECLARE_bool
(
benchmark
);
"Default cuda is asynchronous device, set to True will"
"force op run in synchronous mode."
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -531,7 +529,7 @@ void OperatorWithKernel::Run(const Scope& scope,
...
@@ -531,7 +529,7 @@ void OperatorWithKernel::Run(const Scope& scope,
ExecutionContext
(
*
this
,
new_scope
,
*
new_dev_ctx
));
ExecutionContext
(
*
this
,
new_scope
,
*
new_dev_ctx
));
/*For profiling/benchmark only*/
/*For profiling/benchmark only*/
if
(
FLAGS_
op_sync
)
{
if
(
FLAGS_
benchmark
)
{
new_dev_ctx
->
Wait
();
new_dev_ctx
->
Wait
();
}
}
}
}
...
...
paddle/framework/scope.cc
浏览文件 @
80eff266
...
@@ -20,9 +20,11 @@ limitations under the License. */
...
@@ -20,9 +20,11 @@ limitations under the License. */
#include "paddle/framework/threadpool.h"
#include "paddle/framework/threadpool.h"
#include "paddle/string/printf.h"
#include "paddle/string/printf.h"
DEFINE_bool
(
do_memory_
benchmark
,
false
,
DEFINE_bool
(
benchmark
,
false
,
"Doing memory benchmark. It will make deleting scope synchronized, "
"Doing memory benchmark. It will make deleting scope synchronized, "
"and add some memory usage logs"
);
"and add some memory usage logs."
"Default cuda is asynchronous device, set to True will"
"force op run in synchronous mode."
);
namespace
paddle
{
namespace
paddle
{
namespace
framework
{
namespace
framework
{
...
@@ -93,7 +95,7 @@ void Scope::DeleteScope(Scope* scope) {
...
@@ -93,7 +95,7 @@ void Scope::DeleteScope(Scope* scope) {
PADDLE_ENFORCE
(
it
!=
this
->
kids_
.
end
(),
"Cannot find %p as kid scope"
,
scope
);
PADDLE_ENFORCE
(
it
!=
this
->
kids_
.
end
(),
"Cannot find %p as kid scope"
,
scope
);
this
->
kids_
.
erase
(
it
);
this
->
kids_
.
erase
(
it
);
// When making memory benchmark on Fluid, we have to delete scope sync.
// When making memory benchmark on Fluid, we have to delete scope sync.
if
(
FLAGS_
do_memory_
benchmark
)
{
if
(
FLAGS_benchmark
)
{
delete
scope
;
delete
scope
;
}
else
{
}
else
{
Async
([
scope
]
{
delete
scope
;
});
Async
([
scope
]
{
delete
scope
;
});
...
...
python/paddle/v2/fluid/__init__.py
浏览文件 @
80eff266
...
@@ -86,11 +86,9 @@ def __bootstrap__():
...
@@ -86,11 +86,9 @@ def __bootstrap__():
os
.
environ
[
'OMP_NUM_THREADS'
]
=
str
(
num_threads
)
os
.
environ
[
'OMP_NUM_THREADS'
]
=
str
(
num_threads
)
read_env_flags
=
[
read_env_flags
=
[
'use_pinned_memory'
,
'check_nan_inf'
,
'benchmark'
]
'use_pinned_memory'
,
'check_nan_inf'
,
'do_memory_benchmark'
]
if
core
.
is_compiled_with_cuda
():
if
core
.
is_compiled_with_cuda
():
read_env_flags
+=
[
'fraction_of_gpu_memory_to_use'
,
'op_sync'
]
read_env_flags
+=
[
'fraction_of_gpu_memory_to_use'
]
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
core
.
init_gflags
([
sys
.
argv
[
0
]]
+
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
[
"--tryfromenv="
+
","
.
join
(
read_env_flags
)])
core
.
init_glog
(
sys
.
argv
[
0
])
core
.
init_glog
(
sys
.
argv
[
0
])
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录