-
Notifications
You must be signed in to change notification settings - Fork 5.9k
send_recv variables #7161
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
send_recv variables #7161
Conversation
| using namespace paddle::framework::proto; | ||
| std::istringstream iss(msg.serialized()); | ||
| switch (msg.type()) { | ||
| case sendrecv::VarType::LOD_TENSOR: { |
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.
Each case can have no {}
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.
| msg->set_serialized(oss.str()); | ||
| } | ||
|
|
||
| inline void DeserializeFromMessage(const VariableMessage &msg, |
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.
Should not be inline, this function is too long.
| std::unique_ptr<SendRecvService::Stub> stub_; | ||
| }; | ||
|
|
||
| inline void SerializeToMessage(const std::string &name, |
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.
Should not be inline, this function is too long.
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.
I think inline is a simple way, otherwise, we need a library for SerializeToMessage/DeserializeFromMessage.
paddle/operators/recv_op.cc
Outdated
| platform::DeviceContextPool::Instance(); | ||
| auto &dev_ctx = *pool.Get(dev_place); | ||
| detail::DeserializeFromMessage(v.second, dev_ctx, var); | ||
| /** |
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.
Can remove commented lines.
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.
typhoonzero
left a comment
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.
Need unitest for dealing SelectedRows
|
@typhoonzero |
| add_functor(ctx, *x0, *x1, expect.get()); | ||
|
|
||
| EXPECT_EQ(actual->numel(), expect_value->numel()); | ||
|
|
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.
Also should expect new return_rows().size() == rows1 + rows2
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.
typhoonzero
left a comment
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++
Fixed #6959