-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
@@ -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) |
There was a problem hiding this comment.
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 | ||
) |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
直接那global group吧,不需要新建一个group吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for docs
PR types
Performance optimizationPR changes
OthersDescription
sharding supports reduce_avg communicationPcard-70426
收敛性测试,llama2-7b

中文文档:PaddlePaddle/docs#6514