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

optimize performance of offload in dygraph sharding stage2 #38064

Merged
merged 4 commits into from
Dec 21, 2021
Merged

optimize performance of offload in dygraph sharding stage2 #38064

merged 4 commits into from
Dec 21, 2021

Conversation

haohongxiang
Copy link
Contributor

@haohongxiang haohongxiang commented Dec 12, 2021

PR types

Performance optimization

PR changes

Others

Describe

optimize performance of offload in dygraph sharding stage2

After performance optimization:
1、precision:(PaddleNLP GPT-3 model)
sharding stage2+fp16+gradients accumulation(with offload versus without offload)
image

2、performance:(PaddleNLP GPT-3 model)

  • hidden size=1024,layer_num=4,global batch size=16,micro batch size=2,sharding_degree=2

  • before optimization -- speed: 0.23-0.24 step/s ;ips: 3700-3800 tokens/s

  • after optimization -- speed: 0.58-0.60 step/s ;ips: 9500-9800 tokens/s

3、peek gpu memory: (PaddleNLP GPT-3 model)

  • 0.31B parameters -- 3137 MiB(no difference made by performance optimization)

  • 1.02B parameters -- 5369 MiB(no difference made by performance optimization)

@paddle-bot-old
Copy link

Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

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

from ...meta_parallel.sharding.sharding_utils import Type, device_guard, ShardingClipGrad

# CUDA alignment 256 bytes
alignment = {"gpu": 256, }
alignment = {"gpu": 256, "cpu": 256}
Copy link
Member

Choose a reason for hiding this comment

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

cpu: 256? 这个值不对吧。

@ForFishes ForFishes merged commit f74ebd8 into PaddlePaddle:develop Dec 21, 2021
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.

2 participants