Skip to content

Commit

Permalink
change buildcpu into prebuild and buildcpu into build;test=develop
Browse files Browse the repository at this point in the history
  • Loading branch information
danleifeng committed Oct 20, 2021
1 parent 12f1af8 commit cff37af
Showing 1 changed file with 13 additions and 18 deletions.
31 changes: 13 additions & 18 deletions paddle/fluid/framework/fleet/ps_gpu_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ void PSGPUWrapper::PreBuildTask(std::shared_ptr<HeterContext> gpu_task) {
auto& local_ptr = gpu_task->value_ptr_;

std::vector<std::thread> threads;
#ifdef PADDLE_WITH_PSLIB
auto fleet_ptr = FleetWrapper::GetInstance();
#endif
#ifdef PADDLE_WITH_PSCORE
auto fleet_ptr = paddle::distributed::Communicator::GetInstance();
#endif

// data should be in input channel
thread_keys_.resize(thread_keys_thread_num_);
Expand Down Expand Up @@ -177,18 +171,6 @@ void PSGPUWrapper::PreBuildTask(std::shared_ptr<HeterContext> gpu_task) {
VLOG(3) << "GpuPs shard: " << i << " key len: " << local_keys[i].size();
local_ptr[i].resize(local_keys[i].size());
}

#ifdef PADDLE_WITH_PSLIB
// get day_id: day nums from 1970
struct std::tm b;
b.tm_year = year_ - 1900;
b.tm_mon = month_ - 1;
b.tm_mday = day_;
b.tm_min = b.tm_hour = b.tm_sec = 0;
std::time_t seconds_from_1970 = std::mktime(&b);
int day_id = seconds_from_1970 / 86400;
fleet_ptr->pslib_ptr_->_worker_ptr->set_day_id(table_id_, day_id);
#endif
}

void PSGPUWrapper::BuildPull(std::shared_ptr<HeterContext> gpu_task) {
Expand All @@ -208,6 +190,19 @@ void PSGPUWrapper::BuildPull(std::shared_ptr<HeterContext> gpu_task) {
#ifdef PADDLE_WITH_PSCORE
auto fleet_ptr = paddle::distributed::Communicator::GetInstance();
#endif

#ifdef PADDLE_WITH_PSLIB
// get day_id: day nums from 1970
struct std::tm b;
b.tm_year = year_ - 1900;
b.tm_mon = month_ - 1;
b.tm_mday = day_;
b.tm_min = b.tm_hour = b.tm_sec = 0;
std::time_t seconds_from_1970 = std::mktime(&b);
int day_id = seconds_from_1970 / 86400;
fleet_ptr->pslib_ptr_->_worker_ptr->set_day_id(table_id_, day_id);
#endif

timeline.Start();
auto ptl_func = [this, &local_keys, &local_ptr, &fleet_ptr](int i) {
size_t key_size = local_keys[i].size();
Expand Down

1 comment on commit cff37af

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.