Unverified Commit 1548b42b authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] [c++] add tighter multithreading control, avoid global OpenMP side...

[R-package] [c++] add tighter multithreading control, avoid global OpenMP side effects (fixes #4705, fixes #5102) (#6226)
parent e7979852
......@@ -65,6 +65,8 @@ Construct \code{lgb.Dataset} object from dense matrix, sparse matrix
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -17,6 +17,8 @@ Construct Dataset explicitly
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -48,6 +48,8 @@ Construct validation data according to training data
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -20,6 +20,8 @@ Please note that \code{init_score} is not saved in binary file.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -22,6 +22,8 @@ Set the categorical features of an \code{lgb.Dataset} object. Use this function
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -19,6 +19,8 @@ If you want to use validation data, you should set reference to training data
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
# create training Dataset
data(agaricus.train, package ="lightgbm")
train <- agaricus.train
......
......@@ -114,6 +114,8 @@ Calling this function multiple times with different parameters might not overrid
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
library(lightgbm)
data(mtcars)
X <- as.matrix(mtcars[, -1L])
......
......@@ -152,6 +152,8 @@ Cross validation logic used by LightGBM
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -20,6 +20,8 @@ Dump LightGBM model to json
\examples{
\donttest{
library(lightgbm)
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -33,6 +33,8 @@ Given a \code{lgb.Booster}, return evaluation results for a
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
# train a regression model
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
......
......@@ -25,6 +25,8 @@ Creates a \code{data.table} of feature importances in a model.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -30,6 +30,8 @@ Computes feature contribution components of rawscore prediction.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
Logit <- function(x) log(x / (1.0 - x))
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
......
......@@ -20,6 +20,8 @@ Load LightGBM takes in either a file path or model string.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -40,6 +40,8 @@ Parse a LightGBM model json dump into a \code{data.table} structure.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -38,6 +38,8 @@ Features are shown ranked in a decreasing importance order.
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -35,6 +35,8 @@ contribution of a feature. Features are shown ranked in a decreasing contributio
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
Logit <- function(x) {
log(x / (1.0 - x))
}
......
......@@ -27,7 +27,10 @@ function. If you wish to make fast single-row predictions using a \code{lgb.Boos
call \link{lgb.configure_fast_predict} on the loaded \code{lgb.Booster} object.
}
\examples{
\donttest{
library(lightgbm)
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data("agaricus.train")
model <- lightgbm(
agaricus.train$data
......@@ -45,6 +48,7 @@ model_new$check_null_handle()
lgb.restore_handle(model_new)
model_new$check_null_handle()
}
}
\seealso{
\link{lgb.make_serializable}, \link{lgb.drop_serialized}.
}
......@@ -21,6 +21,8 @@ Save LightGBM model
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
library(lightgbm)
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
......
......@@ -130,6 +130,8 @@ Low-level R interface to train a LightGBM model. Unlike \code{\link{lightgbm}},
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
......@@ -121,6 +121,8 @@ If the model object has been configured for fast single-row predictions through
}
\examples{
\donttest{
\dontshow{setLGBMthreads(2L)}
\dontshow{data.table::setDTthreads(1L)}
data(agaricus.train, package = "lightgbm")
train <- agaricus.train
dtrain <- lgb.Dataset(train$data, label = train$label)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment