From 97d5cd30f06e1b28305515feacc4bac7d24b7de5 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Sat, 2 Feb 2019 17:06:36 +0800 Subject: [PATCH] make pull dense worker work --- paddle/fluid/framework/device_worker.h | 10 +++++----- paddle/fluid/framework/downpour_worker.cc | 2 -- paddle/fluid/framework/pull_dense_worker.cc | 6 ++++++ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/paddle/fluid/framework/device_worker.h b/paddle/fluid/framework/device_worker.h index f663fa89f..c9997b5ee 100644 --- a/paddle/fluid/framework/device_worker.h +++ b/paddle/fluid/framework/device_worker.h @@ -66,11 +66,11 @@ class PullDenseWorker { Scope* root_scope_; bool running_; - std::map last_versions_; - std::map current_version_; - std::mutex mutex_for_version_; - std::map> training_versions_; - std::map> dense_value_names_; + static std::map last_versions_; + static std::map current_version_; + static std::mutex mutex_for_version_; + static std::map> training_versions_; + static std::map> dense_value_names_; std::thread t_; int thread_num_; diff --git a/paddle/fluid/framework/downpour_worker.cc b/paddle/fluid/framework/downpour_worker.cc index 62126072c..238bf0381 100644 --- a/paddle/fluid/framework/downpour_worker.cc +++ b/paddle/fluid/framework/downpour_worker.cc @@ -213,12 +213,10 @@ void DownpourWorker::TrainFiles() { push_sparse_status_.resize(0); } - /* for (size_t i = 0; i < param_.dense_table_size(); ++i) { uint64_t tid = static_cast(param_.dense_table(i).table_id()); pull_dense_worker_->IncreaseThreadVersion(thread_id_, tid); } - */ thread_scope_->DropKids(); ++batch_cnt; diff --git a/paddle/fluid/framework/pull_dense_worker.cc b/paddle/fluid/framework/pull_dense_worker.cc index 556424311..510862198 100644 --- a/paddle/fluid/framework/pull_dense_worker.cc +++ b/paddle/fluid/framework/pull_dense_worker.cc @@ -18,6 +18,12 @@ namespace paddle { namespace framework { std::shared_ptr PullDenseWorker::s_instance_ = NULL; +std::mutex PullDenseWorker::mutex_for_version_; +std::map PullDenseWorker::last_versions_; +std::map PullDenseWorker::current_version_; +std::map> PullDenseWorker::training_versions_; +std::map> + PullDenseWorker::dense_value_names_; void PullDenseWorker::Initialize(const TrainerDesc& param) { running_ = false; -- GitLab