Skip to content

[R] More fixes for test n_threads.#12259

Merged
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:r-set-threads
Jun 21, 2026
Merged

[R] More fixes for test n_threads.#12259
trivialfis merged 1 commit into
dmlc:masterfrom
trivialfis:r-set-threads

Conversation

@trivialfis

@trivialfis trivialfis commented Jun 18, 2026

Copy link
Copy Markdown
Member

close #12258

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the XGBoost R package test suite to reduce thread-related nondeterminism and address a CRAN pre-test failure (issue #12258), primarily by enforcing single-thread execution in more test cases.

Changes:

  • Add nthread = 1 (or nthread = n_threads where n_threads is set to 1) to additional xgb.train() parameter lists and DMatrix constructors used in tests.
  • Set data.table to single-thread mode in tests/testthat.R via data.table::setDTthreads(1) before running test_check().

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
R-package/tests/testthat/test_poisson_regression.R Forces single-thread training parameters in Poisson regression tests to improve determinism.
R-package/tests/testthat/test_helpers.R Ensures xgb.plot.tree test trains with nthread = 1 even when params are passed as a plain list.
R-package/tests/testthat/test_custom_objective.R Pins nthread = 1 in multi-target custom metric tests to reduce thread-driven variance.
R-package/tests/testthat/test_basic.R Adds/propagates nthread to more DMatrix creation and training params in several test cases.
R-package/tests/testthat.R Sets OpenMP and data.table thread counts to 1 before executing the test suite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@trivialfis trivialfis merged commit 3d16c23 into dmlc:master Jun 21, 2026
81 checks passed
@trivialfis trivialfis deleted the r-set-threads branch June 21, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CRAN pre-test failure.

2 participants