Skip to content

Commit

Permalink
remove get max thread function
Browse files Browse the repository at this point in the history
  • Loading branch information
qingshui committed Jul 16, 2021
1 parent 892163a commit 8e8eac6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
21 changes: 1 addition & 20 deletions paddle/fluid/framework/data_set.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1479,26 +1479,6 @@ inline paddle::framework::ThreadPool* GetShufflePool(int thread_num) {
}
return thread_pool.get();
}
int PadBoxSlotDataset::GetMaxShuffleThreadId(void) {
double rate = static_cast<double>(shuffle_thread_num_) /
static_cast<double>(thread_num_);
int thread_num = static_cast<int>(rate * read_ins_ref_);
int half_num = static_cast<int>(shuffle_thread_num_ >> 1);
if (thread_num < half_num) {
return half_num;
}
return thread_num;
}
int PadBoxSlotDataset::GetMaxMergeThreadId(void) {
double rate =
static_cast<double>(merge_thread_num_) / static_cast<double>(thread_num_);
int half_num = static_cast<int>(merge_thread_num_ >> 1);
int thread_num = static_cast<int>(rate * read_ins_ref_);
if (thread_num < half_num) {
return half_num;
}
return thread_num;
}
void PadBoxSlotDataset::CheckThreadPool(void) {
wait_futures_.clear();
if (thread_pool_ != nullptr && merge_pool_ != nullptr) {
Expand Down Expand Up @@ -1880,6 +1860,7 @@ void PadBoxSlotDataset::ReceiveSuffleData(int client_id, const char* buf,
--receiver_cnt_;

if (finished_counter_ == 0) {
usleep(10000);
while (receiver_cnt_ > 0) {
usleep(100);
}
Expand Down
2 changes: 0 additions & 2 deletions paddle/fluid/framework/data_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@ class PadBoxSlotDataset : public DatasetImpl<SlotRecord> {
protected:
void MergeInsKeys(const Channel<SlotRecord>& in);
void CheckThreadPool(void);
int GetMaxShuffleThreadId(void);
int GetMaxMergeThreadId(void);

protected:
Channel<SlotRecord> shuffle_channel_ = nullptr;
Expand Down

0 comments on commit 8e8eac6

Please sign in to comment.