-
Notifications
You must be signed in to change notification settings - Fork 5.9k
[hybrid] out data parallel as optimizer sharding parallel #35593
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
Merged
wangxicoding
merged 23 commits into
PaddlePaddle:develop
from
wangxicoding:out_dp_as_optimzier_sharding
Sep 15, 2021
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6fbdd8a
out dp as optimizer sharding
wangxicoding 81240b9
refine
wangxicoding 9df39b4
fix adapt amp clip
wangxicoding d14845b
add reduce and broadcast op
wangxicoding bbbb760
reserved param
wangxicoding 6ce85dc
fix cast
wangxicoding d6732cc
fix c_broadcast root
wangxicoding 6bc6962
fix startup program
wangxicoding 39a5626
fix prune and broadcast order
wangxicoding 6ea8f6a
fix
wangxicoding 408f217
fix
wangxicoding d534f9f
add fuse reduce_sum
wangxicoding b5ba5b1
add fuse broadcast
wangxicoding 31101be
add fuse broadcast
wangxicoding ccb3aa4
optimizer sharding support fuse gradient merge
wangxicoding 09cc1ac
fix insert_num
wangxicoding fcf1e8d
clean
wangxicoding 01af762
fix sharding prune
wangxicoding c8974c8
fix sharding prune
wangxicoding 6d60e93
fix boundary
wangxicoding 6a35978
add optimizer sharding unittest
wangxicoding b042db4
fix ci
wangxicoding f5a5597
fix develop Linear matmul_v2
wangxicoding File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,27 +26,28 @@ class CheckFiniteAndUnscaleOp : public framework::OperatorWithKernel { | |
| : OperatorWithKernel(type, inputs, outputs, attrs) {} | ||
|
|
||
| void InferShape(framework::InferShapeContext* ctx) const override { | ||
| OP_INOUT_CHECK(ctx->HasInputs("X"), "Input", "X", | ||
| "check_finite_and_unscale"); | ||
| OP_INOUT_CHECK(ctx->HasOutputs("Out"), "Output", "Out", | ||
| "check_finite_and_unscale"); | ||
| PADDLE_ENFORCE_EQ( | ||
| ctx->Inputs("X").size(), ctx->Outputs("Out").size(), | ||
| platform::errors::InvalidArgument( | ||
| "The input(X) and output(Out) should have same size in " | ||
| "Operator(check_finite_and_unscale), size of input(X) is %d " | ||
| "and size of output(Out) is %d.", | ||
| ctx->Inputs("X").size(), ctx->Outputs("Out").size())); | ||
| auto x_dims = ctx->GetInputsDim("X"); | ||
| ctx->SetOutputsDim("Out", x_dims); | ||
| if (ctx->HasInputs("X") || ctx->HasOutputs("Out")) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why supports op without input/output?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| PADDLE_ENFORCE_EQ( | ||
| ctx->Inputs("X").size(), ctx->Outputs("Out").size(), | ||
| platform::errors::InvalidArgument( | ||
| "The input(X) and output(Out) should have same size in " | ||
| "Operator(check_finite_and_unscale), size of input(X) is %d " | ||
| "and size of output(Out) is %d.", | ||
| ctx->Inputs("X").size(), ctx->Outputs("Out").size())); | ||
| auto x_dims = ctx->GetInputsDim("X"); | ||
| ctx->SetOutputsDim("Out", x_dims); | ||
| } | ||
| ctx->SetOutputDim("FoundInfinite", {1}); | ||
| } | ||
|
|
||
| protected: | ||
| framework::OpKernelType GetExpectedKernelType( | ||
| const framework::ExecutionContext& ctx) const override { | ||
| return framework::OpKernelType( | ||
| OperatorWithKernel::IndicateVarDataType(ctx, "X"), ctx.GetPlace()); | ||
| auto dtype = framework::proto::VarType::FP32; | ||
| if (ctx.MultiInputVar("X").size() >= 1) { | ||
| dtype = OperatorWithKernel::IndicateVarDataType(ctx, "X"); | ||
| } | ||
| return framework::OpKernelType(dtype, ctx.GetPlace()); | ||
| } | ||
| }; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

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.
why not new a config call stage, and allow two value: stage=1 and stage=3 by now
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.
update later