Fix external memory race in colmaker. (#4980)

* Move `GetColDensity` out of omp parallel block.
This commit is contained in:
Jiaming Yuan
2019-10-25 04:11:13 -04:00
committed by GitHub
parent 96cd7ec2bb
commit 6ec7e300bd
9 changed files with 29 additions and 18 deletions

View File

@@ -121,7 +121,7 @@ void EllpackPageImpl::InitInfo(int device,
// Initialize the buffer to stored compressed features.
void EllpackPageImpl::InitCompressedData(int device, size_t num_rows) {
int num_symbols = matrix.info.n_bins + 1;
size_t num_symbols = matrix.info.n_bins + 1;
// Required buffer size for storing data matrix in ELLPack format.
size_t compressed_size_bytes = common::CompressedBufferWriter::CalculateBufferSize(

View File

@@ -140,7 +140,7 @@ struct RowStateOnDevice {
// to begin processing on each device
class DeviceHistogramBuilderState {
public:
explicit DeviceHistogramBuilderState(int n_rows) : device_row_state_(n_rows) {}
explicit DeviceHistogramBuilderState(size_t n_rows) : device_row_state_(n_rows) {}
const RowStateOnDevice& GetRowStateOnDevice() const {
return device_row_state_;

View File

@@ -41,6 +41,7 @@ class SparseBatchIteratorImpl : public BatchIteratorImpl<T> {
BatchSet<SparsePage> SparsePageDMatrix::GetRowBatches() {
auto cast = dynamic_cast<SparsePageSource<SparsePage>*>(row_source_.get());
CHECK(cast);
cast->BeforeFirst();
cast->Next();
auto begin_iter = BatchIterator<SparsePage>(

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2014 by Contributors
* Copyright (c) 2014-2019 by Contributors
* \file page_csr_source.h
* External memory data source, saved with sparse_batch_page binary format.
* \author Tianqi Chen
@@ -7,8 +7,6 @@
#ifndef XGBOOST_DATA_SPARSE_PAGE_SOURCE_H_
#define XGBOOST_DATA_SPARSE_PAGE_SOURCE_H_
#include <xgboost/base.h>
#include <xgboost/data.h>
#include <dmlc/threadediter.h>
#include <dmlc/timer.h>
@@ -20,6 +18,9 @@
#include <utility>
#include <vector>
#include "xgboost/base.h"
#include "xgboost/data.h"
#include "sparse_page_writer.h"
#include "../common/common.h"

View File

@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2014 by Contributors
* Copyright (c) 2014-2019 by Contributors
* \file sparse_page_writer.h
* \author Tianqi Chen
*/