Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d2cdc7e3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
d2cdc7e3
编写于
3月 29, 2023
作者:
S
ShenLiang
提交者:
GitHub
3月 30, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[BugFix]Fix segment fault in order setting (#52293)
* fix bug in proto * add utest
上级
155018ee
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
5 deletion
+25
-5
paddle/fluid/framework/distributed_strategy.proto
paddle/fluid/framework/distributed_strategy.proto
+0
-1
python/paddle/distributed/fleet/base/distributed_strategy.py
python/paddle/distributed/fleet/base/distributed_strategy.py
+9
-1
python/paddle/distributed/fleet/fleet.py
python/paddle/distributed/fleet/fleet.py
+1
-3
python/paddle/fluid/tests/unittests/collective/fleet/test_fleet_distributed_strategy.py
...tests/collective/fleet/test_fleet_distributed_strategy.py
+15
-0
未找到文件。
paddle/fluid/framework/distributed_strategy.proto
浏览文件 @
d2cdc7e3
...
...
@@ -55,7 +55,6 @@ message HybridConfig {
optional
int32
mp_degree
=
2
[
default
=
1
];
optional
int32
pp_degree
=
3
[
default
=
1
];
optional
int32
sharding_degree
=
4
[
default
=
1
];
repeated
string
order
=
5
;
}
message
AMPConfig
{
...
...
python/paddle/distributed/fleet/base/distributed_strategy.py
浏览文件 @
d2cdc7e3
...
...
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import
copy
import
google.protobuf
import
google.protobuf.text_format
...
...
@@ -149,6 +151,7 @@ class DistributedStrategy:
if
_global_flags
().
is_public
(
key
):
self
.
strategy
.
sync_nccl_allreduce
=
bool
(
_global_flags
()[
key
])
self
.
hybrid_parallel_order
=
[
'dp'
,
'pp'
,
'sharding'
,
'mp'
]
self
.
__lock_attr
=
True
logger
.
info
(
"distributed strategy initialized"
)
...
...
@@ -1691,8 +1694,13 @@ class DistributedStrategy:
@
hybrid_configs
.
setter
def
hybrid_configs
(
self
,
configs
):
hybrid_config
=
copy
.
deepcopy
(
configs
)
if
"order"
in
hybrid_config
:
self
.
hybrid_parallel_order
=
hybrid_config
[
"order"
]
hybrid_config
.
pop
(
'order'
)
check_configs_key
(
self
.
strategy
.
hybrid_configs
,
configs
,
"hybrid_configs"
self
.
strategy
.
hybrid_configs
,
hybrid_config
,
"hybrid_configs"
)
assign_configs_value
(
self
.
strategy
.
hybrid_configs
,
configs
)
...
...
python/paddle/distributed/fleet/fleet.py
浏览文件 @
d2cdc7e3
...
...
@@ -412,9 +412,7 @@ class Fleet:
"mp"
:
[
'model'
,
self
.
mp_degree
],
}
order
=
self
.
hybrid_configs
[
"order"
]
if
not
order
:
order
=
[
'dp'
,
'pp'
,
'sharding'
,
'mp'
]
order
=
self
.
_user_defined_strategy
.
hybrid_parallel_order
if
order
[:].
sort
()
!=
list
(
d_hybrid_degree
.
keys
())[:].
sort
():
raise
AssertionError
(
'The order of hybrid_config setting is incorrect.'
...
...
python/paddle/fluid/tests/unittests/collective/fleet/test_fleet_distributed_strategy.py
浏览文件 @
d2cdc7e3
...
...
@@ -84,6 +84,21 @@ class TestStrategyConfig(unittest.TestCase):
self
.
assertEqual
(
strategy
.
hybrid_configs
[
"mp_degree"
],
2
)
self
.
assertEqual
(
strategy
.
hybrid_configs
[
"pp_degree"
],
4
)
def
test_hybrid_parallel_configs_order
(
self
):
strategy
=
paddle
.
distributed
.
fleet
.
DistributedStrategy
()
strategy
.
hybrid_configs
=
{
"dp_degree"
:
1
,
"mp_degree"
:
2
,
"pp_degree"
:
4
,
"order"
:
[
'sharding'
,
'mp'
,
'dp'
,
'pp'
],
}
self
.
assertEqual
(
strategy
.
hybrid_configs
[
"dp_degree"
],
1
)
self
.
assertEqual
(
strategy
.
hybrid_configs
[
"mp_degree"
],
2
)
self
.
assertEqual
(
strategy
.
hybrid_configs
[
"pp_degree"
],
4
)
self
.
assertEqual
(
strategy
.
hybrid_parallel_order
,
[
'sharding'
,
'mp'
,
'dp'
,
'pp'
]
)
def
test_localsgd
(
self
):
strategy
=
paddle
.
distributed
.
fleet
.
DistributedStrategy
()
strategy
.
localsgd
=
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录