Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
937e21a3
P
Paddle
项目概览
PaddlePaddle
/
Paddle
9 个月 前同步成功
通知
2282
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
937e21a3
编写于
7月 27, 2021
作者:
Y
Yuang Liu
提交者:
GitHub
7月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
supports mp and dp hybrid (#34377)
上级
846be131
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
21 addition
and
3 deletion
+21
-3
python/paddle/distributed/fleet/base/fleet_base.py
python/paddle/distributed/fleet/base/fleet_base.py
+19
-3
python/paddle/fluid/tests/unittests/test_fleet_static_mp_layers.py
...ddle/fluid/tests/unittests/test_fleet_static_mp_layers.py
+2
-0
未找到文件。
python/paddle/distributed/fleet/base/fleet_base.py
浏览文件 @
937e21a3
...
@@ -269,11 +269,27 @@ class Fleet(object):
...
@@ -269,11 +269,27 @@ class Fleet(object):
cg
.
set_comm_group
(
'global'
,
global_rank
,
global_world_size
,
cg
.
set_comm_group
(
'global'
,
global_rank
,
global_world_size
,
global_ring_id
,
global_ranks
)
global_ring_id
,
global_ranks
)
use_tensor_parallel
=
self
.
_user_defined_strategy
.
tensor_parallel
use_mp
=
use_sharding
or
use_tensor_parallel
# hybrid group
# hybrid group
if
use_sharding
is
False
:
return
if
use_mp
is
False
:
return
mp_degree_sharding
=
1
mp_degree_tensor_parallel
=
1
if
use_sharding
:
sharding_configs
=
self
.
_user_defined_strategy
.
sharding_configs
mp_degree_sharding
=
int
(
sharding_configs
[
'mp_degree'
])
if
use_tensor_parallel
:
tensor_parallel_configs
=
self
.
_user_defined_strategy
.
tensor_parallel_configs
mp_degree_tensor_parallel
=
int
(
tensor_parallel_configs
[
'tensor_parallel_degree'
])
if
use_sharding
and
use_tensor_parallel
:
assert
mp_degree_sharding
==
mp_degree_tensor_parallel
sharding_configs
=
self
.
_user_defined_strategy
.
sharding_configs
mp_degree
=
mp_degree_sharding
if
use_sharding
else
mp_degree_tensor_parallel
mp_degree
=
int
(
sharding_configs
[
'mp_degree'
])
if
mp_degree
>
1
:
if
mp_degree
>
1
:
assert
global_world_size
%
mp_degree
==
0
assert
global_world_size
%
mp_degree
==
0
...
...
python/paddle/fluid/tests/unittests/test_fleet_static_mp_layers.py
浏览文件 @
937e21a3
...
@@ -84,6 +84,8 @@ class TestDistTraning(unittest.TestCase):
...
@@ -84,6 +84,8 @@ class TestDistTraning(unittest.TestCase):
"mp_degree"
:
self
.
model_parallel_size
,
"mp_degree"
:
self
.
model_parallel_size
,
"sharding_degree"
:
2
,
"sharding_degree"
:
2
,
}
}
strategy
.
tensor_parallel
=
True
strategy
.
tensor_parallel_configs
=
{
"tensor_parallel_degree"
:
2
}
fleet
.
init
(
is_collective
=
True
,
strategy
=
strategy
)
fleet
.
init
(
is_collective
=
True
,
strategy
=
strategy
)
def
get_program
(
self
):
def
get_program
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录