-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
fix MultiGradientMachine train and infer #2595
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -171,6 +171,12 @@ MultiGradientMachine::MultiGradientMachine(const ModelConfig& config, | |
} | ||
} | ||
|
||
MultiGradientMachine::~MultiGradientMachine() { | ||
for (auto& thread : threads_) { | ||
thread->stop(); | ||
} | ||
} | ||
|
||
std::vector<const std::vector<ParameterPtr>*> | ||
MultiGradientMachine::getSlaveParameters() { | ||
std::vector<const std::vector<ParameterPtr>*> vec; | ||
|
@@ -326,12 +332,6 @@ void MultiGradientMachine::onPassEnd() { | |
} | ||
} | ||
|
||
void MultiGradientMachine::finish() { | ||
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 remove 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. After move thread->stop() to destructor, finish() seems has no use. 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. Have add finish back |
||
for (auto& thread : threads_) { | ||
thread->stop(); | ||
} | ||
} | ||
|
||
Evaluator* MultiGradientMachine::makeEvaluator() const { | ||
return threads_[0]->getGradientMachine()->makeEvaluator(); | ||
} | ||
|
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.
Maybe in destructor, we should check whether MultiGradientMachine is
finished
or not?If MultiGradientMachine is not finish, then invoke
this->finish();