Skip to content

Commit

Permalink
limit number of threads in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
david-cortes committed Dec 3, 2023
1 parent 2c72fb8 commit 64febcf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R-package/tests/testthat/test_basic.R
Original file line number Diff line number Diff line change
Expand Up @@ -571,12 +571,13 @@ test_that("Can use multi-output labels with built-in objectives", {
y <- mtcars$mpg
x <- as.matrix(mtcars[, -1])
y_mirrored <- cbind(y, -y)
dm <- xgb.DMatrix(x, label = y_mirrored)
dm <- xgb.DMatrix(x, label = y_mirrored, nthread = n_threads)
model <- xgb.train(
params = list(
tree_method = "hist",
multi_strategy = "multi_output_tree",
objective = "reg:squarederror"
objective = "reg:squarederror",
nthread = n_threads
),
data = dm,
nrounds = 5
Expand All @@ -592,7 +593,7 @@ test_that("Can use multi-output labels with custom objectives", {
y <- mtcars$mpg
x <- as.matrix(mtcars[, -1])
y_mirrored <- cbind(y, -y)
dm <- xgb.DMatrix(x, label = y_mirrored)
dm <- xgb.DMatrix(x, label = y_mirrored, nthread = n_threads)
model <- xgb.train(
params = list(
tree_method = "hist",
Expand All @@ -604,7 +605,8 @@ test_that("Can use multi-output labels with custom objectives", {
hess <- rep(1, nrow(grad) * ncol(grad))
hess <- matrix(hess, nrow = nrow(grad))
return(list(grad = grad, hess = hess))
}
},
nthread = n_threads
),
data = dm,
nrounds = 5
Expand Down

0 comments on commit 64febcf

Please sign in to comment.