diff --git a/mindspore/ccsrc/frontend/parallel/ps/parameter_server.h b/mindspore/ccsrc/frontend/parallel/ps/parameter_server.h index 22a62bf651..429cf59c3c 100755 --- a/mindspore/ccsrc/frontend/parallel/ps/parameter_server.h +++ b/mindspore/ccsrc/frontend/parallel/ps/parameter_server.h @@ -394,7 +394,7 @@ template void ParameterServer::UpdateWeights() { while (true) { std::unique_lock 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; } diff --git a/mindspore/ccsrc/frontend/parallel/ps/worker.h b/mindspore/ccsrc/frontend/parallel/ps/worker.h index e47b387c95..d7f0bb6df5 100644 --- a/mindspore/ccsrc/frontend/parallel/ps/worker.h +++ b/mindspore/ccsrc/frontend/parallel/ps/worker.h @@ -81,12 +81,12 @@ void Worker::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>(0, 0, 1); running_ = true; - ::ps::Start(0); } template