Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling threads #109

Closed
mayer79 opened this issue Oct 15, 2023 · 2 comments
Closed

Controlling threads #109

mayer79 opened this issue Oct 15, 2023 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@mayer79
Copy link
Collaborator

mayer79 commented Oct 15, 2023

How to control the number of threads used by XGBoost (and most probably its dependency data.table)?

In CRAN submissions, I got

* checking tests ... [41s/4s] NOTE
  Running ‘testthat.R’ [41s/4s]
Running R code in ‘testthat.R’ had CPU time 9.4 times elapsed time

Similar for examples.

Consequence:

  • All examples -> dontrun
  • All unit tests using XGBoost commented out -> low test coverage

There are discussions on the R dev mailing list that CRAN might limit resources per package from their side. But of course, it would be great to fix the problem already now.

What I have tried:

  1. Set params = list(nthread = 1) in all XGBoost tests
  2. Set nrounds = 1 in all XGBoost tests
  3. Set environment variables in the test script before loading {shapviz}. I think this does not work because the session has already started at that moment.
  4. Set `data.table::setDTthreads(1) in the test script.

Any hints?

@mayer79 mayer79 added enhancement New feature or request help wanted Extra attention is needed and removed enhancement New feature or request labels Oct 15, 2023
@jmaspons
Copy link
Contributor

Perhaps setting xgb.DMatrix(..., nthreads = 1)

@mayer79
Copy link
Collaborator Author

mayer79 commented Oct 19, 2023

Oh, that is indeed possible! I will definitively check during the next submission. I am not sure how to check beforehand: check_rhub(platforms = "debian-gcc-devel") does not seem to detect the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants