Skip to content

Commit

Permalink
Remove set thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Feb 21, 2022
1 parent f7f5378 commit 1ecebd1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/data/simple_dmatrix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ SimpleDMatrix::SimpleDMatrix(RecordBatchesIterAdapter* adapter, float missing, i
auto& data_vec = sparse_page_->data.HostVector();
uint64_t total_batch_size = 0;
uint64_t total_elements = 0;
int nthread_original = common::OmpSetNumThreadsWithoutHT(&nthread);

adapter->BeforeFirst();
// Iterate over batches of input data
Expand All @@ -257,7 +256,7 @@ SimpleDMatrix::SimpleDMatrix(RecordBatchesIterAdapter* adapter, float missing, i
size_t num_elements = 0;
size_t num_rows = 0;
// Import Arrow RecordBatches
#pragma omp parallel for reduction(+:num_elements, num_rows) num_threads(nthread)
#pragma omp parallel for reduction(+ : num_elements, num_rows) num_threads(nthread)
for (int i = 0; i < static_cast<int>(batches.size()); ++i) { // NOLINT
num_elements += batches[i]->Import(missing);
num_rows += batches[i]->Size();
Expand All @@ -271,8 +270,8 @@ SimpleDMatrix::SimpleDMatrix(RecordBatchesIterAdapter* adapter, float missing, i
batch_offsets[i] = total_batch_size - num_rows;
batches[i]->ShiftRowOffsets(total_elements - num_elements);
} else {
batch_offsets[i] = batch_offsets[i-1] + batches[i-1]->Size();
batches[i]->ShiftRowOffsets(batches[i-1]->RowOffsets().back());
batch_offsets[i] = batch_offsets[i - 1] + batches[i - 1]->Size();
batches[i]->ShiftRowOffsets(batches[i - 1]->RowOffsets().back());
}
}
// Pre-allocate DMatrix memory
Expand Down Expand Up @@ -306,7 +305,6 @@ SimpleDMatrix::SimpleDMatrix(RecordBatchesIterAdapter* adapter, float missing, i
info_.num_row_ = total_batch_size;
info_.num_nonzero_ = data_vec.size();
CHECK_EQ(offset_vec.back(), info_.num_nonzero_);
omp_set_num_threads(nthread_original);
}
} // namespace data
} // namespace xgboost

0 comments on commit 1ecebd1

Please sign in to comment.