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

[Cherry-pick] Add config for broadcast data in model parallel #57843

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions paddle/fluid/framework/distributed_strategy.proto
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ message MpConfig {
optional bool sync_grad= 2 [ default = false ];
optional bool sync_moment= 3 [ default = false ];
optional string sync_mode= 4 [ default = 'broadcast' ];
// Broadcast mp input data
optional bool need_broadcast_data=8 [default = true];
Copy link
Contributor

Choose a reason for hiding this comment

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

broadcast_data_for_tp?

Copy link
Member Author

Choose a reason for hiding this comment

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

在mp的cofig里面,应该不需要再补“for_tp”

}

message PpConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,8 @@ def _prepare_for_model(self):
logger.info("mp's parameters is ready")

def _pre_forward(self, *inputs, **kwargs):
logger.debug("mp start broadcast input data")
return broadcast_input_data(self._hcg, *inputs, **kwargs)
mp_configs = self._strategy.hybrid_configs["mp_configs"]
need_broadcast_data = mp_configs.need_broadcast_data
if need_broadcast_data:
logger.debug("mp start broadcast input data")
return broadcast_input_data(self._hcg, *inputs, **kwargs)