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

sharding supports reduce_avg communication #62147

Merged
merged 10 commits into from
Mar 6, 2024

Conversation

zhangting2020
Copy link
Contributor

@zhangting2020 zhangting2020 commented Feb 27, 2024

PR types

Performance optimization

PR changes

Others

Description

sharding supports reduce_avg communication

Pcard-70426

收敛性测试,llama2-7b
image

中文文档:PaddlePaddle/docs#6514

Copy link

paddle-bot bot commented Feb 27, 2024

你的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.

@@ -55,6 +56,17 @@ def all_reduce(tensor, op=ReduceOp.SUM, group=None, sync_op=True):
>>> print(data)
>>> # [[5, 7, 9], [5, 7, 9]] (2 GPUs)
"""
# AVG is only supported when nccl >= 2.10
if op == ReduceOp.AVG and paddle.base.core.nccl_version() < 21000:
tensor.scale_(1.0 / group.nranks)
Copy link
Member

Choose a reason for hiding this comment

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

group为None的时候,需要特殊处理。

self.use_reduce_avg = (
strategy.hybrid_configs['sharding_configs'].use_reduce_avg
and paddle.base.core.nccl_version() >= 21000
)
Copy link
Member

Choose a reason for hiding this comment

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

开启了use_reduce_avg,实际nccl版本不符合,是不是需要有报错或者warning

# AVG is only supported when nccl >= 2.10
if op == ReduceOp.AVG and paddle.base.core.nccl_version() < 21000:
group = (
paddle.distributed.collective.new_group(
Copy link
Member

Choose a reason for hiding this comment

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

直接那global group吧,不需要新建一个group吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

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

Copy link
Contributor

@sunzhongkai588 sunzhongkai588 left a comment

Choose a reason for hiding this comment

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

LGTM for docs

@zhangting2020 zhangting2020 merged commit 2e1899e into PaddlePaddle:develop Mar 6, 2024
30 checks passed
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.

3 participants