Learn R Programming

lightgbm (version 4.5.0)

setLGBMThreads: Set maximum number of threads used by LightGBM

Description

LightGBM attempts to speed up many operations by using multi-threading. The number of threads used in those operations can be controlled via the num_threads parameter passed through params to functions like lgb.train and lgb.Dataset. However, some operations (like materializing a model from a text file) are done via code paths that don't explicitly accept thread-control configuration.

Use this function to set the maximum number of threads LightGBM will use for such operations.

This function affects all LightGBM operations in the same process.

So, for example, if you call setLGBMthreads(4), no other multi-threaded LightGBM operation in the same process will use more than 4 threads.

Call setLGBMthreads(-1) to remove this limitation.

Usage

setLGBMthreads(num_threads)

Arguments

num_threads

maximum number of threads to be used by LightGBM in multi-threaded operations

See Also

getLGBMthreads