Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
972c54cd
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
972c54cd
编写于
6月 10, 2019
作者:
G
gongweibao
提交者:
GitHub
6月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix FLAGS_fuse_parameter_memory_size unit from Bytes to MBytes. (#17924)
上级
0a96ec69
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
13 deletion
+13
-13
paddle/fluid/framework/ir/alloc_continuous_space_for_grad_pass.cc
...luid/framework/ir/alloc_continuous_space_for_grad_pass.cc
+11
-11
paddle/fluid/framework/ir/alloc_continuous_space_for_grad_pass.h
...fluid/framework/ir/alloc_continuous_space_for_grad_pass.h
+2
-2
未找到文件。
paddle/fluid/framework/ir/alloc_continuous_space_for_grad_pass.cc
浏览文件 @
972c54cd
...
@@ -23,8 +23,8 @@
...
@@ -23,8 +23,8 @@
#include "paddle/fluid/framework/ir/graph_helper.h"
#include "paddle/fluid/framework/ir/graph_helper.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/op_registry.h"
DEFINE_
uint64
(
fuse_parameter_memory_size
,
0
,
//
Bytes
DEFINE_
double
(
fuse_parameter_memory_size
,
-
1.0
,
// M
Bytes
"fuse_parameter_memory_size is up limited memory size
"
"fuse_parameter_memory_size is up limited memory size
(MB)
"
"of one group parameters' gradient which is the input "
"of one group parameters' gradient which is the input "
"of communication calling(e.g NCCLAllReduce). "
"of communication calling(e.g NCCLAllReduce). "
"The default value is 0, it means that "
"The default value is 0, it means that "
...
@@ -51,13 +51,11 @@ void SetFuseParameterGroupsSize(int group_size) {
...
@@ -51,13 +51,11 @@ void SetFuseParameterGroupsSize(int group_size) {
int
GetFuseParameterGroupsSize
()
{
return
FLAGS_fuse_parameter_groups_size
;
}
int
GetFuseParameterGroupsSize
()
{
return
FLAGS_fuse_parameter_groups_size
;
}
void
SetFuseParameterMemorySize
(
uint64_t
memory_size
)
{
void
SetFuseParameterMemorySize
(
double
memory_size
)
{
FLAGS_fuse_parameter_memory_size
=
memory_size
;
FLAGS_fuse_parameter_memory_size
=
memory_size
;
}
}
uint64_t
GetFuseParameterMemorySize
()
{
double
GetFuseParameterMemorySize
()
{
return
FLAGS_fuse_parameter_memory_size
;
}
return
FLAGS_fuse_parameter_memory_size
;
}
static
framework
::
proto
::
VarType
::
Type
kDefaultDtype
=
static
framework
::
proto
::
VarType
::
Type
kDefaultDtype
=
framework
::
proto
::
VarType
::
Type
::
VarType_Type_BOOL
;
framework
::
proto
::
VarType
::
Type
::
VarType_Type_BOOL
;
...
@@ -230,15 +228,16 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
...
@@ -230,15 +228,16 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
}
}
VLOG
(
10
)
<<
out
.
str
()
VLOG
(
10
)
<<
out
.
str
()
<<
", group size:"
<<
group_grads_params
->
at
(
i
).
size
()
<<
", group size:"
<<
group_grads_params
->
at
(
i
).
size
()
<<
", group memory size:"
<<
gps_size
;
<<
", group memory size:"
<<
static_cast
<
double
>
(
gps_size
)
/
1048576.0
<<
"(MB)"
;
}
}
}
}
void
SetGroupAccordingToMemorySize
(
void
SetGroupAccordingToMemorySize
(
const
std
::
unordered_map
<
std
::
string
,
ir
::
Node
*>
&
var_nodes
,
const
std
::
unordered_map
<
std
::
string
,
ir
::
Node
*>
&
var_nodes
,
details
::
GroupGradsAndParams
*
group_grads_params
)
const
{
details
::
GroupGradsAndParams
*
group_grads_params
)
const
{
const
uint64_t
group_memory_size
=
GetFuseParameterMemorySize
();
const
double
group_memory_size
=
GetFuseParameterMemorySize
();
if
(
group_memory_size
==
0
)
{
if
(
group_memory_size
<=
0.
0
)
{
return
;
return
;
}
}
details
::
GroupGradsAndParams
local_group_grads_params
;
details
::
GroupGradsAndParams
local_group_grads_params
;
...
@@ -271,7 +270,8 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
...
@@ -271,7 +270,8 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
break
;
break
;
}
}
if
(
local_group_memory_size
>=
group_memory_size
)
{
if
(
static_cast
<
double
>
(
local_group_memory_size
)
/
1048576.0
>=
group_memory_size
)
{
break
;
break
;
}
}
}
}
...
@@ -280,7 +280,7 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
...
@@ -280,7 +280,7 @@ class AllocContinuousSpaceForGradPass : public ir::Pass {
std
::
swap
(
*
group_grads_params
,
local_group_grads_params
);
std
::
swap
(
*
group_grads_params
,
local_group_grads_params
);
VLOG
(
10
)
<<
string
::
Sprintf
(
VLOG
(
10
)
<<
string
::
Sprintf
(
"SetGroupAccordingToMemorySize(memory_size: %
d
):"
,
group_memory_size
);
"SetGroupAccordingToMemorySize(memory_size: %
f
):"
,
group_memory_size
);
if
(
VLOG_IS_ON
(
10
))
{
if
(
VLOG_IS_ON
(
10
))
{
PrintGroupInfo
(
var_nodes
,
group_grads_params
);
PrintGroupInfo
(
var_nodes
,
group_grads_params
);
...
...
paddle/fluid/framework/ir/alloc_continuous_space_for_grad_pass.h
浏览文件 @
972c54cd
...
@@ -21,8 +21,8 @@ namespace ir {
...
@@ -21,8 +21,8 @@ namespace ir {
void
SetFuseParameterGroupsSize
(
int
group_size
);
void
SetFuseParameterGroupsSize
(
int
group_size
);
int
GetFuseParameterGroupsSize
();
int
GetFuseParameterGroupsSize
();
void
SetFuseParameterMemorySize
(
uint64_t
memory_size
);
void
SetFuseParameterMemorySize
(
double
memory_size
);
uint64_t
GetFuseParameterMemorySize
();
double
GetFuseParameterMemorySize
();
}
// namespace ir
}
// namespace ir
}
// namespace framework
}
// namespace framework
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录