Browse Source

support graceful shutdown for ps components

tags/v0.6.0-beta
cristoval 6 years ago
parent
commit
c1332c03e5
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      mindspore/ccsrc/frontend/parallel/ps/parameter_server.h
  2. +1
    -1
      mindspore/ccsrc/frontend/parallel/ps/worker.h

+ 1
- 1
mindspore/ccsrc/frontend/parallel/ps/parameter_server.h View File

@@ -394,7 +394,7 @@ template <typename T>
void ParameterServer<T>::UpdateWeights() {
while (true) {
std::unique_lock<std::mutex> lock(mutex_);
apply_grads_cv_.wait(lock, [this] { return this->ReadyForUpdateWeights() || running_; });
apply_grads_cv_.wait(lock, [this] { return this->ReadyForUpdateWeights() || !running_; });
if (!running_) {
break;
}


+ 1
- 1
mindspore/ccsrc/frontend/parallel/ps/worker.h View File

@@ -81,12 +81,12 @@ void Worker<T>::Run() {
MS_LOG(INFO) << "'Worker is already running.";
return;
}
::ps::Start(0);
if (!::ps::IsWorker()) {
MS_LOG(EXCEPTION) << "The role is not worker.";
}
kv_worker_ = std::make_shared<WorkerProxy<T>>(0, 0, 1);
running_ = true;
::ps::Start(0);
}

template <typename T>


Loading…
Cancel
Save