Skip to content

Conversation

panyx0718
Copy link
Contributor

@panyx0718 panyx0718 commented Jun 6, 2018

No description provided.

@panyx0718 panyx0718 requested review from gongweibao and typhoonzero and removed request for typhoonzero June 7, 2018 01:06
@typhoonzero typhoonzero requested review from Yancey0623 and removed request for gongweibao and typhoonzero June 7, 2018 01:29
// mini-batch.
// TODO(Yancey1989): move the reset action into an operator, we couldn't
// have any hide logic in the operator.
for (framework::Variable *var : sparse_vars) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is needed by sparse updates? @Yancey1989

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, sparse_vars is need by remote sparse update, we need to clear it after each mini-bach, because not each sparse gradient var would been send to the pserver, the clear operation would avoid reuse the old var leaved from pre-mini-batch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sparse_vars seems always empty because it's not mutated?

Copy link
Contributor

Choose a reason for hiding this comment

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

It would been update if the received var type is SelectedRows

if (invar->IsType<framework::SelectedRows>()) {
std::unique_lock<std::mutex> lock(sparse_var_mutex_);
sparse_vars_.push_back(invar);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sparse_vars_ is exposed by sparse_vars(), but it seems not called by anyone?

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it, you're right, seems it's a bug, we need to iterator sparse_vars_ instead of sparse_var which defined in listen_and_serv_op.

@panyx0718 panyx0718 changed the title remove some seems unused codes. Fix sparse vars usage for dist train Jun 8, 2018
Copy link
Contributor

@Yancey0623 Yancey0623 left a comment

Choose a reason for hiding this comment

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

LGTM

@panyx0718 panyx0718 merged commit 259e63d into PaddlePaddle:develop Jun 8, 2018
@panyx0718
Copy link
Contributor Author

this feature should be covered by our ut in the future

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.

3 participants