Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoParallel] PHI copy support auto parallel #58436

Merged

Conversation

wanghuancoder
Copy link
Contributor

@wanghuancoder wanghuancoder commented Oct 27, 2023

PR types

Others

PR changes

Others

Description

PHI API copy_to 支持 AutoParallel

Pcard-73145

@paddle-bot
Copy link

paddle-bot bot commented Oct 27, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added the contributor External developers label Oct 27, 2023
@@ -130,6 +130,11 @@ if(WITH_DISTRIBUTE AND WITH_GPU)
py_test_modules(test_gpt_with_newir MODULES test_gpt_with_newir)
set_tests_properties(test_gpt_with_newir
PROPERTIES LABELS "RUN_TYPE=EXCLUSIVE" TIMEOUT 100)
py_test_modules(test_semi_auto_parallel_functional_in_single_card MODULES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是单卡的话,可以看下注释,它这个cmake了做了分区,单卡的测试在最后

def test_tensor_copy_to(self):
mesh = dist.ProcessMesh([0, 1], dim_names=["x"])
dense_tensor = paddle.randn([10, 20])
dist_tensor = dist.shard_tensor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

涉及切分的话,就有通信,单卡应该跑不过才对,或者用[None, None]不切分

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phi/api下面的文件,在WITH_DISTRIBUTED=OFF的cmake参数下,需要用ifdef PADDLE_WITH_DISTRIBUTE宏,条件编译DistTensor相关分支

dense_tensor,
dist_attr=dist.DistAttr(mesh=mesh, sharding_specs=[None, None]),
)
dist_tensor._copy_to(paddle.CPUPlace(), True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy的语义需要确定:1、mesh是否和设备相关,转cpu后,动半还缺少mesh和device的映射关系。2、如果是不同的distattr Dtensor,需要reshard 实现copy转换。

Copy link
Member

@ForFishes ForFishes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanghuancoder wanghuancoder merged commit 850fc82 into PaddlePaddle:develop Oct 30, 2023
28 checks passed
@paddle-bot paddle-bot bot removed the contributor External developers label Nov 3, 2023
zeroRains pushed a commit to zeroRains/Paddle that referenced this pull request Nov 8, 2023
danleifeng pushed a commit to danleifeng/Paddle that referenced this pull request Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants