[R] More fixes for test n_threads.#12259
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
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(ornthread = n_threadswheren_threadsis set to 1) to additionalxgb.train()parameter lists and DMatrix constructors used in tests. - Set
data.tableto single-thread mode intests/testthat.Rviadata.table::setDTthreads(1)before runningtest_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
added a commit
that referenced
this pull request
Jun 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #12258