Skip to content

Commit cff37af

Browse files
committed
change buildcpu into prebuild and buildcpu into build;test=develop
1 parent 12f1af8 commit cff37af

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

paddle/fluid/framework/fleet/ps_gpu_wrapper.cc

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ void PSGPUWrapper::PreBuildTask(std::shared_ptr<HeterContext> gpu_task) {
5050
auto& local_ptr = gpu_task->value_ptr_;
5151

5252
std::vector<std::thread> threads;
53-
#ifdef PADDLE_WITH_PSLIB
54-
auto fleet_ptr = FleetWrapper::GetInstance();
55-
#endif
56-
#ifdef PADDLE_WITH_PSCORE
57-
auto fleet_ptr = paddle::distributed::Communicator::GetInstance();
58-
#endif
5953

6054
// data should be in input channel
6155
thread_keys_.resize(thread_keys_thread_num_);
@@ -177,18 +171,6 @@ void PSGPUWrapper::PreBuildTask(std::shared_ptr<HeterContext> gpu_task) {
177171
VLOG(3) << "GpuPs shard: " << i << " key len: " << local_keys[i].size();
178172
local_ptr[i].resize(local_keys[i].size());
179173
}
180-
181-
#ifdef PADDLE_WITH_PSLIB
182-
// get day_id: day nums from 1970
183-
struct std::tm b;
184-
b.tm_year = year_ - 1900;
185-
b.tm_mon = month_ - 1;
186-
b.tm_mday = day_;
187-
b.tm_min = b.tm_hour = b.tm_sec = 0;
188-
std::time_t seconds_from_1970 = std::mktime(&b);
189-
int day_id = seconds_from_1970 / 86400;
190-
fleet_ptr->pslib_ptr_->_worker_ptr->set_day_id(table_id_, day_id);
191-
#endif
192174
}
193175

194176
void PSGPUWrapper::BuildPull(std::shared_ptr<HeterContext> gpu_task) {
@@ -208,6 +190,19 @@ void PSGPUWrapper::BuildPull(std::shared_ptr<HeterContext> gpu_task) {
208190
#ifdef PADDLE_WITH_PSCORE
209191
auto fleet_ptr = paddle::distributed::Communicator::GetInstance();
210192
#endif
193+
194+
#ifdef PADDLE_WITH_PSLIB
195+
// get day_id: day nums from 1970
196+
struct std::tm b;
197+
b.tm_year = year_ - 1900;
198+
b.tm_mon = month_ - 1;
199+
b.tm_mday = day_;
200+
b.tm_min = b.tm_hour = b.tm_sec = 0;
201+
std::time_t seconds_from_1970 = std::mktime(&b);
202+
int day_id = seconds_from_1970 / 86400;
203+
fleet_ptr->pslib_ptr_->_worker_ptr->set_day_id(table_id_, day_id);
204+
#endif
205+
211206
timeline.Start();
212207
auto ptl_func = [this, &local_keys, &local_ptr, &fleet_ptr](int i) {
213208
size_t key_size = local_keys[i].size();

0 commit comments

Comments
 (0)