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.
setLGBMthreads(num_threads)
maximum number of threads to be used by LightGBM in multi-threaded operations
getLGBMthreads