Work around a segfault observed in SparsePage::Push() (#7161)

* Work around a segfault observed in SparsePage::Push()

* Revert "Work around a segfault observed in SparsePage::Push()"

This reverts commit 30934844d00908750a5442082eb4769b1489f6a9.

* Don't call vector::resize() inside OpenMP block

* Set GITHUB_PAT env var to fix R tests

* Use built-in GITHUB_TOKEN
This commit is contained in:
Philip Hyunsu Cho 2021-08-08 02:12:30 -07:00 committed by GitHub
parent f7003dc819
commit 336af4f974
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -4,6 +4,7 @@ on: [push, pull_request]
env: env:
R_PACKAGES: c('XML', 'igraph', 'data.table', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float', 'titanic') R_PACKAGES: c('XML', 'igraph', 'data.table', 'ggplot2', 'DiagrammeR', 'Ckmeans.1d.dp', 'vcd', 'testthat', 'lintr', 'knitr', 'rmarkdown', 'e1071', 'cplm', 'devtools', 'float', 'titanic')
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
jobs: jobs:
lintr: lintr:

View File

@ -943,7 +943,7 @@ uint64_t SparsePage::Push(const AdapterBatchT& batch, float missing, int nthread
const size_t thread_size = batch_size / nthread; const size_t thread_size = batch_size / nthread;
builder.InitBudget(expected_rows, nthread); builder.InitBudget(expected_rows, nthread);
std::vector<std::vector<uint64_t>> max_columns_vector(nthread); std::vector<std::vector<uint64_t>> max_columns_vector(nthread, std::vector<uint64_t>{0});
dmlc::OMPException exec; dmlc::OMPException exec;
std::atomic<bool> valid{true}; std::atomic<bool> valid{true};
// First-pass over the batch counting valid elements // First-pass over the batch counting valid elements
@ -953,7 +953,6 @@ uint64_t SparsePage::Push(const AdapterBatchT& batch, float missing, int nthread
int tid = omp_get_thread_num(); int tid = omp_get_thread_num();
size_t begin = tid*thread_size; size_t begin = tid*thread_size;
size_t end = tid != (nthread-1) ? (tid+1)*thread_size : batch_size; size_t end = tid != (nthread-1) ? (tid+1)*thread_size : batch_size;
max_columns_vector[tid].resize(1, 0);
uint64_t& max_columns_local = max_columns_vector[tid][0]; uint64_t& max_columns_local = max_columns_vector[tid][0];
for (size_t i = begin; i < end; ++i) { for (size_t i = begin; i < end; ++i) {