From d51ffe860a656c168835686a8e318db572f81aef Mon Sep 17 00:00:00 2001 From: xujiaqi01 <173596896@qq.com> Date: Tue, 4 Feb 2020 21:19:25 +0800 Subject: [PATCH] fix copy table bug (#22432) * fix copy table bug of lost some feasign * test=develop --- paddle/fluid/framework/downpour_worker.cc | 38 ++++++++++++++--------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/paddle/fluid/framework/downpour_worker.cc b/paddle/fluid/framework/downpour_worker.cc index dd56b58c102..ebe62c7d05a 100644 --- a/paddle/fluid/framework/downpour_worker.cc +++ b/paddle/fluid/framework/downpour_worker.cc @@ -577,13 +577,6 @@ void DownpourWorker::TrainFilesWithProfiler() { timeline.Start(); if (copy_table_config_.need_copy()) { VLOG(3) << "copy_sparse_tables_.size " << copy_sparse_tables_.size(); - if (copy_table_config_.sparse_copy_by_feasign()) { - for (size_t i = 0; i < copy_sparse_tables_.size(); ++i) { - uint64_t tid = copy_sparse_tables_[i].first; - feasign_set_[tid].insert(sparse_push_keys_[tid].begin(), - sparse_push_keys_[tid].end()); - } - } if (batch_cnt % copy_table_config_.batch_num() == 0) { CopySparseTable(); CopyDenseTable(); @@ -696,6 +689,18 @@ void DownpourWorker::TrainFilesWithProfiler() { } } +#ifdef PADDLE_WITH_PSLIB + if (copy_table_config_.need_copy()) { + if (copy_table_config_.sparse_copy_by_feasign()) { + for (size_t i = 0; i < copy_sparse_tables_.size(); ++i) { + uint64_t tid = copy_sparse_tables_[i].first; + feasign_set_[tid].insert(sparse_push_keys_[tid].begin(), + sparse_push_keys_[tid].end()); + } + } + } +#endif + if (need_to_push_dense_) { timeline.Start(); for (int i = 0; i < param_.program_config(0).push_dense_table_id_size(); @@ -828,13 +833,6 @@ void DownpourWorker::TrainFiles() { int cur_batch; while ((cur_batch = device_reader_->Next()) > 0) { if (copy_table_config_.need_copy()) { - if (copy_table_config_.sparse_copy_by_feasign()) { - for (size_t i = 0; i < copy_sparse_tables_.size(); ++i) { - uint64_t tid = copy_sparse_tables_[i].first; - feasign_set_[tid].insert(sparse_push_keys_[tid].begin(), - sparse_push_keys_[tid].end()); - } - } if (batch_cnt % copy_table_config_.batch_num() == 0) { CopySparseTable(); CopyDenseTable(); @@ -918,6 +916,18 @@ void DownpourWorker::TrainFiles() { } } +#ifdef PADDLE_WITH_PSLIB + if (copy_table_config_.need_copy()) { + if (copy_table_config_.sparse_copy_by_feasign()) { + for (size_t i = 0; i < copy_sparse_tables_.size(); ++i) { + uint64_t tid = copy_sparse_tables_[i].first; + feasign_set_[tid].insert(sparse_push_keys_[tid].begin(), + sparse_push_keys_[tid].end()); + } + } + } +#endif + if (need_to_push_dense_) { for (int i = 0; i < param_.program_config(0).push_dense_table_id_size(); ++i) { -- GitLab