[R] Don't cap global number of threads for serialization (#10028)

This commit is contained in:
david-cortes
2024-02-20 04:13:00 +01:00
committed by GitHub
parent edf501d227
commit 6e3c899ba7
18 changed files with 37 additions and 20 deletions

View File

@@ -15,6 +15,7 @@ xgb.DMatrix.save(dmatrix, fname)
Save xgb.DMatrix object to binary file
}
\examples{
\dontshow{RhpcBLASctl::omp_set_num_threads(1)}
data(agaricus.train, package='xgboost')
dtrain <- with(agaricus.train, xgb.DMatrix(data, label = label, nthread = 2))
fname <- file.path(tempdir(), "xgb.DMatrix.data")

View File

@@ -44,6 +44,7 @@ as a \code{character} vector. Otherwise it will return \code{TRUE}.
Dump an xgboost model in text format.
}
\examples{
\dontshow{RhpcBLASctl::omp_set_num_threads(1)}
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')
train <- agaricus.train

View File

@@ -25,6 +25,7 @@ Note: a model saved as an R-object, has to be loaded using corresponding R-metho
not \code{xgb.load}.
}
\examples{
\dontshow{RhpcBLASctl::omp_set_num_threads(1)}
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')

View File

@@ -41,6 +41,7 @@ how to persist models in a future-proof way, i.e. to make the model accessible i
releases of XGBoost.
}
\examples{
\dontshow{RhpcBLASctl::omp_set_num_threads(1)}
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')

View File

@@ -21,6 +21,7 @@ xgb.save.raw(model, raw_format = "ubj")
Save xgboost model from xgboost or xgb.train
}
\examples{
\dontshow{RhpcBLASctl::omp_set_num_threads(1)}
data(agaricus.train, package='xgboost')
data(agaricus.test, package='xgboost')

View File

@@ -25,6 +25,15 @@ values of one or more global-scope parameters. Use \code{xgb.get.config} to fetc
values of all global-scope parameters (listed in
\url{https://xgboost.readthedocs.io/en/stable/parameter.html}).
}
\details{
Note that serialization-related functions might use a globally-configured number of threads,
which is managed by the system's OpenMP (OMP) configuration instead. Typically, XGBoost methods
accept an \code{nthreads} parameter, but some methods like \code{readRDS} might get executed before such
parameter can be supplied.
The number of OMP threads can in turn be configured for example through an environment variable
\code{OMP_NUM_THREADS} (needs to be set before R is started), or through \code{RhpcBLASctl::omp_set_num_threads}.
}
\examples{
# Set verbosity level to silent (0)
xgb.set.config(verbosity = 0)